obi-sdk 0.4.0 → 0.4.2
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.
- package/dist/modular/chunks/{obi-widget-9ef6796a.js → obi-widget-2ba751b3.js} +57 -52
- package/dist/modular/chunks/obi-widget-2ba751b3.js.map +1 -0
- package/dist/modular/chunks/{types-82772f00.js → types-e0297e7b.js} +2 -2
- package/dist/modular/chunks/{types-82772f00.js.map → types-e0297e7b.js.map} +1 -1
- package/dist/modular/core.js +1 -1
- package/dist/modular/index.js +95 -14
- package/dist/modular/index.js.map +1 -1
- package/dist/modular/ui.js +11 -11
- package/dist/obi-sdk.es.js +155 -69
- package/dist/obi-sdk.es.js.map +1 -1
- package/dist/obi-sdk.standalone.iife.js +69 -68
- package/dist/obi-sdk.standalone.iife.js.map +1 -1
- package/dist/obi-sdk.umd.js +58 -57
- package/dist/obi-sdk.umd.js.map +1 -1
- package/dist/ui/components/session-start-modal/index.d.ts +1 -0
- package/dist/ui/components/{session-start-modal.d.ts → session-start-modal/session-start-modal.d.ts} +1 -2
- package/dist/ui/components/session-start-modal/session-start-modal.stories.d.ts +37 -0
- package/index.d.ts +0 -2
- package/package.json +11 -4
- package/dist/modular/chunks/obi-widget-9ef6796a.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SDKState, E as EventEmitter, R as RoomEvent, T as Track, z as z$2, a as Room, A as API_BASE_URL, N as N$1 } from "./types-
|
|
1
|
+
import { S as SDKState, E as EventEmitter, R as RoomEvent, T as Track, z as z$2, a as Room, A as API_BASE_URL, N as N$1 } from "./types-e0297e7b.js";
|
|
2
2
|
const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
3
3
|
function randomID() {
|
|
4
4
|
return Math.random().toString(36).slice(2, 11);
|
|
@@ -878,7 +878,6 @@ class ObiSession {
|
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
880
|
const SESSION_URL_PARAM = "49206C6F7665204F6269_session";
|
|
881
|
-
const API_KEY_URL_PARAM = "49206C6F7665204F6269_client";
|
|
882
881
|
var extendStatics = function(d2, b2) {
|
|
883
882
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) {
|
|
884
883
|
d3.__proto__ = b3;
|
|
@@ -11144,14 +11143,9 @@ class SessionStartModal extends i$1 {
|
|
|
11144
11143
|
this.onClose();
|
|
11145
11144
|
}
|
|
11146
11145
|
}
|
|
11147
|
-
handleBackdropClick(e2) {
|
|
11148
|
-
if (e2.target === e2.currentTarget) {
|
|
11149
|
-
this.handleClose();
|
|
11150
|
-
}
|
|
11151
|
-
}
|
|
11152
11146
|
render() {
|
|
11153
11147
|
return x`
|
|
11154
|
-
<div class="backdrop"
|
|
11148
|
+
<div class="backdrop"></div>
|
|
11155
11149
|
<div class="container">
|
|
11156
11150
|
<button class="close-button" @click=${this.handleClose}>×</button>
|
|
11157
11151
|
|
|
@@ -11161,7 +11155,7 @@ class SessionStartModal extends i$1 {
|
|
|
11161
11155
|
<p class="subtitle">${this.session.description}</p>
|
|
11162
11156
|
</div>
|
|
11163
11157
|
|
|
11164
|
-
<button class="button button-primary" @click=${this.handleStart}>Continue
|
|
11158
|
+
<button class="button button-primary" @click=${this.handleStart}>Continue</button>
|
|
11165
11159
|
</div>
|
|
11166
11160
|
`;
|
|
11167
11161
|
}
|
|
@@ -11170,6 +11164,7 @@ SessionStartModal.styles = i$4`
|
|
|
11170
11164
|
:host {
|
|
11171
11165
|
display: block;
|
|
11172
11166
|
font-family: "Inter", sans-serif;
|
|
11167
|
+
box-sizing: border-box;
|
|
11173
11168
|
}
|
|
11174
11169
|
|
|
11175
11170
|
.backdrop {
|
|
@@ -11183,6 +11178,7 @@ SessionStartModal.styles = i$4`
|
|
|
11183
11178
|
}
|
|
11184
11179
|
|
|
11185
11180
|
.container {
|
|
11181
|
+
box-sizing: border-box;
|
|
11186
11182
|
position: fixed;
|
|
11187
11183
|
top: 50%;
|
|
11188
11184
|
left: 50%;
|
|
@@ -11192,8 +11188,8 @@ SessionStartModal.styles = i$4`
|
|
|
11192
11188
|
/* Layout from user specifications */
|
|
11193
11189
|
display: flex;
|
|
11194
11190
|
width: 640px;
|
|
11195
|
-
height: 380px;
|
|
11196
|
-
padding:
|
|
11191
|
+
min-height: 380px;
|
|
11192
|
+
padding: 32px;
|
|
11197
11193
|
flex-direction: column;
|
|
11198
11194
|
justify-content: space-between;
|
|
11199
11195
|
align-items: center;
|
|
@@ -11212,20 +11208,17 @@ SessionStartModal.styles = i$4`
|
|
|
11212
11208
|
flex-direction: column;
|
|
11213
11209
|
align-items: center;
|
|
11214
11210
|
text-align: center;
|
|
11215
|
-
gap: 16px;
|
|
11216
11211
|
}
|
|
11217
11212
|
|
|
11218
11213
|
.logo {
|
|
11219
11214
|
display: flex;
|
|
11220
11215
|
width: 96px;
|
|
11221
11216
|
height: 96px;
|
|
11222
|
-
padding: 8px;
|
|
11223
11217
|
justify-content: center;
|
|
11224
11218
|
align-items: center;
|
|
11225
|
-
gap: 8px;
|
|
11226
11219
|
aspect-ratio: 1/1;
|
|
11227
|
-
border-radius:
|
|
11228
|
-
background: var(--
|
|
11220
|
+
border-radius: 8px;
|
|
11221
|
+
background: var(--obi-primary, #a10fff);
|
|
11229
11222
|
box-shadow:
|
|
11230
11223
|
0px 0px 8px 0px rgba(168, 85, 247, 0.12),
|
|
11231
11224
|
0px 0px 8px 0px rgba(192, 132, 252, 0.24),
|
|
@@ -11243,32 +11236,36 @@ SessionStartModal.styles = i$4`
|
|
|
11243
11236
|
}
|
|
11244
11237
|
|
|
11245
11238
|
h1 {
|
|
11246
|
-
font-family: "
|
|
11239
|
+
font-family: "Satoshi", sans-serif;
|
|
11247
11240
|
font-size: 32px;
|
|
11248
11241
|
font-weight: 700;
|
|
11249
|
-
margin: 32px 0 0 0;
|
|
11250
11242
|
color: #111827;
|
|
11243
|
+
margin: 0;
|
|
11244
|
+
margin-top: 32px;
|
|
11245
|
+
margin-bottom: 16px;
|
|
11251
11246
|
}
|
|
11252
11247
|
|
|
11253
11248
|
.subtitle {
|
|
11249
|
+
font-family: "Satoshi", sans-serif;
|
|
11250
|
+
font-weight: 300;
|
|
11254
11251
|
font-size: 16px;
|
|
11255
|
-
color: #
|
|
11256
|
-
|
|
11257
|
-
|
|
11252
|
+
color: #18181b;
|
|
11253
|
+
line-height: 1.4;
|
|
11254
|
+
margin: 0;
|
|
11258
11255
|
}
|
|
11259
11256
|
|
|
11260
11257
|
.button {
|
|
11258
|
+
font-family: "Satoshi", sans-serif;
|
|
11259
|
+
font-weight: 400;
|
|
11260
|
+
font-size: 16px;
|
|
11261
11261
|
padding: 12px 24px;
|
|
11262
11262
|
border-radius: 8px;
|
|
11263
11263
|
border: none;
|
|
11264
|
-
font-size: 16px;
|
|
11265
|
-
font-weight: 500;
|
|
11266
11264
|
cursor: pointer;
|
|
11267
11265
|
transition: all 0.2s ease;
|
|
11268
11266
|
display: flex;
|
|
11269
11267
|
align-items: center;
|
|
11270
11268
|
justify-content: center;
|
|
11271
|
-
gap: 8px;
|
|
11272
11269
|
}
|
|
11273
11270
|
|
|
11274
11271
|
.button-primary {
|
|
@@ -11292,21 +11289,19 @@ SessionStartModal.styles = i$4`
|
|
|
11292
11289
|
|
|
11293
11290
|
.close-button {
|
|
11294
11291
|
position: absolute;
|
|
11295
|
-
top:
|
|
11292
|
+
top: 12px;
|
|
11296
11293
|
right: 16px;
|
|
11297
11294
|
background: none;
|
|
11298
11295
|
border: none;
|
|
11299
11296
|
cursor: pointer;
|
|
11300
11297
|
font-size: 24px;
|
|
11301
11298
|
color: #6b7280;
|
|
11302
|
-
padding:
|
|
11303
|
-
|
|
11304
|
-
|
|
11305
|
-
|
|
11306
|
-
|
|
11307
|
-
|
|
11308
|
-
color: #374151;
|
|
11309
|
-
background: #f3f4f6;
|
|
11299
|
+
padding: 0;
|
|
11300
|
+
margin: 0;
|
|
11301
|
+
line-height: 1;
|
|
11302
|
+
display: inline-flex;
|
|
11303
|
+
align-items: center;
|
|
11304
|
+
justify-content: center;
|
|
11310
11305
|
}
|
|
11311
11306
|
`;
|
|
11312
11307
|
__decorateClass$1([
|
|
@@ -11332,7 +11327,6 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
11332
11327
|
__defProp(target, key, result);
|
|
11333
11328
|
return result;
|
|
11334
11329
|
};
|
|
11335
|
-
const WIDGET_PARAMS_KEY = "io.obi.widget-parameters";
|
|
11336
11330
|
class ObiWidget extends i$1 {
|
|
11337
11331
|
constructor() {
|
|
11338
11332
|
super();
|
|
@@ -11384,6 +11378,7 @@ class ObiWidget extends i$1 {
|
|
|
11384
11378
|
name: sessionWithPlan.onboarding_plan?.name || "",
|
|
11385
11379
|
description: sessionWithPlan.onboarding_plan?.description || ""
|
|
11386
11380
|
};
|
|
11381
|
+
this.state = SDKState.LOADING;
|
|
11387
11382
|
this.showSessionStartModal = true;
|
|
11388
11383
|
} else {
|
|
11389
11384
|
console.log("No session found with token:", sessionToken);
|
|
@@ -11423,12 +11418,14 @@ class ObiWidget extends i$1 {
|
|
|
11423
11418
|
removeSessionUrlParams() {
|
|
11424
11419
|
const url = new URL(window.location.href);
|
|
11425
11420
|
url.searchParams.delete(SESSION_URL_PARAM);
|
|
11426
|
-
url.searchParams.delete(API_KEY_URL_PARAM);
|
|
11427
11421
|
window.history.replaceState({}, "", url.toString());
|
|
11428
11422
|
try {
|
|
11429
|
-
|
|
11423
|
+
if (window.__obiUrlParams) {
|
|
11424
|
+
;
|
|
11425
|
+
window.__obiUrlParams = null;
|
|
11426
|
+
}
|
|
11430
11427
|
} catch (error) {
|
|
11431
|
-
console.warn("Failed to
|
|
11428
|
+
console.warn("Failed to clean up window URL parameters:", error);
|
|
11432
11429
|
}
|
|
11433
11430
|
}
|
|
11434
11431
|
/**
|
|
@@ -11618,13 +11615,8 @@ class ObiWidget extends i$1 {
|
|
|
11618
11615
|
await this.checkExistingSession();
|
|
11619
11616
|
if (!this.activeSession) {
|
|
11620
11617
|
let storedParams = {};
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
if (storedParamsJson) {
|
|
11624
|
-
storedParams = JSON.parse(storedParamsJson);
|
|
11625
|
-
}
|
|
11626
|
-
} catch (error) {
|
|
11627
|
-
console.warn("Failed to parse stored widget parameters:", error);
|
|
11618
|
+
if (window.__obiUrlParams) {
|
|
11619
|
+
storedParams = window.__obiUrlParams;
|
|
11628
11620
|
}
|
|
11629
11621
|
if (Object.keys(storedParams).length === 0) {
|
|
11630
11622
|
const urlParams = new URLSearchParams(window.location.search);
|
|
@@ -11633,14 +11625,15 @@ class ObiWidget extends i$1 {
|
|
|
11633
11625
|
});
|
|
11634
11626
|
}
|
|
11635
11627
|
const sessionId = storedParams[SESSION_URL_PARAM];
|
|
11636
|
-
const urlApiKey = storedParams[API_KEY_URL_PARAM];
|
|
11637
|
-
if (urlApiKey) {
|
|
11638
|
-
this.apiKey = urlApiKey;
|
|
11639
|
-
} else if (!this.apiKey && window.obiWidgetConfig?.apiKey) {
|
|
11640
|
-
this.apiKey = window.obiWidgetConfig.apiKey;
|
|
11641
|
-
}
|
|
11642
11628
|
if (sessionId && this.apiKey) {
|
|
11643
11629
|
await this.handleUrlSessionEvent(sessionId);
|
|
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);
|
|
11644
11637
|
}
|
|
11645
11638
|
}
|
|
11646
11639
|
}
|
|
@@ -11651,7 +11644,17 @@ class ObiWidget extends i$1 {
|
|
|
11651
11644
|
this.boundSaveSessionData = this.saveSessionData.bind(this);
|
|
11652
11645
|
window.addEventListener("beforeunload", this.boundSaveSessionData);
|
|
11653
11646
|
window.addEventListener("pagehide", this.boundSaveSessionData);
|
|
11654
|
-
|
|
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
|
+
}
|
|
11655
11658
|
}
|
|
11656
11659
|
disconnectedCallback() {
|
|
11657
11660
|
if (this.closeNavTimeoutRef !== null) {
|
|
@@ -11766,6 +11769,8 @@ class ObiWidget extends i$1 {
|
|
|
11766
11769
|
.onClose=${() => {
|
|
11767
11770
|
this.showSessionStartModal = false;
|
|
11768
11771
|
this.selectedCourse = null;
|
|
11772
|
+
this.state = SDKState.READY;
|
|
11773
|
+
this.removeSessionUrlParams();
|
|
11769
11774
|
}}
|
|
11770
11775
|
></obi-session-start-modal>` : E}
|
|
11771
11776
|
`;
|
|
@@ -11963,4 +11968,4 @@ export {
|
|
|
11963
11968
|
searchingLoader as s,
|
|
11964
11969
|
x
|
|
11965
11970
|
};
|
|
11966
|
-
//# sourceMappingURL=obi-widget-
|
|
11971
|
+
//# sourceMappingURL=obi-widget-2ba751b3.js.map
|