obi-sdk 0.4.3 → 0.5.0

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.
@@ -2,7 +2,7 @@
2
2
  {
3
3
  try {
4
4
  let e2 = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n3 = new e2.Error().stack;
5
- n3 && (e2._sentryDebugIds = e2._sentryDebugIds || {}, e2._sentryDebugIds[n3] = "88c36738-368b-4394-97d5-50e60c281ae1", e2._sentryDebugIdIdentifier = "sentry-dbid-88c36738-368b-4394-97d5-50e60c281ae1");
5
+ n3 && (e2._sentryDebugIds = e2._sentryDebugIds || {}, e2._sentryDebugIds[n3] = "f8567e95-1087-443a-b981-3d05aab5158d", e2._sentryDebugIdIdentifier = "sentry-dbid-f8567e95-1087-443a-b981-3d05aab5158d");
6
6
  } catch (e2) {
7
7
  }
8
8
  }
@@ -10,9 +10,9 @@
10
10
  import { css, LitElement, html, svg, nothing } from "lit";
11
11
  {
12
12
  let _global = typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : {};
13
- _global.SENTRY_RELEASE = { id: "9ac38e819775646dac0916459e34ba6b9fab1598" };
13
+ _global.SENTRY_RELEASE = { id: "fd626264feb065ff2ae655db537a013b3b202d71" };
14
14
  }
15
- const API_BASE_URL = "http://localhost:5173/api";
15
+ const API_BASE_URL = {}.VITE_API_BASE_URL;
16
16
  const PATH_PARAM_RE = /\{[^{}]+\}/g;
17
17
  function randomID() {
18
18
  return Math.random().toString(36).slice(2, 11);
@@ -22945,7 +22945,7 @@ let I$1 = class I {
22945
22945
  function L$2(t2) {
22946
22946
  throw new W(t2);
22947
22947
  }
22948
- const DEFAULT_API_BASE_URL = "https://obi.getcor.io/api";
22948
+ const DEFAULT_API_BASE_URL = "https://app.coragents.ai/api";
22949
22949
  var SDKState;
22950
22950
  (function(SDKState2) {
22951
22951
  SDKState2["READY"] = "ready";
@@ -32201,6 +32201,96 @@ const STORAGE_KEYS = {
32201
32201
  SESSION_DATA: "session_data"
32202
32202
  };
32203
32203
  const storage = new StorageManager("io.obi.widget");
32204
+ const ORIGINAL_PRIMARY_COLOR = "#a10fff";
32205
+ function hexToHsl(hex) {
32206
+ hex = hex.replace(/^#/, "");
32207
+ if (!/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(hex)) {
32208
+ throw new Error(`Invalid hex color format: ${hex}`);
32209
+ }
32210
+ if (hex.length === 3) {
32211
+ hex = hex.split("").map((char) => char + char).join("");
32212
+ }
32213
+ const r2 = parseInt(hex.slice(0, 2), 16) / 255;
32214
+ const g2 = parseInt(hex.slice(2, 4), 16) / 255;
32215
+ const b2 = parseInt(hex.slice(4, 6), 16) / 255;
32216
+ const max = Math.max(r2, g2, b2);
32217
+ const min = Math.min(r2, g2, b2);
32218
+ let h2, s2, l2 = (max + min) / 2;
32219
+ if (max === min) {
32220
+ h2 = s2 = 0;
32221
+ } else {
32222
+ const d2 = max - min;
32223
+ s2 = l2 > 0.5 ? d2 / (2 - max - min) : d2 / (max + min);
32224
+ switch (max) {
32225
+ case r2:
32226
+ h2 = (g2 - b2) / d2 + (g2 < b2 ? 6 : 0);
32227
+ break;
32228
+ case g2:
32229
+ h2 = (b2 - r2) / d2 + 2;
32230
+ break;
32231
+ case b2:
32232
+ h2 = (r2 - g2) / d2 + 4;
32233
+ break;
32234
+ default:
32235
+ h2 = 0;
32236
+ }
32237
+ h2 /= 6;
32238
+ }
32239
+ return { h: h2 * 360, s: s2 * 100, l: l2 * 100 };
32240
+ }
32241
+ function hslToHex(h2, s2, l2) {
32242
+ h2 = h2 / 360;
32243
+ s2 = s2 / 100;
32244
+ l2 = l2 / 100;
32245
+ const hue2rgb2 = (p2, q, t2) => {
32246
+ if (t2 < 0)
32247
+ t2 += 1;
32248
+ if (t2 > 1)
32249
+ t2 -= 1;
32250
+ if (t2 < 1 / 6)
32251
+ return p2 + (q - p2) * 6 * t2;
32252
+ if (t2 < 1 / 2)
32253
+ return q;
32254
+ if (t2 < 2 / 3)
32255
+ return p2 + (q - p2) * (2 / 3 - t2) * 6;
32256
+ return p2;
32257
+ };
32258
+ let r2, g2, b2;
32259
+ if (s2 === 0) {
32260
+ r2 = g2 = b2 = l2;
32261
+ } else {
32262
+ const q = l2 < 0.5 ? l2 * (1 + s2) : l2 + s2 - l2 * s2;
32263
+ const p2 = 2 * l2 - q;
32264
+ r2 = hue2rgb2(p2, q, h2 + 1 / 3);
32265
+ g2 = hue2rgb2(p2, q, h2);
32266
+ b2 = hue2rgb2(p2, q, h2 - 1 / 3);
32267
+ }
32268
+ const toHex = (c2) => {
32269
+ const hex = Math.round(c2 * 255).toString(16);
32270
+ return hex.length === 1 ? "0" + hex : hex;
32271
+ };
32272
+ return `#${toHex(r2)}${toHex(g2)}${toHex(b2)}`;
32273
+ }
32274
+ function generateSelectedColor(currentPrimaryColor, designedSelectedColor) {
32275
+ try {
32276
+ const originalPrimaryHsl = hexToHsl(ORIGINAL_PRIMARY_COLOR);
32277
+ const designedSelectedHsl = hexToHsl(designedSelectedColor);
32278
+ const hueDelta = (designedSelectedHsl.h - originalPrimaryHsl.h + 360) % 360;
32279
+ const adjustedHueDelta = hueDelta > 180 ? hueDelta - 360 : hueDelta;
32280
+ const saturationDelta = designedSelectedHsl.s - originalPrimaryHsl.s;
32281
+ const lightnessDelta = designedSelectedHsl.l - originalPrimaryHsl.l;
32282
+ const currentPrimaryHsl = hexToHsl(currentPrimaryColor);
32283
+ const selectedHsl = {
32284
+ h: (currentPrimaryHsl.h + adjustedHueDelta + 360) % 360,
32285
+ s: Math.max(0, Math.min(100, currentPrimaryHsl.s + saturationDelta)),
32286
+ l: Math.max(0, Math.min(100, currentPrimaryHsl.l + lightnessDelta))
32287
+ };
32288
+ return hslToHex(selectedHsl.h, selectedHsl.s, selectedHsl.l);
32289
+ } catch (error) {
32290
+ console.warn("Failed to generate selected color, using fallback:", error);
32291
+ return designedSelectedColor;
32292
+ }
32293
+ }
32204
32294
  var __defProp$7 = Object.defineProperty;
32205
32295
  var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
32206
32296
  var __decorateClass$7 = (decorators, target, key, kind) => {
@@ -32421,7 +32511,7 @@ NavigationBar.styles = css`
32421
32511
  :host {
32422
32512
  display: flex;
32423
32513
  position: absolute;
32424
- z-index: 10000;
32514
+ z-index: 2147483647;
32425
32515
  width: 40px;
32426
32516
  transition: all 0.2s ease-in-out;
32427
32517
  opacity: 1;
@@ -32479,12 +32569,18 @@ class Course extends LitElement {
32479
32569
  this.id = "";
32480
32570
  this.name = "";
32481
32571
  this.description = "";
32482
- this.imageSrc = "";
32572
+ this.duration = 10;
32573
+ this.selected = false;
32483
32574
  }
32484
32575
  handleClick() {
32485
32576
  this.dispatchEvent(
32486
- new CustomEvent("course-select", {
32487
- detail: { id: this.id, name: this.name, description: this.description },
32577
+ new CustomEvent("course-card-click", {
32578
+ detail: {
32579
+ id: this.id,
32580
+ name: this.name,
32581
+ description: this.description,
32582
+ duration: this.duration
32583
+ },
32488
32584
  bubbles: true,
32489
32585
  composed: true
32490
32586
  })
@@ -32492,9 +32588,11 @@ class Course extends LitElement {
32492
32588
  }
32493
32589
  render() {
32494
32590
  return html`
32495
- <div class="course-container" @click=${this.handleClick}>
32496
- <img src=${this.imageSrc} alt="Course Preview" class="course-image" />
32497
- <h2 class="course-title">${this.name}</h2>
32591
+ <div class="course-container ${this.selected ? "selected" : ""}" @click=${this.handleClick}>
32592
+ <div class="header-row">
32593
+ <h2 class="course-title">${this.name}</h2>
32594
+ <span class="duration">~${this.duration} mins</span>
32595
+ </div>
32498
32596
  ${this.description ? html`<p class="course-description">${this.description}</p>` : ""}
32499
32597
  </div>
32500
32598
  `;
@@ -32506,12 +32604,19 @@ Course.styles = css`
32506
32604
  }
32507
32605
 
32508
32606
  .course-container {
32509
- padding: 16px 12px;
32510
- gap: 12px;
32511
- border-radius: 4px;
32512
- border: 1px solid #e5e7eb;
32607
+ display: flex;
32608
+ padding: 20px;
32609
+ align-items: flex-start;
32610
+ gap: 8px;
32611
+ height: 180px;
32612
+ border-radius: 6px;
32613
+ border: 1px solid rgba(0, 0, 0, 0.6);
32614
+ background: #fff;
32513
32615
  cursor: pointer;
32514
32616
  transition: all 0.2s;
32617
+ flex-direction: column;
32618
+ box-sizing: border-box;
32619
+ overflow: hidden;
32515
32620
  }
32516
32621
 
32517
32622
  .course-container:hover {
@@ -32524,26 +32629,73 @@ Course.styles = css`
32524
32629
  transform: scale(0.98);
32525
32630
  }
32526
32631
 
32527
- .course-image {
32528
- max-height: 160px;
32529
- border-radius: 2px;
32530
- border: 1px solid #e5e7eb;
32531
- object-fit: cover;
32532
- width: 100%;
32533
- margin-bottom: 12px;
32632
+ .course-container.selected {
32633
+ border-radius: 6px;
32634
+ border: 1px solid var(--obi-course-selected, #c76cff);
32635
+ background: var(--obi-course-selected-bg, #fbf3ff);
32636
+ }
32637
+
32638
+ .course-container.selected:hover {
32639
+ background: var(--obi-course-selected-bg, #fbf3ff);
32640
+ }
32641
+
32642
+ .header-row {
32643
+ display: flex;
32644
+ justify-content: space-between;
32645
+ align-items: flex-start;
32646
+ align-self: stretch;
32647
+ flex-shrink: 0;
32648
+ text-align: left;
32534
32649
  }
32535
32650
 
32536
32651
  .course-title {
32537
- font-size: 14px;
32538
- font-weight: bold;
32652
+ color: #000;
32653
+ font-family: Satoshi;
32654
+ font-size: 20px;
32655
+ font-style: normal;
32656
+ font-weight: 500;
32657
+ line-height: 100%; /* 20px */
32658
+ letter-spacing: -0.2px;
32539
32659
  margin: 0;
32540
- margin-bottom: 12px;
32541
32660
  }
32542
32661
 
32543
- .course-description {
32662
+ .duration {
32663
+ display: flex;
32664
+ padding: 4px 12px;
32665
+ justify-content: center;
32666
+ align-items: center;
32667
+ gap: 8px;
32668
+ border-radius: 9999px;
32669
+ background: #f5f3ff;
32670
+ color: #000;
32671
+ font-family: Satoshi;
32544
32672
  font-size: 14px;
32545
- color: #71717a;
32673
+ font-style: normal;
32674
+ font-weight: 500;
32675
+ line-height: 100%; /* 14px */
32676
+ letter-spacing: -0.14px;
32677
+ flex-shrink: 0;
32678
+ }
32679
+
32680
+ .course-container.selected .duration {
32681
+ background: #fff;
32682
+ }
32683
+
32684
+ .course-description {
32685
+ flex: 1 0 0;
32686
+ color: rgba(0, 0, 0, 0.6);
32687
+ font-family: Satoshi;
32688
+ font-size: 16px;
32689
+ font-style: normal;
32690
+ font-weight: 400;
32691
+ line-height: 140%; /* 22.4px */
32692
+ letter-spacing: -0.16px;
32546
32693
  margin: 0;
32694
+ overflow: hidden;
32695
+ display: -webkit-box;
32696
+ -webkit-line-clamp: 4;
32697
+ -webkit-box-orient: vertical;
32698
+ text-align: left;
32547
32699
  }
32548
32700
  `;
32549
32701
  __decorateClass$5([
@@ -32556,12 +32708,16 @@ __decorateClass$5([
32556
32708
  n$3({ type: String })
32557
32709
  ], Course.prototype, "description", 2);
32558
32710
  __decorateClass$5([
32559
- n$3({ type: String })
32560
- ], Course.prototype, "imageSrc", 2);
32711
+ n$3({ type: Number })
32712
+ ], Course.prototype, "duration", 2);
32713
+ __decorateClass$5([
32714
+ n$3({ type: Boolean })
32715
+ ], Course.prototype, "selected", 2);
32561
32716
  class CourseList extends LitElement {
32562
32717
  constructor() {
32563
32718
  super(...arguments);
32564
32719
  this.courses = [];
32720
+ this.selectedCourseId = null;
32565
32721
  this.loading = false;
32566
32722
  this.error = "";
32567
32723
  }
@@ -32575,19 +32731,20 @@ class CourseList extends LitElement {
32575
32731
  if (!this.courses || this.courses.length === 0) {
32576
32732
  return html`<div class="empty">No courses available</div>`;
32577
32733
  }
32578
- const gridClass = this.courses.length === 1 ? "grid-cols-1" : this.courses.length === 2 ? "grid-cols-2" : "grid-cols-3";
32579
32734
  return html`
32580
- <div class="course-grid ${gridClass}">
32581
- ${this.courses.map(
32582
- (course) => html`
32735
+ <div class="course-grid">
32736
+ ${this.courses.map((course) => {
32737
+ const isSelected = course.id === this.selectedCourseId;
32738
+ return html`
32583
32739
  <obi-course
32584
32740
  id=${course.id}
32585
32741
  name=${course.name}
32586
32742
  description=${course.description || ""}
32587
- imageSrc=${course.imageSrc}
32743
+ duration=${course.duration}
32744
+ ?selected=${isSelected}
32588
32745
  ></obi-course>
32589
- `
32590
- )}
32746
+ `;
32747
+ })}
32591
32748
  </div>
32592
32749
  `;
32593
32750
  }
@@ -32599,20 +32756,17 @@ CourseList.styles = css`
32599
32756
 
32600
32757
  .course-grid {
32601
32758
  display: grid;
32602
- gap: 12px;
32603
- margin-top: 24px;
32604
- }
32605
-
32606
- .course-grid.grid-cols-1 {
32607
- grid-template-columns: 1fr;
32608
- }
32609
-
32610
- .course-grid.grid-cols-2 {
32611
- grid-template-columns: 1fr 1fr;
32759
+ grid-template-columns: 1fr 1fr 1fr;
32760
+ gap: 4px;
32761
+ padding: 12px 0px;
32762
+ flex: 1 0 0;
32763
+ align-self: stretch;
32612
32764
  }
32613
32765
 
32614
- .course-grid.grid-cols-3 {
32615
- grid-template-columns: 1fr 1fr 1fr;
32766
+ @media (max-width: 767px) {
32767
+ .course-grid {
32768
+ grid-template-columns: 1fr;
32769
+ }
32616
32770
  }
32617
32771
 
32618
32772
  .loading,
@@ -32631,6 +32785,9 @@ CourseList.styles = css`
32631
32785
  __decorateClass$5([
32632
32786
  n$3({ type: Array })
32633
32787
  ], CourseList.prototype, "courses", 2);
32788
+ __decorateClass$5([
32789
+ n$3({ type: String })
32790
+ ], CourseList.prototype, "selectedCourseId", 2);
32634
32791
  __decorateClass$5([
32635
32792
  n$3({ type: Boolean })
32636
32793
  ], CourseList.prototype, "loading", 2);
@@ -32662,12 +32819,25 @@ class CourseModal extends LitElement {
32662
32819
  this.error = "";
32663
32820
  this.apiKey = "";
32664
32821
  this.apiBaseUrl = "";
32822
+ this.selectedCourse = null;
32665
32823
  }
32666
32824
  handleClose() {
32667
32825
  if (this.onClose) {
32668
32826
  this.onClose();
32669
32827
  }
32670
32828
  }
32829
+ handleGetStarted() {
32830
+ if (this.selectedCourse) {
32831
+ this.dispatchEvent(
32832
+ new CustomEvent("course-select", {
32833
+ detail: this.selectedCourse,
32834
+ bubbles: true,
32835
+ composed: true
32836
+ })
32837
+ );
32838
+ this.onClose?.();
32839
+ }
32840
+ }
32671
32841
  async fetchCourses() {
32672
32842
  try {
32673
32843
  this.loading = true;
@@ -32677,7 +32847,7 @@ class CourseModal extends LitElement {
32677
32847
  id: session.uuid,
32678
32848
  name: session.onboarding_plan.name,
32679
32849
  description: session.onboarding_plan.description,
32680
- imageSrc: session.onboarding_plan.screen_url || "https://corproductionsydney-storagebucket5cb7c8ea-atg4gmftc6sk.s3.amazonaws.com/static/generic-course.png"
32850
+ duration: session.onboarding_plan.duration
32681
32851
  }));
32682
32852
  const filteredCourses = mappedCourses.filter((course) => !!course.name);
32683
32853
  this.courses = [...filteredCourses];
@@ -32690,6 +32860,10 @@ class CourseModal extends LitElement {
32690
32860
  this.requestUpdate();
32691
32861
  }
32692
32862
  }
32863
+ handleCourseCardClick(event) {
32864
+ const { id, name, description, duration: duration2 } = event.detail;
32865
+ this.selectedCourse = { id, name, description, duration: duration2 };
32866
+ }
32693
32867
  connectedCallback() {
32694
32868
  super.connectedCallback();
32695
32869
  if (window.obiWidgetConfig?.apiKey) {
@@ -32705,19 +32879,70 @@ class CourseModal extends LitElement {
32705
32879
  }
32706
32880
  render() {
32707
32881
  return html`
32708
- <div class="backdrop" @click=${this.handleClose}></div>
32882
+ <div class="backdrop"></div>
32709
32883
  <div class="container">
32710
- <button class="close-button" @click=${this.handleClose}>×</button>
32711
32884
  <div class="header">
32712
- <h1>Give Obi a try!</h1>
32713
- <p class="subtitle">Pick a tour, share your screen, and Obi will take it from there.</p>
32885
+ <div class="icon">${obiIcon}</div>
32886
+ <div class="title-section">
32887
+ <h1>Give Obi a try!</h1>
32888
+ <p class="subtitle">Pick a tour, share your screen, and Obi will take it from there.</p>
32889
+ </div>
32890
+ <button class="close-button" aria-label="Close course modal" @click=${this.handleClose}>
32891
+ <svg
32892
+ xmlns="http://www.w3.org/2000/svg"
32893
+ width="24"
32894
+ height="24"
32895
+ viewBox="0 0 24 24"
32896
+ fill="none"
32897
+ >
32898
+ <path
32899
+ d="M18 6L6 18M6 6L18 18"
32900
+ stroke="black"
32901
+ stroke-width="2"
32902
+ stroke-linecap="round"
32903
+ stroke-linejoin="round"
32904
+ />
32905
+ </svg>
32906
+ </button>
32907
+ </div>
32908
+
32909
+ <div class="course-list-wrapper">
32910
+ <obi-course-list
32911
+ .courses=${this.courses}
32912
+ .selectedCourseId=${this.selectedCourse?.id || ""}
32913
+ .loading=${this.loading}
32914
+ .error=${this.error}
32915
+ @course-card-click=${this.handleCourseCardClick}
32916
+ ></obi-course-list>
32714
32917
  </div>
32715
32918
 
32716
- <obi-course-list
32717
- .courses=${this.courses}
32718
- .loading=${this.loading}
32719
- .error=${this.error}
32720
- ></obi-course-list>
32919
+ <div class="footer">
32920
+ <button
32921
+ class="footer-button"
32922
+ @click=${this.handleGetStarted}
32923
+ ?disabled=${!this.selectedCourse}
32924
+ >
32925
+ <span>Get started</span>
32926
+ <svg
32927
+ xmlns="http://www.w3.org/2000/svg"
32928
+ width="17"
32929
+ height="16"
32930
+ viewBox="0 0 17 16"
32931
+ fill="none"
32932
+ >
32933
+ <path
32934
+ d="M3.83325 8.00065H13.1666M13.1666 8.00065L8.49992 3.33398M13.1666 8.00065L8.49992 12.6673"
32935
+ stroke=${this.selectedCourse ? "#FAFAFA" : "#999"}
32936
+ stroke-width="1.33"
32937
+ stroke-linecap="round"
32938
+ stroke-linejoin="round"
32939
+ />
32940
+ </svg>
32941
+ </button>
32942
+ <p class="footer-text">
32943
+ Sessions are securely recorded for quality improvement purposes.
32944
+ </p>
32945
+ </div>
32721
32946
  </div>
32722
32947
  `;
32723
32948
  }
@@ -32740,23 +32965,42 @@ CourseModal.styles = css`
32740
32965
  }
32741
32966
 
32742
32967
  .container {
32968
+ /* Positioning & Sizing */
32743
32969
  position: fixed;
32744
- background-color: white;
32745
- color: black;
32746
- border: 1px solid #e5e7eb;
32747
- width: 640px;
32748
- max-height: 80vh;
32749
- overflow-y: auto;
32750
- padding: 48px;
32751
- gap: 12px;
32752
32970
  top: 50%;
32753
32971
  left: 50%;
32754
32972
  transform: translate(-50%, -50%);
32755
- border-radius: 4px;
32973
+ width: 90%;
32974
+ max-width: 1200px;
32975
+ max-height: 80vh;
32756
32976
  z-index: 50;
32977
+ text-align: center;
32978
+ color: black;
32979
+
32980
+ /* Layout styles */
32757
32981
  display: flex;
32982
+ padding: 32px;
32758
32983
  flex-direction: column;
32759
- text-align: center;
32984
+ align-items: center;
32985
+ gap: 24px;
32986
+ flex: 1 0 0;
32987
+ align-self: stretch;
32988
+
32989
+ /* Appearance styles */
32990
+ border-radius: 12px;
32991
+ background: #fafafa;
32992
+
32993
+ /* shadow/lg */
32994
+ box-shadow:
32995
+ 0px 10px 15px -3px rgba(0, 0, 0, 0.1),
32996
+ 0px 4px 6px -2px rgba(0, 0, 0, 0.05);
32997
+ }
32998
+
32999
+ .course-list-wrapper {
33000
+ flex: 1;
33001
+ overflow-y: auto;
33002
+ width: 100%;
33003
+ min-height: 0;
32760
33004
  }
32761
33005
 
32762
33006
  .container:hover {
@@ -32778,32 +33022,122 @@ CourseModal.styles = css`
32778
33022
  }
32779
33023
 
32780
33024
  .header {
32781
- margin-bottom: 24px;
32782
- text-align: center;
33025
+ display: flex;
33026
+ align-items: flex-start;
33027
+ gap: 16px;
33028
+ width: 100%;
33029
+ text-align: left;
33030
+ }
33031
+
33032
+ .icon {
33033
+ display: flex;
33034
+ width: 56px;
33035
+ height: 56px;
33036
+ padding: 12px;
33037
+ justify-content: center;
33038
+ align-items: center;
33039
+ border-radius: 12px;
33040
+ border: 1px solid var(--obi-primary, #a10fff);
33041
+ background: var(--obi-primary, #a10fff);
33042
+ box-sizing: border-box;
33043
+ }
33044
+
33045
+ .icon img {
33046
+ width: 32px;
33047
+ height: 32px;
33048
+ color: white;
33049
+ fill: #fff;
33050
+ }
33051
+
33052
+ .title-section {
33053
+ align-self: stretch;
33054
+ flex: 1;
32783
33055
  }
32784
33056
 
32785
33057
  h1 {
33058
+ color: #18181b;
33059
+ font-family: Satoshi;
32786
33060
  font-size: 32px;
33061
+ font-style: normal;
32787
33062
  font-weight: 700;
33063
+ line-height: 90%; /* 28.8px */
33064
+ letter-spacing: -0.96px;
32788
33065
  margin: 0;
32789
33066
  margin-bottom: 8px;
32790
33067
  }
32791
33068
 
32792
33069
  .subtitle {
33070
+ color: #18181b;
33071
+ font-family: Satoshi;
32793
33072
  font-size: 20px;
32794
- color: rgb(113 113 122 / 1);
33073
+ font-style: normal;
33074
+ font-weight: 500;
33075
+ line-height: 90%; /* 18px */
33076
+ letter-spacing: -0.6px;
32795
33077
  margin: 0;
32796
33078
  }
32797
33079
 
32798
33080
  .close-button {
32799
- position: absolute;
32800
- top: 16px;
32801
- right: 16px;
33081
+ width: 24px;
33082
+ height: 24px;
32802
33083
  background: none;
32803
33084
  border: none;
32804
33085
  cursor: pointer;
32805
- font-size: 24px;
32806
- color: #6b7280;
33086
+ padding: 0;
33087
+ display: flex;
33088
+ align-items: center;
33089
+ justify-content: center;
33090
+ }
33091
+
33092
+ .footer {
33093
+ display: flex;
33094
+ width: 360px;
33095
+ flex-direction: column;
33096
+ align-items: center;
33097
+ gap: 12px;
33098
+ }
33099
+
33100
+ .footer-button {
33101
+ display: flex;
33102
+ height: 48px;
33103
+ padding: 16px;
33104
+ justify-content: center;
33105
+ align-items: center;
33106
+ gap: 8px;
33107
+ align-self: stretch;
33108
+ border-radius: 6px;
33109
+ background: #18181b;
33110
+ border: none;
33111
+ cursor: pointer;
33112
+ color: #fafafa;
33113
+ font-family: Satoshi;
33114
+ font-weight: 500;
33115
+ transition: opacity 0.2s ease;
33116
+ }
33117
+
33118
+ .footer-button:disabled {
33119
+ opacity: 0.5;
33120
+ cursor: not-allowed;
33121
+ }
33122
+
33123
+ .footer-button:not(:disabled) {
33124
+ opacity: 1;
33125
+ }
33126
+
33127
+ .footer-button:not(:disabled):hover {
33128
+ background: #27272a;
33129
+ }
33130
+
33131
+ .footer-text {
33132
+ color: #18181b;
33133
+ font-family: Satoshi;
33134
+ font-size: 12px;
33135
+ font-style: normal;
33136
+ font-weight: 400;
33137
+ line-height: 100%; /* 12px */
33138
+ letter-spacing: -0.12px;
33139
+ margin: 0;
33140
+ text-align: center;
32807
33141
  }
32808
33142
  `;
32809
33143
  __decorateClass$4([
@@ -32824,6 +33158,9 @@ __decorateClass$4([
32824
33158
  __decorateClass$4([
32825
33159
  r$2()
32826
33160
  ], CourseModal.prototype, "apiBaseUrl", 2);
33161
+ __decorateClass$4([
33162
+ r$2()
33163
+ ], CourseModal.prototype, "selectedCourse", 2);
32827
33164
  if (!customElements.get("obi-course-modal")) {
32828
33165
  customElements.define("obi-course-modal", CourseModal);
32829
33166
  }
@@ -33188,11 +33525,11 @@ class AudioEqualizer extends LitElement {
33188
33525
  this.canvasRef = e();
33189
33526
  this.barCount = 8;
33190
33527
  this.animationFrame = null;
33191
- this.primaryColor = "#9500ff";
33528
+ this.primaryColor = ORIGINAL_PRIMARY_COLOR;
33192
33529
  }
33193
33530
  connectedCallback() {
33194
33531
  super.connectedCallback();
33195
- this.primaryColor = getComputedStyle(this).getPropertyValue("--obi-primary").trim() || "#9500ff";
33532
+ this.primaryColor = getComputedStyle(this).getPropertyValue("--obi-primary").trim() || ORIGINAL_PRIMARY_COLOR;
33196
33533
  this.startAnimation();
33197
33534
  }
33198
33535
  disconnectedCallback() {
@@ -33486,7 +33823,7 @@ SearchingLoader.styles = css`
33486
33823
  display: flex;
33487
33824
  align-items: center;
33488
33825
  gap: 8px;
33489
- background-color: var(--obi-primary);
33826
+ background-color: var(--obi-primary, #a10fff);
33490
33827
  border-radius: 12px;
33491
33828
  padding: 8px 12px;
33492
33829
  }
@@ -33526,7 +33863,13 @@ class SessionStartModal extends LitElement {
33526
33863
  return html`
33527
33864
  <div class="backdrop"></div>
33528
33865
  <div class="container">
33529
- <button class="close-button" @click=${this.handleClose}>×</button>
33866
+ <button
33867
+ class="close-button"
33868
+ aria-label="Close session start modal"
33869
+ @click=${this.handleClose}
33870
+ >
33871
+ ×
33872
+ </button>
33530
33873
 
33531
33874
  <div class="header">
33532
33875
  <div class="logo">${obiIcon}</div>
@@ -33631,6 +33974,7 @@ SessionStartModal.styles = css`
33631
33974
  color: #18181b;
33632
33975
  line-height: 1.4;
33633
33976
  margin: 0;
33977
+ margin-bottom: 32px;
33634
33978
  }
33635
33979
 
33636
33980
  .button {
@@ -33650,21 +33994,21 @@ SessionStartModal.styles = css`
33650
33994
  .button-primary {
33651
33995
  display: flex;
33652
33996
  width: 100%;
33653
- height: var(--height-h-11, 44px);
33654
- padding: var(--spacing-2, 8px) var(--spacing-4, 16px);
33997
+ height: 44px;
33998
+ padding: 8px 16px;
33655
33999
  justify-content: center;
33656
34000
  align-items: center;
33657
- gap: var(--spacing-2, 8px);
34001
+ gap: 8px;
33658
34002
  flex-shrink: 0;
33659
34003
  align-self: stretch;
33660
- border-radius: var(--border-radius-default, 6px);
33661
- background: var(--base-primary, #18181b);
34004
+ border-radius: 6px;
34005
+ background: #18181b;
33662
34006
  color: white;
33663
34007
  margin-top: 32px;
33664
34008
  }
33665
34009
 
33666
34010
  .button-primary:hover {
33667
- background: color-mix(in srgb, var(--base-primary, #18181b) 90%, white);
34011
+ background: color-mix(in srgb, #18181b 90%, white);
33668
34012
  }
33669
34013
 
33670
34014
  .close-button {
@@ -33750,6 +34094,7 @@ class ObiWidget extends LitElement {
33750
34094
  const sessionsResponse = await this.obiClient.listSessions(this.apiKey);
33751
34095
  if (sessionsResponse.data) {
33752
34096
  const sessions = sessionsResponse.data.sessions;
34097
+ console.log("[obi-sdk] sessions:", sessions);
33753
34098
  const matchingSession = sessions?.find((session) => session.uuid === sessionToken);
33754
34099
  if (matchingSession) {
33755
34100
  const sessionWithPlan = matchingSession;
@@ -33761,7 +34106,7 @@ class ObiWidget extends LitElement {
33761
34106
  this.state = SDKState.LOADING;
33762
34107
  this.showSessionStartModal = true;
33763
34108
  } else {
33764
- console.log("No session found with token:", sessionToken);
34109
+ console.log("[obi-sdk] no session found with token:", sessionToken);
33765
34110
  }
33766
34111
  }
33767
34112
  } catch (error) {
@@ -33791,22 +34136,37 @@ class ObiWidget extends LitElement {
33791
34136
  if (window.obiWidgetConfig.linkOnlyAccess !== void 0) {
33792
34137
  this.linkOnlyAccess = window.obiWidgetConfig.linkOnlyAccess;
33793
34138
  }
33794
- this.style.setProperty("--obi-primary", window.obiWidgetConfig?.primaryColor || "#9500ff");
33795
- this.style.setProperty("--obi-secondary", window.obiWidgetConfig?.secondaryColor || "#c4b5fd");
34139
+ const primaryColor = window.obiWidgetConfig?.primaryColor || ORIGINAL_PRIMARY_COLOR;
34140
+ this.style.setProperty("--obi-primary", primaryColor);
34141
+ this.generateColorVariables(primaryColor);
34142
+ }
34143
+ }
34144
+ /**
34145
+ * Generate additional color variables based on the primary color
34146
+ */
34147
+ generateColorVariables(primaryColor) {
34148
+ try {
34149
+ const secondaryColor = generateSelectedColor(primaryColor, "#c4b5fd");
34150
+ const courseSelected = generateSelectedColor(primaryColor, "#c76cff");
34151
+ const courseSelectedBackground = generateSelectedColor(primaryColor, "#fbf3ff");
34152
+ const pausedPulseColor = generateSelectedColor(primaryColor, "#A06DF9");
34153
+ this.style.setProperty("--obi-secondary", secondaryColor);
34154
+ this.style.setProperty("--obi-course-selected", courseSelected);
34155
+ this.style.setProperty("--obi-course-selected-bg", courseSelectedBackground);
34156
+ this.style.setProperty("--obi-paused-pulse", pausedPulseColor);
34157
+ } catch (error) {
34158
+ console.warn("Failed to generate color variables:", error);
34159
+ this.style.setProperty("--obi-secondary", "#c4b5fd");
34160
+ this.style.setProperty("--obi-course-selected", "#c76cff");
34161
+ this.style.setProperty("--obi-course-selected-bg", "#fbf3ff");
34162
+ this.style.setProperty("--obi-paused-pulse", "#A06DF9");
33796
34163
  }
33797
34164
  }
33798
34165
  removeSessionUrlParams() {
33799
34166
  const url = new URL(window.location.href);
33800
34167
  url.searchParams.delete(SESSION_URL_PARAM);
33801
34168
  window.history.replaceState({}, "", url.toString());
33802
- try {
33803
- if (window.__obiUrlParams) {
33804
- ;
33805
- window.__obiUrlParams = null;
33806
- }
33807
- } catch (error) {
33808
- console.warn("Failed to clean up window URL parameters:", error);
33809
- }
34169
+ localStorage.removeItem("obi-url-params");
33810
34170
  }
33811
34171
  /**
33812
34172
  * Create a new ObiSession instance with common configuration
@@ -33938,6 +34298,7 @@ class ObiWidget extends LitElement {
33938
34298
  if (!sessionToken || !roomToken || !roomUrl) {
33939
34299
  return;
33940
34300
  }
34301
+ console.log("[obi-sdk] using existing session");
33941
34302
  if (sessionExpiry) {
33942
34303
  const expiryDate = new Date(sessionExpiry);
33943
34304
  if (expiryDate < /* @__PURE__ */ new Date()) {
@@ -33992,51 +34353,50 @@ class ObiWidget extends LitElement {
33992
34353
  }
33993
34354
  }
33994
34355
  async sessionConnectionCheck() {
33995
- await this.checkExistingSession();
33996
- if (!this.activeSession) {
34356
+ const sessionId = function() {
33997
34357
  let storedParams = {};
33998
- if (window.__obiUrlParams) {
33999
- storedParams = window.__obiUrlParams;
34000
- }
34358
+ storedParams = JSON.parse(localStorage.getItem("obi-url-params") || "{}");
34001
34359
  if (Object.keys(storedParams).length === 0) {
34002
34360
  const urlParams = new URLSearchParams(window.location.search);
34003
34361
  urlParams.forEach((value, key) => {
34004
34362
  storedParams[key] = value;
34005
34363
  });
34006
34364
  }
34007
- const sessionId = storedParams[SESSION_URL_PARAM];
34008
- if (sessionId && this.apiKey) {
34009
- await this.handleUrlSessionEvent(sessionId);
34010
- } else if (sessionId && !this.apiKey) {
34011
- console.log("Session ID found but API key not ready, retrying...");
34012
- setTimeout(() => {
34013
- if (this.apiKey) {
34014
- this.handleUrlSessionEvent(sessionId);
34015
- }
34016
- }, 100);
34017
- }
34365
+ localStorage.removeItem("obi-url-params");
34366
+ return storedParams[SESSION_URL_PARAM];
34367
+ }();
34368
+ if (!sessionId) {
34369
+ await this.checkExistingSession();
34370
+ return;
34371
+ }
34372
+ console.log("[obi-sdk] using magic link");
34373
+ if (this.apiKey) {
34374
+ await this.handleUrlSessionEvent(sessionId);
34375
+ } else {
34376
+ console.log("[obi-sdk] API key not ready, retrying...");
34377
+ setTimeout(() => {
34378
+ if (this.apiKey) {
34379
+ this.handleUrlSessionEvent(sessionId);
34380
+ }
34381
+ }, 100);
34018
34382
  }
34019
34383
  }
34020
34384
  connectedCallback() {
34021
34385
  super.connectedCallback();
34022
34386
  this.updateFromConfig();
34387
+ this.addEventListener("obi-config-updated", this.handleConfigUpdate.bind(this));
34023
34388
  this.setAttribute("position", this.position);
34024
34389
  this.boundSaveSessionData = this.saveSessionData.bind(this);
34025
34390
  window.addEventListener("beforeunload", this.boundSaveSessionData);
34026
34391
  window.addEventListener("pagehide", this.boundSaveSessionData);
34027
- if (document.readyState === "complete") {
34028
- Promise.resolve().then(() => this.sessionConnectionCheck());
34029
- } else {
34030
- window.addEventListener(
34031
- "load",
34032
- () => {
34033
- Promise.resolve().then(() => this.sessionConnectionCheck());
34034
- },
34035
- { once: true }
34036
- );
34392
+ this.addEventListener("course-select", this.handleCourseSelectEvent);
34393
+ if (this.isActive) {
34394
+ this.sessionConnectionCheck();
34037
34395
  }
34038
34396
  }
34039
34397
  disconnectedCallback() {
34398
+ super.disconnectedCallback();
34399
+ this.removeEventListener("obi-config-updated", this.handleConfigUpdate.bind(this));
34040
34400
  if (this.closeNavTimeoutRef !== null) {
34041
34401
  window.clearTimeout(this.closeNavTimeoutRef);
34042
34402
  }
@@ -34049,7 +34409,19 @@ class ObiWidget extends LitElement {
34049
34409
  window.removeEventListener("pagehide", this.boundSaveSessionData);
34050
34410
  }
34051
34411
  this.removeSessionUrlParams();
34052
- super.disconnectedCallback();
34412
+ }
34413
+ handleConfigUpdate(event) {
34414
+ const customEvent = event;
34415
+ const updatedConfig = customEvent.detail;
34416
+ const needsInit = updatedConfig.isActive && !this.isActive;
34417
+ this.updateFromConfig();
34418
+ if (this.position) {
34419
+ this.setAttribute("position", this.position);
34420
+ }
34421
+ if (needsInit) {
34422
+ this.sessionConnectionCheck();
34423
+ }
34424
+ this.requestUpdate();
34053
34425
  }
34054
34426
  handleMouseEnter() {
34055
34427
  this.isHovering = true;
@@ -34110,7 +34482,8 @@ class ObiWidget extends LitElement {
34110
34482
  N$1.union(SDKState.USER_SPEAKING, SDKState.AGENT_SPEAKING),
34111
34483
  () => html`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`
34112
34484
  ).with(SDKState.THINKING, () => html`<obi-dot-loader></obi-dot-loader>`).with(SDKState.PAUSED, () => obiIcon).otherwise(() => obiIcon);
34113
- const isPulseState = this.state === SDKState.USER_SPEAKING || this.state === SDKState.AGENT_SPEAKING;
34485
+ const isSpeakingPulseState = this.state === SDKState.USER_SPEAKING || this.state === SDKState.AGENT_SPEAKING;
34486
+ const isPausedPulse = this.state === SDKState.PAUSED;
34114
34487
  const isResearching = this.state === SDKState.RESEARCHING;
34115
34488
  const isUserSpeaking = this.state === SDKState.USER_SPEAKING;
34116
34489
  const isRotated = this.state !== SDKState.READY || this.navVisible;
@@ -34119,7 +34492,8 @@ class ObiWidget extends LitElement {
34119
34492
  const containerClasses = [
34120
34493
  "widget-container",
34121
34494
  isRotated ? "rotated" : "",
34122
- isPulseState ? "pulse" : "",
34495
+ isSpeakingPulseState ? "pulse" : "",
34496
+ isPausedPulse ? "paused-pulse" : "",
34123
34497
  isResearching ? "researching" : "",
34124
34498
  isUserSpeaking ? "user-speaking" : ""
34125
34499
  ].filter(Boolean).join(" ");
@@ -34142,8 +34516,8 @@ class ObiWidget extends LitElement {
34142
34516
  </div>
34143
34517
  ${this.showCourseModal ? html`<obi-course-modal
34144
34518
  .onClose=${() => this.showCourseModal = false}
34145
- @course-select=${this.handleCourseSelectEvent}
34146
34519
  .apiKey=${this.apiKey}
34520
+ @course-select=${this.handleCourseSelectEvent}
34147
34521
  ></obi-course-modal>` : nothing}
34148
34522
  ${this.showSessionStartModal && this.selectedCourse ? html`<obi-session-start-modal
34149
34523
  .session=${this.selectedCourse}
@@ -34162,11 +34536,17 @@ ObiWidget.styles = css`
34162
34536
  :host {
34163
34537
  display: block;
34164
34538
  position: fixed;
34165
- z-index: 9999;
34539
+ z-index: 2147483600;
34166
34540
  font-family: "Inter", sans-serif;
34167
- --obi-primary: #9500ff;
34541
+ pointer-events: auto;
34542
+ --obi-primary: #a10fff;
34168
34543
  --obi-secondary: #c4b5fd;
34169
34544
  --obi-danger: #ef4444;
34545
+
34546
+ /* Generated color variables (defaults based on original design) */
34547
+ --obi-course-selected: #c76cff;
34548
+ --obi-course-selected-bg: #fbf3ff;
34549
+ --obi-paused-pulse: #a06df9;
34170
34550
  }
34171
34551
 
34172
34552
  h1 {
@@ -34233,12 +34613,13 @@ ObiWidget.styles = css`
34233
34613
  height: 56px;
34234
34614
  border-radius: 12px;
34235
34615
  border-color: transparent;
34236
- background-color: var(--obi-primary);
34616
+ background-color: var(--obi-primary, #a10fff);
34237
34617
  display: flex;
34238
34618
  align-items: center;
34239
34619
  justify-content: center;
34240
34620
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
34241
34621
  transition: all 0.2s ease-out;
34622
+ pointer-events: auto;
34242
34623
  }
34243
34624
 
34244
34625
  /* Apply transforms to widget-container based on host position */
@@ -34279,19 +34660,26 @@ ObiWidget.styles = css`
34279
34660
  }
34280
34661
 
34281
34662
  @keyframes pulse-shadow {
34282
- 0% {
34283
- box-shadow: 0 0 0 0 color-mix(in srgb, var(--obi-primary) 40%, transparent);
34284
- }
34285
- 70% {
34286
- box-shadow: 0 0 0 10px color-mix(in srgb, var(--obi-primary) 0%, transparent);
34287
- }
34663
+ 0%,
34288
34664
  100% {
34289
- box-shadow: 0 0 0 0 color-mix(in srgb, var(--obi-primary) 0%, transparent);
34665
+ box-shadow: 0px 0px 15px 2px
34666
+ color-mix(in srgb, var(--obi-primary, #a10fff) 75%, transparent);
34667
+ }
34668
+
34669
+ 50% {
34670
+ box-shadow: 0px 0px 25px 5px
34671
+ color-mix(in srgb, var(--obi-primary, #a10fff) 90%, transparent);
34290
34672
  }
34291
34673
  }
34292
34674
 
34293
34675
  .pulse {
34294
34676
  animation: pulse-shadow 2s ease-in-out infinite;
34677
+ box-shadow: none;
34678
+ }
34679
+
34680
+ .paused-pulse {
34681
+ box-shadow: 0px 0px 18px 6px
34682
+ color-mix(in srgb, var(--obi-paused-pulse, #a06df9) 75%, transparent);
34295
34683
  }
34296
34684
  `;
34297
34685
  __decorateClass([
@@ -40088,7 +40476,7 @@ async function retryOperation(operation, operationName, maxAttempts = RETRY_CONF
40088
40476
  return await operation();
40089
40477
  } catch (error) {
40090
40478
  lastError = error;
40091
- console.warn(`${operationName} failed (attempt ${attempt + 1}/${maxAttempts}):`, error);
40479
+ console.warn(`[obi-sdk] ${operationName} failed (attempt ${attempt + 1}/${maxAttempts}):`, error);
40092
40480
  if (attempt < maxAttempts - 1) {
40093
40481
  const delayMs = getRetryDelay(attempt);
40094
40482
  await delay(delayMs);
@@ -40099,8 +40487,9 @@ async function retryOperation(operation, operationName, maxAttempts = RETRY_CONF
40099
40487
  }
40100
40488
  function mountSDK() {
40101
40489
  const w2 = window;
40490
+ let q = [];
40102
40491
  if (typeof w2.ObiSDK === "function" || typeof w2.ObiSDK === "object") {
40103
- return;
40492
+ q = w2.ObiSDK.q || [];
40104
40493
  }
40105
40494
  w2.ObiSDK = function(command, config) {
40106
40495
  if (command === "update" && config) {
@@ -40108,9 +40497,19 @@ function mountSDK() {
40108
40497
  ...w2.obiWidgetConfig,
40109
40498
  ...config
40110
40499
  };
40500
+ const widgets = document.querySelectorAll("obi-widget");
40501
+ widgets.forEach((widget) => {
40502
+ widget.dispatchEvent(
40503
+ new CustomEvent("obi-config-updated", {
40504
+ detail: config,
40505
+ bubbles: true,
40506
+ composed: true
40507
+ })
40508
+ );
40509
+ });
40111
40510
  }
40112
40511
  };
40113
- w2.ObiSDK.q = [];
40512
+ w2.ObiSDK.q = q;
40114
40513
  }
40115
40514
  async function mountWidget() {
40116
40515
  return retryOperation(async () => {
@@ -40122,20 +40521,14 @@ async function mountWidget() {
40122
40521
  }
40123
40522
  const widget = document.createElement("obi-widget");
40124
40523
  document.body.appendChild(widget);
40125
- console.log("Obi Widget mounted");
40126
- }, "Widget mounting");
40524
+ console.log("[obi-sdk] widget mounted");
40525
+ }, "widget mounting");
40127
40526
  }
40128
40527
  function processQueue() {
40129
40528
  const w2 = window;
40130
40529
  if (w2.ObiSDK && Array.isArray(w2.ObiSDK.q)) {
40131
- w2.ObiSDK.q.forEach((args) => {
40132
- const [command, config] = args;
40133
- if (command === "update" && config) {
40134
- w2.obiWidgetConfig = {
40135
- ...w2.obiWidgetConfig,
40136
- ...config
40137
- };
40138
- }
40530
+ (w2.ObiSDK.q || []).forEach((args) => {
40531
+ w2.ObiSDK(...args);
40139
40532
  });
40140
40533
  w2.ObiSDK.q = [];
40141
40534
  }
@@ -40150,57 +40543,37 @@ async function loadFont(fontUrl) {
40150
40543
  throw new Error("document.head not available");
40151
40544
  }
40152
40545
  const link = document.createElement("link");
40153
- document.head.querySelectorAll("link[data-obi-font]").forEach((node) => node.remove());
40154
- link.setAttribute("data-obi-font", "true");
40155
40546
  link.href = fontUrl;
40156
40547
  link.rel = "stylesheet";
40157
- return new Promise((resolve, reject) => {
40158
- const timeout = setTimeout(() => {
40159
- reject(new Error("Font loading timeout"));
40160
- }, 5e3);
40161
- link.onload = () => {
40162
- clearTimeout(timeout);
40163
- resolve();
40164
- };
40165
- link.onerror = () => {
40166
- clearTimeout(timeout);
40167
- reject(new Error("Font loading failed"));
40168
- };
40169
- document.head.appendChild(link);
40170
- });
40171
- }, "Font loading");
40548
+ document.head.appendChild(link);
40549
+ }, "font loading");
40172
40550
  }
40173
40551
  async function safeInitialize() {
40174
- try {
40175
- mountSDK();
40176
- await loadFonts();
40177
- await mountWidget();
40178
- processQueue();
40179
- console.log("Obi Widget initialized successfully");
40180
- } catch (error) {
40181
- console.error("Obi Widget initialization failed:", error);
40182
- try {
40183
- mountSDK();
40184
- processQueue();
40185
- console.log("Obi Widget fallback initialization completed");
40186
- } catch (fallbackError) {
40187
- console.error("Obi Widget fallback initialization failed:", fallbackError);
40188
- }
40189
- }
40552
+ await new Promise((resolve) => setTimeout(resolve, 500));
40553
+ mountSDK();
40554
+ await loadFonts();
40555
+ await mountWidget();
40556
+ processQueue();
40190
40557
  }
40191
- function initializeObiWidget() {
40558
+ async function initializeObiWidget() {
40192
40559
  if (document.readyState === "loading") {
40193
- document.addEventListener("DOMContentLoaded", () => {
40194
- safeInitialize();
40560
+ document.addEventListener("DOMContentLoaded", async () => {
40561
+ try {
40562
+ await safeInitialize();
40563
+ } catch (error) {
40564
+ captureException(error);
40565
+ console.error("[obi-sdk] initialization failed:", error);
40566
+ }
40195
40567
  });
40196
40568
  } else {
40197
- safeInitialize();
40569
+ await safeInitialize();
40198
40570
  }
40199
40571
  }
40200
40572
  try {
40201
40573
  initializeObiWidget();
40202
40574
  } catch (error) {
40203
40575
  captureException(error);
40576
+ console.error("[obi-sdk] initialization failed:", error);
40204
40577
  }
40205
40578
  export {
40206
40579
  ObiWidget