obi-sdk 0.7.0 → 0.9.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.
- package/dist/loader.d.ts +1 -0
- package/dist/modular/chunks/index-e3a03e58.js +6 -0
- package/dist/modular/chunks/index-e3a03e58.js.map +1 -0
- package/dist/modular/chunks/{obi-widget-6550377d.js → obi-widget-d8d64ad7.js} +52 -11
- package/dist/modular/chunks/obi-widget-d8d64ad7.js.map +1 -0
- package/dist/modular/index.js +1 -1
- package/dist/modular/ui.js +10 -10
- package/dist/obi-sdk.standalone.iife.js +31 -31
- package/dist/obi-sdk.standalone.iife.js.map +1 -1
- package/dist/react.es.js +4043 -4010
- package/dist/react.es.js.map +1 -1
- package/dist/react.umd.js +47 -47
- package/dist/react.umd.js.map +1 -1
- package/dist/ui/components/obi-widget/obi-widget.d.ts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/url-matcher.d.ts +16 -0
- package/package.json +4 -4
- package/dist/modular/chunks/index-f31a59cc.js +0 -6
- package/dist/modular/chunks/index-f31a59cc.js.map +0 -1
- package/dist/modular/chunks/obi-widget-6550377d.js.map +0 -1
package/dist/loader.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-e3a03e58.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -450,6 +450,11 @@ class ObiClient {
|
|
|
450
450
|
async listOnboardees() {
|
|
451
451
|
return await this.client.GET("/onboardees");
|
|
452
452
|
}
|
|
453
|
+
async getOnboardee(id) {
|
|
454
|
+
return await this.client.GET("/onboardees/{id}", {
|
|
455
|
+
params: { path: { id } }
|
|
456
|
+
});
|
|
457
|
+
}
|
|
453
458
|
async getOnboardeeWhitelistedDomains(id) {
|
|
454
459
|
return await this.client.GET("/onboardees/{id}/whitelisted-domains", {
|
|
455
460
|
params: { path: { id } }
|
|
@@ -459,6 +464,10 @@ class ObiClient {
|
|
|
459
464
|
async listPlans() {
|
|
460
465
|
return await this.client.GET("/plans");
|
|
461
466
|
}
|
|
467
|
+
// Products
|
|
468
|
+
async listProducts() {
|
|
469
|
+
return await this.client.GET("/products");
|
|
470
|
+
}
|
|
462
471
|
async createPlan(data) {
|
|
463
472
|
return await this.client.POST("/plans", {
|
|
464
473
|
body: data
|
|
@@ -16024,6 +16033,32 @@ const STORAGE_KEYS = {
|
|
|
16024
16033
|
SESSION_DATA: "session_data"
|
|
16025
16034
|
};
|
|
16026
16035
|
const storage = new StorageManager("io.obi.widget");
|
|
16036
|
+
function globToRegex(pattern) {
|
|
16037
|
+
let regex = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "__DOUBLE_STAR__").replace(/\*/g, "[^/]*").replace(/__DOUBLE_STAR__/g, ".*").replace(/\?/g, "[^/]");
|
|
16038
|
+
return new RegExp(`^${regex}$`, "i");
|
|
16039
|
+
}
|
|
16040
|
+
function matchesUrlPattern(url, patterns) {
|
|
16041
|
+
if (!patterns || patterns.length === 0) {
|
|
16042
|
+
return false;
|
|
16043
|
+
}
|
|
16044
|
+
const normalizedUrl = url.replace(/^https?:\/\//, "").replace(/\/$/, "");
|
|
16045
|
+
return patterns.some((pattern) => {
|
|
16046
|
+
try {
|
|
16047
|
+
const regex = globToRegex(pattern);
|
|
16048
|
+
return regex.test(normalizedUrl) || regex.test(url);
|
|
16049
|
+
} catch (error) {
|
|
16050
|
+
console.warn(`Invalid URL pattern: ${pattern}`, error);
|
|
16051
|
+
return false;
|
|
16052
|
+
}
|
|
16053
|
+
});
|
|
16054
|
+
}
|
|
16055
|
+
function isCurrentUrlBlacklisted(blacklist) {
|
|
16056
|
+
if (!blacklist || blacklist.length === 0) {
|
|
16057
|
+
return false;
|
|
16058
|
+
}
|
|
16059
|
+
const currentUrl = window.location.href;
|
|
16060
|
+
return matchesUrlPattern(currentUrl, blacklist);
|
|
16061
|
+
}
|
|
16027
16062
|
var __defProp$7 = Object.defineProperty;
|
|
16028
16063
|
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
16029
16064
|
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
@@ -16600,11 +16635,7 @@ class CourseModal extends i$1 {
|
|
|
16600
16635
|
apiKey: this.apiKey ? "present" : "missing"
|
|
16601
16636
|
});
|
|
16602
16637
|
const raw_response = await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`, {
|
|
16603
|
-
cache: "no-cache"
|
|
16604
|
-
headers: {
|
|
16605
|
-
"Cache-Control": "no-cache, no-store, must-revalidate",
|
|
16606
|
-
Pragma: "no-cache"
|
|
16607
|
-
}
|
|
16638
|
+
cache: "no-cache"
|
|
16608
16639
|
});
|
|
16609
16640
|
if (!raw_response.ok) {
|
|
16610
16641
|
throw new Error(`HTTP ${raw_response.status}: ${raw_response.statusText}`);
|
|
@@ -17879,6 +17910,7 @@ class ObiWidget extends i$1 {
|
|
|
17879
17910
|
this.apiKey = "";
|
|
17880
17911
|
this.isActive = true;
|
|
17881
17912
|
this.linkOnlyAccess = false;
|
|
17913
|
+
this.urlBlacklist = [];
|
|
17882
17914
|
this.position = "bottom-right";
|
|
17883
17915
|
this.user = null;
|
|
17884
17916
|
this.state = SDKState.READY;
|
|
@@ -18179,11 +18211,14 @@ class ObiWidget extends i$1 {
|
|
|
18179
18211
|
this.apiKey = window.obiWidgetConfig.apiKey || this.apiKey;
|
|
18180
18212
|
this.position = window.obiWidgetConfig.position || this.position;
|
|
18181
18213
|
this.user = window.obiWidgetConfig.user || this.user;
|
|
18182
|
-
if (
|
|
18183
|
-
this.
|
|
18214
|
+
if (this.urlBlacklist.length === 0) {
|
|
18215
|
+
this.urlBlacklist = window.obiWidgetConfig.urlBlacklist || [];
|
|
18184
18216
|
}
|
|
18185
18217
|
if (window.obiWidgetConfig.linkOnlyAccess !== void 0) {
|
|
18186
|
-
this.linkOnlyAccess = window.obiWidgetConfig.linkOnlyAccess;
|
|
18218
|
+
this.linkOnlyAccess = window.obiWidgetConfig.linkOnlyAccess || false;
|
|
18219
|
+
}
|
|
18220
|
+
if (window.obiWidgetConfig.isActive !== void 0) {
|
|
18221
|
+
this.isActive = window.obiWidgetConfig.isActive;
|
|
18187
18222
|
}
|
|
18188
18223
|
if (window.obiWidgetConfig.showMenu === true) {
|
|
18189
18224
|
this.state = SDKState.LOADING;
|
|
@@ -18352,7 +18387,7 @@ class ObiWidget extends i$1 {
|
|
|
18352
18387
|
window.addEventListener("beforeunload", this.boundSaveSessionData);
|
|
18353
18388
|
window.addEventListener("pagehide", this.boundSaveSessionData);
|
|
18354
18389
|
this.addEventListener("course-select", this.handleCourseSelectEvent);
|
|
18355
|
-
if (this.isActive) {
|
|
18390
|
+
if (this.isActive && !isCurrentUrlBlacklisted(this.urlBlacklist)) {
|
|
18356
18391
|
this.sessionConnectionCheck();
|
|
18357
18392
|
}
|
|
18358
18393
|
}
|
|
@@ -18380,7 +18415,7 @@ class ObiWidget extends i$1 {
|
|
|
18380
18415
|
if (this.position) {
|
|
18381
18416
|
this.setAttribute("position", this.position);
|
|
18382
18417
|
}
|
|
18383
|
-
if (needsInit) {
|
|
18418
|
+
if (needsInit && !isCurrentUrlBlacklisted(this.urlBlacklist)) {
|
|
18384
18419
|
this.sessionConnectionCheck();
|
|
18385
18420
|
}
|
|
18386
18421
|
this.requestUpdate();
|
|
@@ -18440,6 +18475,9 @@ class ObiWidget extends i$1 {
|
|
|
18440
18475
|
return E;
|
|
18441
18476
|
if (this.linkOnlyAccess && this.state === SDKState.READY)
|
|
18442
18477
|
return E;
|
|
18478
|
+
if (isCurrentUrlBlacklisted(this.urlBlacklist)) {
|
|
18479
|
+
return E;
|
|
18480
|
+
}
|
|
18443
18481
|
const stateRender = z$2(this.state).with(SDKState.LOADING, () => x`<obi-dot-loader></obi-dot-loader>`).with(SDKState.RESEARCHING, () => x`<obi-searching-loader></obi-searching-loader>`).with(
|
|
18444
18482
|
N$1.union(SDKState.USER_SPEAKING, SDKState.AGENT_SPEAKING),
|
|
18445
18483
|
() => x`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`
|
|
@@ -18652,6 +18690,9 @@ __decorateClass([
|
|
|
18652
18690
|
__decorateClass([
|
|
18653
18691
|
r$1()
|
|
18654
18692
|
], ObiWidget.prototype, "linkOnlyAccess", 2);
|
|
18693
|
+
__decorateClass([
|
|
18694
|
+
r$1()
|
|
18695
|
+
], ObiWidget.prototype, "urlBlacklist", 2);
|
|
18655
18696
|
__decorateClass([
|
|
18656
18697
|
r$1()
|
|
18657
18698
|
], ObiWidget.prototype, "position", 2);
|
|
@@ -18715,4 +18756,4 @@ export {
|
|
|
18715
18756
|
withSentryAsyncHandler as w,
|
|
18716
18757
|
x
|
|
18717
18758
|
};
|
|
18718
|
-
//# sourceMappingURL=obi-widget-
|
|
18759
|
+
//# sourceMappingURL=obi-widget-d8d64ad7.js.map
|