obi-sdk 0.4.1 → 0.4.3

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.
@@ -10272,7 +10272,6 @@ NavigationBar.styles = i$4`
10272
10272
  opacity: 1;
10273
10273
  transform: scale(1);
10274
10274
  pointer-events: auto;
10275
- background-color: #fff;
10276
10275
  }
10277
10276
 
10278
10277
  :host([data-direction="up"]) {
@@ -11155,7 +11154,7 @@ class SessionStartModal extends i$1 {
11155
11154
  <p class="subtitle">${this.session.description}</p>
11156
11155
  </div>
11157
11156
 
11158
- <button class="button button-primary" @click=${this.handleStart}>Continue →</button>
11157
+ <button class="button button-primary" @click=${this.handleStart}>Continue</button>
11159
11158
  </div>
11160
11159
  `;
11161
11160
  }
@@ -11164,6 +11163,7 @@ SessionStartModal.styles = i$4`
11164
11163
  :host {
11165
11164
  display: block;
11166
11165
  font-family: "Inter", sans-serif;
11166
+ box-sizing: border-box;
11167
11167
  }
11168
11168
 
11169
11169
  .backdrop {
@@ -11177,18 +11177,18 @@ SessionStartModal.styles = i$4`
11177
11177
  }
11178
11178
 
11179
11179
  .container {
11180
+ box-sizing: border-box;
11180
11181
  position: fixed;
11181
11182
  top: 50%;
11182
11183
  left: 50%;
11183
11184
  transform: translate(-50%, -50%);
11184
11185
  z-index: 50;
11185
- gap: 32px;
11186
11186
 
11187
11187
  /* Layout from user specifications */
11188
11188
  display: flex;
11189
11189
  width: 640px;
11190
11190
  min-height: 380px;
11191
- padding: 48px 48px 32px 48px;
11191
+ padding: 32px;
11192
11192
  flex-direction: column;
11193
11193
  justify-content: space-between;
11194
11194
  align-items: center;
@@ -11207,20 +11207,17 @@ SessionStartModal.styles = i$4`
11207
11207
  flex-direction: column;
11208
11208
  align-items: center;
11209
11209
  text-align: center;
11210
- gap: 16px;
11211
11210
  }
11212
11211
 
11213
11212
  .logo {
11214
11213
  display: flex;
11215
11214
  width: 96px;
11216
11215
  height: 96px;
11217
- padding: 8px;
11218
11216
  justify-content: center;
11219
11217
  align-items: center;
11220
- gap: 8px;
11221
11218
  aspect-ratio: 1/1;
11222
- border-radius: var(--border-radius-lg, 12px);
11223
- background: var(--tailwind-colors-violet-600, #7c3aed);
11219
+ border-radius: 8px;
11220
+ background: var(--obi-primary, #a10fff);
11224
11221
  box-shadow:
11225
11222
  0px 0px 8px 0px rgba(168, 85, 247, 0.12),
11226
11223
  0px 0px 8px 0px rgba(192, 132, 252, 0.24),
@@ -11238,32 +11235,36 @@ SessionStartModal.styles = i$4`
11238
11235
  }
11239
11236
 
11240
11237
  h1 {
11241
- font-family: "Syne", sans-serif;
11238
+ font-family: "Satoshi", sans-serif;
11242
11239
  font-size: 32px;
11243
11240
  font-weight: 700;
11244
11241
  color: #111827;
11245
11242
  margin: 0;
11243
+ margin-top: 32px;
11244
+ margin-bottom: 16px;
11246
11245
  }
11247
11246
 
11248
11247
  .subtitle {
11248
+ font-family: "Satoshi", sans-serif;
11249
+ font-weight: 300;
11249
11250
  font-size: 16px;
11250
- color: #6b7280;
11251
- line-height: 1.5;
11251
+ color: #18181b;
11252
+ line-height: 1.4;
11252
11253
  margin: 0;
11253
11254
  }
11254
11255
 
11255
11256
  .button {
11257
+ font-family: "Satoshi", sans-serif;
11258
+ font-weight: 400;
11259
+ font-size: 16px;
11256
11260
  padding: 12px 24px;
11257
11261
  border-radius: 8px;
11258
11262
  border: none;
11259
- font-size: 16px;
11260
- font-weight: 500;
11261
11263
  cursor: pointer;
11262
11264
  transition: all 0.2s ease;
11263
11265
  display: flex;
11264
11266
  align-items: center;
11265
11267
  justify-content: center;
11266
- gap: 8px;
11267
11268
  }
11268
11269
 
11269
11270
  .button-primary {
@@ -11279,6 +11280,7 @@ SessionStartModal.styles = i$4`
11279
11280
  border-radius: var(--border-radius-default, 6px);
11280
11281
  background: var(--base-primary, #18181b);
11281
11282
  color: white;
11283
+ margin-top: 32px;
11282
11284
  }
11283
11285
 
11284
11286
  .button-primary:hover {
@@ -11287,21 +11289,19 @@ SessionStartModal.styles = i$4`
11287
11289
 
11288
11290
  .close-button {
11289
11291
  position: absolute;
11290
- top: 16px;
11292
+ top: 12px;
11291
11293
  right: 16px;
11292
11294
  background: none;
11293
11295
  border: none;
11294
11296
  cursor: pointer;
11295
11297
  font-size: 24px;
11296
11298
  color: #6b7280;
11297
- padding: 4px;
11298
- border-radius: 4px;
11299
- transition: all 0.2s ease;
11300
- }
11301
-
11302
- .close-button:hover {
11303
- color: #374151;
11304
- background: #f3f4f6;
11299
+ padding: 0;
11300
+ margin: 0;
11301
+ line-height: 1;
11302
+ display: inline-flex;
11303
+ align-items: center;
11304
+ justify-content: center;
11305
11305
  }
11306
11306
  `;
11307
11307
  __decorateClass$1([
@@ -11327,7 +11327,6 @@ var __decorateClass = (decorators, target, key, kind) => {
11327
11327
  __defProp(target, key, result);
11328
11328
  return result;
11329
11329
  };
11330
- const WIDGET_PARAMS_KEY = "io.obi.widget-parameters";
11331
11330
  class ObiWidget extends i$1 {
11332
11331
  constructor() {
11333
11332
  super();
@@ -11421,9 +11420,12 @@ class ObiWidget extends i$1 {
11421
11420
  url.searchParams.delete(SESSION_URL_PARAM);
11422
11421
  window.history.replaceState({}, "", url.toString());
11423
11422
  try {
11424
- localStorage.removeItem(WIDGET_PARAMS_KEY);
11423
+ if (window.__obiUrlParams) {
11424
+ ;
11425
+ window.__obiUrlParams = null;
11426
+ }
11425
11427
  } catch (error) {
11426
- console.warn("Failed to remove widget parameters from localStorage:", error);
11428
+ console.warn("Failed to clean up window URL parameters:", error);
11427
11429
  }
11428
11430
  }
11429
11431
  /**
@@ -11613,13 +11615,8 @@ class ObiWidget extends i$1 {
11613
11615
  await this.checkExistingSession();
11614
11616
  if (!this.activeSession) {
11615
11617
  let storedParams = {};
11616
- try {
11617
- const storedParamsJson = localStorage.getItem(WIDGET_PARAMS_KEY);
11618
- if (storedParamsJson) {
11619
- storedParams = JSON.parse(storedParamsJson);
11620
- }
11621
- } catch (error) {
11622
- console.warn("Failed to parse stored widget parameters:", error);
11618
+ if (window.__obiUrlParams) {
11619
+ storedParams = window.__obiUrlParams;
11623
11620
  }
11624
11621
  if (Object.keys(storedParams).length === 0) {
11625
11622
  const urlParams = new URLSearchParams(window.location.search);
@@ -11630,8 +11627,13 @@ class ObiWidget extends i$1 {
11630
11627
  const sessionId = storedParams[SESSION_URL_PARAM];
11631
11628
  if (sessionId && this.apiKey) {
11632
11629
  await this.handleUrlSessionEvent(sessionId);
11633
- } else {
11634
- console.log("No session ID found or API key is not set");
11630
+ } else if (sessionId && !this.apiKey) {
11631
+ console.log("Session ID found but API key not ready, retrying...");
11632
+ setTimeout(() => {
11633
+ if (this.apiKey) {
11634
+ this.handleUrlSessionEvent(sessionId);
11635
+ }
11636
+ }, 100);
11635
11637
  }
11636
11638
  }
11637
11639
  }
@@ -11642,7 +11644,17 @@ class ObiWidget extends i$1 {
11642
11644
  this.boundSaveSessionData = this.saveSessionData.bind(this);
11643
11645
  window.addEventListener("beforeunload", this.boundSaveSessionData);
11644
11646
  window.addEventListener("pagehide", this.boundSaveSessionData);
11645
- this.sessionConnectionCheck();
11647
+ if (document.readyState === "complete") {
11648
+ Promise.resolve().then(() => this.sessionConnectionCheck());
11649
+ } else {
11650
+ window.addEventListener(
11651
+ "load",
11652
+ () => {
11653
+ Promise.resolve().then(() => this.sessionConnectionCheck());
11654
+ },
11655
+ { once: true }
11656
+ );
11657
+ }
11646
11658
  }
11647
11659
  disconnectedCallback() {
11648
11660
  if (this.closeNavTimeoutRef !== null) {
@@ -11722,6 +11734,8 @@ class ObiWidget extends i$1 {
11722
11734
  const isResearching = this.state === SDKState.RESEARCHING;
11723
11735
  const isUserSpeaking = this.state === SDKState.USER_SPEAKING;
11724
11736
  const isRotated = this.state !== SDKState.READY || this.navVisible;
11737
+ const shouldShowNav = this.state !== SDKState.READY || this.navVisible;
11738
+ const navDirection = this.position.includes("top") ? "down" : "up";
11725
11739
  const containerClasses = [
11726
11740
  "widget-container",
11727
11741
  isRotated ? "rotated" : "",
@@ -11736,11 +11750,11 @@ class ObiWidget extends i$1 {
11736
11750
  @mouseleave=${this.handleMouseLeave}
11737
11751
  >
11738
11752
  ${stateRender}
11739
- ${this.navVisible && this.state !== SDKState.RESEARCHING ? x`
11753
+ ${shouldShowNav && this.state !== SDKState.RESEARCHING ? x`
11740
11754
  <obi-navigation-bar
11741
11755
  ?isActive=${this.state !== SDKState.READY}
11742
11756
  .position=${this.position}
11743
- data-direction="up"
11757
+ data-direction="${navDirection}"
11744
11758
  .currentState=${this.state}
11745
11759
  .onItemSelect=${this.handleItemSelect.bind(this)}
11746
11760
  ></obi-navigation-bar>
@@ -11793,7 +11807,6 @@ ObiWidget.styles = i$4`
11793
11807
  :host([position="bottom-center"]) {
11794
11808
  bottom: 80px;
11795
11809
  left: 50%;
11796
- transform: translateX(-50%);
11797
11810
  }
11798
11811
 
11799
11812
  :host([position="top-right"]) {
@@ -11809,19 +11822,16 @@ ObiWidget.styles = i$4`
11809
11822
  :host([position="top-center"]) {
11810
11823
  top: 20px;
11811
11824
  left: 50%;
11812
- transform: translateX(-50%);
11813
11825
  }
11814
11826
 
11815
11827
  :host([position="middle-left"]) {
11816
11828
  top: 50%;
11817
11829
  left: 20px;
11818
- transform: translateY(-50%);
11819
11830
  }
11820
11831
 
11821
11832
  :host([position="middle-right"]) {
11822
11833
  top: 50%;
11823
11834
  right: 80px;
11824
- transform: translateY(-50%);
11825
11835
  }
11826
11836
 
11827
11837
  /* Adjust position when in researching state to accommodate wider container */
@@ -11851,6 +11861,23 @@ ObiWidget.styles = i$4`
11851
11861
  transition: all 0.2s ease-out;
11852
11862
  }
11853
11863
 
11864
+ /* Apply transforms to widget-container based on host position */
11865
+ :host([position="bottom-center"]) .widget-container {
11866
+ transform: translateX(-50%);
11867
+ }
11868
+
11869
+ :host([position="top-center"]) .widget-container {
11870
+ transform: translateX(-50%);
11871
+ }
11872
+
11873
+ :host([position="middle-left"]) .widget-container {
11874
+ transform: translateY(-50%);
11875
+ }
11876
+
11877
+ :host([position="middle-right"]) .widget-container {
11878
+ transform: translateY(-50%);
11879
+ }
11880
+
11854
11881
  .widget-container.user-speaking {
11855
11882
  background:
11856
11883
  linear-gradient(0deg, var(--obi-secondary), var(--obi-secondary)),
@@ -11956,4 +11983,4 @@ export {
11956
11983
  searchingLoader as s,
11957
11984
  x
11958
11985
  };
11959
- //# sourceMappingURL=obi-widget-58dc98b0.js.map
11986
+ //# sourceMappingURL=obi-widget-ad91b91a.js.map