obi-sdk 0.3.8 → 0.3.10

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.
@@ -1,4 +1,4 @@
1
- import { O as ObiWidget } from "./chunks/obi-widget-d6306b0d.js";
1
+ import { O as ObiWidget } from "./chunks/obi-widget-c60b2f9f.js";
2
2
  import "./chunks/types-82772f00.js";
3
3
  if (!customElements.get("obi-widget")) {
4
4
  customElements.define("obi-widget", ObiWidget);
@@ -1,6 +1,6 @@
1
1
  import { S as SDKState } from "./chunks/types-82772f00.js";
2
- import { i, n, a as i$1, x } from "./chunks/obi-widget-d6306b0d.js";
3
- import { A, C, c, d, D, N, b, O, S } from "./chunks/obi-widget-d6306b0d.js";
2
+ import { i, n, a as i$1, x } from "./chunks/obi-widget-c60b2f9f.js";
3
+ import { A, C, c, d, D, N, b, O, S } from "./chunks/obi-widget-c60b2f9f.js";
4
4
  var __defProp$1 = Object.defineProperty;
5
5
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
6
6
  var __decorateClass$1 = (decorators, target, key, kind) => {
@@ -227,14 +227,14 @@ const controlPanel = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
227
227
  function defineCustomElements() {
228
228
  Promise.resolve().then(() => statusWidget);
229
229
  Promise.resolve().then(() => controlPanel);
230
- import("./chunks/obi-widget-d6306b0d.js").then((n2) => n2.o);
231
- import("./chunks/obi-widget-d6306b0d.js").then((n2) => n2.j);
232
- import("./chunks/obi-widget-d6306b0d.js").then((n2) => n2.k);
233
- import("./chunks/obi-widget-d6306b0d.js").then((n2) => n2.e);
234
- import("./chunks/obi-widget-d6306b0d.js").then((n2) => n2.f);
235
- import("./chunks/obi-widget-d6306b0d.js").then((n2) => n2.s);
236
- import("./chunks/obi-widget-d6306b0d.js").then((n2) => n2.g);
237
- import("./chunks/obi-widget-d6306b0d.js").then((n2) => n2.h);
230
+ import("./chunks/obi-widget-c60b2f9f.js").then((n2) => n2.o);
231
+ import("./chunks/obi-widget-c60b2f9f.js").then((n2) => n2.j);
232
+ import("./chunks/obi-widget-c60b2f9f.js").then((n2) => n2.k);
233
+ import("./chunks/obi-widget-c60b2f9f.js").then((n2) => n2.e);
234
+ import("./chunks/obi-widget-c60b2f9f.js").then((n2) => n2.f);
235
+ import("./chunks/obi-widget-c60b2f9f.js").then((n2) => n2.s);
236
+ import("./chunks/obi-widget-c60b2f9f.js").then((n2) => n2.g);
237
+ import("./chunks/obi-widget-c60b2f9f.js").then((n2) => n2.h);
238
238
  }
239
239
  export {
240
240
  A as AudioEqualizer,
@@ -1,5 +1,5 @@
1
1
  import { css as _A, LitElement as HA, html as se, svg as ni, nothing as Zr } from "lit";
2
- const Ws = "https://obi.getcor.io/api";
2
+ const Ws = {}.VITE_API_BASE_URL;
3
3
  function Af(t) {
4
4
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
5
5
  }
@@ -22464,18 +22464,18 @@ class MA extends HA {
22464
22464
  this.onClose && this.onClose();
22465
22465
  }
22466
22466
  async fetchCourses() {
22467
- var e, A;
22467
+ var e;
22468
22468
  try {
22469
22469
  this.loading = !0;
22470
- const s = ((A = (e = (await (await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`)).json()).sessions) == null ? void 0 : e.sessions) == null ? void 0 : A.map((o) => ({
22471
- id: o.uuid,
22472
- name: o.onboarding_plan.name,
22473
- description: o.onboarding_plan.description,
22474
- imageSrc: o.onboarding_plan.screen_url || "https://corproductionsydney-storagebucket5cb7c8ea-atg4gmftc6sk.s3.amazonaws.com/static/generic-course.png"
22475
- }))).filter((o) => !!o.name);
22476
- this.courses = [...s], this.requestUpdate();
22477
- } catch (n) {
22478
- console.error("Fetch error:", n), this.error = "Failed to fetch courses";
22470
+ const r = ((e = (await (await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`)).json()).sessions) == null ? void 0 : e.map((s) => ({
22471
+ id: s.uuid,
22472
+ name: s.onboarding_plan.name,
22473
+ description: s.onboarding_plan.description,
22474
+ imageSrc: s.onboarding_plan.screen_url || "https://corproductionsydney-storagebucket5cb7c8ea-atg4gmftc6sk.s3.amazonaws.com/static/generic-course.png"
22475
+ }))).filter((s) => !!s.name);
22476
+ this.courses = [...r], this.requestUpdate();
22477
+ } catch (A) {
22478
+ console.error("Fetch error:", A), this.error = "Failed to fetch courses";
22479
22479
  } finally {
22480
22480
  this.loading = !1, this.requestUpdate();
22481
22481
  }
@@ -240,7 +240,7 @@ var A=function(A){"use strict";const e="https://obi.getcor.io/api";function t(A)
240
240
  .error {
241
241
  color: #ef4444;
242
242
  }
243
- `,hB([Jf({type:Array})],pB.prototype,"courses",2),hB([Jf({type:Boolean})],pB.prototype,"loading",2),hB([Jf({type:String})],pB.prototype,"error",2),hB([Jf({type:Function})],pB.prototype,"onCourseSelect",2),customElements.get("obi-course")||customElements.define("obi-course",gB),customElements.get("obi-course-list")||customElements.define("obi-course-list",pB);var mB=Object.defineProperty,fB=Object.getOwnPropertyDescriptor,BB=(A,e,t,n)=>{for(var i,r=n>1?void 0:n?fB(e,t):e,s=A.length-1;s>=0;s--)(i=A[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&mB(e,t,r),r};class wB extends _f{constructor(){super(...arguments),this.courses=[],this.loading=!0,this.error="",this.apiKey="",this.apiBaseUrl=""}handleCourseSelect(A){this.onCourseSelect&&this.onCourseSelect(A.detail.id)}handleClose(){this.onClose&&this.onClose()}async fetchCourses(){try{this.loading=!0;const A=await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`),e=await A.json(),t=e.sessions?.sessions?.map((A=>({id:A.uuid,name:A.onboarding_plan.name,description:A.onboarding_plan.description,imageSrc:A.onboarding_plan.screen_url||"https://corproductionsydney-storagebucket5cb7c8ea-atg4gmftc6sk.s3.amazonaws.com/static/generic-course.png"}))),n=t.filter((A=>!!A.name));this.courses=[...n],this.requestUpdate()}catch(A){console.error("Fetch error:",A),this.error="Failed to fetch courses"}finally{this.loading=!1,this.requestUpdate()}}connectedCallback(){super.connectedCallback(),window.obiWidgetConfig?.apiKey&&(this.apiKey=window.obiWidgetConfig.apiKey),this.apiBaseUrl=e,this.apiBaseUrl&&this.apiKey?this.fetchCourses():(this.loading=!1,this.error="API base URL or API key is missing")}render(){return Qf`
243
+ `,hB([Jf({type:Array})],pB.prototype,"courses",2),hB([Jf({type:Boolean})],pB.prototype,"loading",2),hB([Jf({type:String})],pB.prototype,"error",2),hB([Jf({type:Function})],pB.prototype,"onCourseSelect",2),customElements.get("obi-course")||customElements.define("obi-course",gB),customElements.get("obi-course-list")||customElements.define("obi-course-list",pB);var mB=Object.defineProperty,fB=Object.getOwnPropertyDescriptor,BB=(A,e,t,n)=>{for(var i,r=n>1?void 0:n?fB(e,t):e,s=A.length-1;s>=0;s--)(i=A[s])&&(r=(n?i(e,t,r):i(r))||r);return n&&r&&mB(e,t,r),r};class wB extends _f{constructor(){super(...arguments),this.courses=[],this.loading=!0,this.error="",this.apiKey="",this.apiBaseUrl=""}handleCourseSelect(A){this.onCourseSelect&&this.onCourseSelect(A.detail.id)}handleClose(){this.onClose&&this.onClose()}async fetchCourses(){try{this.loading=!0;const A=await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`),e=await A.json(),t=e.sessions?.map((A=>({id:A.uuid,name:A.onboarding_plan.name,description:A.onboarding_plan.description,imageSrc:A.onboarding_plan.screen_url||"https://corproductionsydney-storagebucket5cb7c8ea-atg4gmftc6sk.s3.amazonaws.com/static/generic-course.png"}))),n=t.filter((A=>!!A.name));this.courses=[...n],this.requestUpdate()}catch(A){console.error("Fetch error:",A),this.error="Failed to fetch courses"}finally{this.loading=!1,this.requestUpdate()}}connectedCallback(){super.connectedCallback(),window.obiWidgetConfig?.apiKey&&(this.apiKey=window.obiWidgetConfig.apiKey),this.apiBaseUrl=e,this.apiBaseUrl&&this.apiKey?this.fetchCourses():(this.loading=!1,this.error="API base URL or API key is missing")}render(){return Qf`
244
244
  <div class="backdrop" @click=${this.handleClose}></div>
245
245
  <div class="container">
246
246
  <button class="close-button" @click=${this.handleClose}>×</button>