obi-sdk 0.3.9 → 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.
@@ -304,7 +304,7 @@ a=extmap-allow-mixed`)!==-1){const r=i.sdp.split(`
304
304
  .error {
305
305
  color: #ef4444;
306
306
  }
307
- `,LA([Z({type:Array})],un.prototype,"courses",2),LA([Z({type:Boolean})],un.prototype,"loading",2),LA([Z({type:String})],un.prototype,"error",2),LA([Z({type:Function})],un.prototype,"onCourseSelect",2),customElements.get("obi-course")||customElements.define("obi-course",It),customElements.get("obi-course-list")||customElements.define("obi-course-list",un);var Nb=Object.defineProperty,Kb=Object.getOwnPropertyDescriptor,Rt=(t,e,A,n)=>{for(var i=n>1?void 0:n?Kb(e,A):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,A,i):s(i))||i);return n&&i&&Nb(e,A,i),i};class DA extends _.LitElement{constructor(){super(...arguments),this.courses=[],this.loading=!0,this.error="",this.apiKey="",this.apiBaseUrl=""}handleCourseSelect(e){this.onCourseSelect&&this.onCourseSelect(e.detail.id)}handleClose(){this.onClose&&this.onClose()}async fetchCourses(){var e,A;try{this.loading=!0;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=>({id:o.uuid,name:o.onboarding_plan.name,description:o.onboarding_plan.description,imageSrc:o.onboarding_plan.screen_url||"https://corproductionsydney-storagebucket5cb7c8ea-atg4gmftc6sk.s3.amazonaws.com/static/generic-course.png"}))).filter(o=>!!o.name);this.courses=[...s],this.requestUpdate()}catch(n){console.error("Fetch error:",n),this.error="Failed to fetch courses"}finally{this.loading=!1,this.requestUpdate()}}connectedCallback(){var e;super.connectedCallback(),(e=window.obiWidgetConfig)!=null&&e.apiKey&&(this.apiKey=window.obiWidgetConfig.apiKey),this.apiBaseUrl=qr,this.apiBaseUrl&&this.apiKey?this.fetchCourses():(this.loading=!1,this.error="API base URL or API key is missing")}render(){return _.html`
307
+ `,LA([Z({type:Array})],un.prototype,"courses",2),LA([Z({type:Boolean})],un.prototype,"loading",2),LA([Z({type:String})],un.prototype,"error",2),LA([Z({type:Function})],un.prototype,"onCourseSelect",2),customElements.get("obi-course")||customElements.define("obi-course",It),customElements.get("obi-course-list")||customElements.define("obi-course-list",un);var Nb=Object.defineProperty,Kb=Object.getOwnPropertyDescriptor,Rt=(t,e,A,n)=>{for(var i=n>1?void 0:n?Kb(e,A):e,r=t.length-1,s;r>=0;r--)(s=t[r])&&(i=(n?s(e,A,i):s(i))||i);return n&&i&&Nb(e,A,i),i};class DA extends _.LitElement{constructor(){super(...arguments),this.courses=[],this.loading=!0,this.error="",this.apiKey="",this.apiBaseUrl=""}handleCourseSelect(e){this.onCourseSelect&&this.onCourseSelect(e.detail.id)}handleClose(){this.onClose&&this.onClose()}async fetchCourses(){var e;try{this.loading=!0;const r=((e=(await(await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`)).json()).sessions)==null?void 0:e.map(s=>({id:s.uuid,name:s.onboarding_plan.name,description:s.onboarding_plan.description,imageSrc:s.onboarding_plan.screen_url||"https://corproductionsydney-storagebucket5cb7c8ea-atg4gmftc6sk.s3.amazonaws.com/static/generic-course.png"}))).filter(s=>!!s.name);this.courses=[...r],this.requestUpdate()}catch(A){console.error("Fetch error:",A),this.error="Failed to fetch courses"}finally{this.loading=!1,this.requestUpdate()}}connectedCallback(){var e;super.connectedCallback(),(e=window.obiWidgetConfig)!=null&&e.apiKey&&(this.apiKey=window.obiWidgetConfig.apiKey),this.apiBaseUrl=qr,this.apiBaseUrl&&this.apiKey?this.fetchCourses():(this.loading=!1,this.error="API base URL or API key is missing")}render(){return _.html`
308
308
  <div class="backdrop" @click=${this.handleClose}></div>
309
309
  <div class="container">
310
310
  <button class="close-button" @click=${this.handleClose}>×</button>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obi-sdk",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
4
4
  "description": "JavaScript SDK for Obi",
5
5
  "type": "module",
6
6
  "main": "dist/obi-sdk.umd.js",