obi-sdk 0.7.1 → 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-7e9394b1.js → obi-widget-d8d64ad7.js} +51 -6
- 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 +4042 -4005
- 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-6deeede6.js +0 -6
- package/dist/modular/chunks/index-6deeede6.js.map +0 -1
- package/dist/modular/chunks/obi-widget-7e9394b1.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) => {
|
|
@@ -17875,6 +17910,7 @@ class ObiWidget extends i$1 {
|
|
|
17875
17910
|
this.apiKey = "";
|
|
17876
17911
|
this.isActive = true;
|
|
17877
17912
|
this.linkOnlyAccess = false;
|
|
17913
|
+
this.urlBlacklist = [];
|
|
17878
17914
|
this.position = "bottom-right";
|
|
17879
17915
|
this.user = null;
|
|
17880
17916
|
this.state = SDKState.READY;
|
|
@@ -18175,11 +18211,14 @@ class ObiWidget extends i$1 {
|
|
|
18175
18211
|
this.apiKey = window.obiWidgetConfig.apiKey || this.apiKey;
|
|
18176
18212
|
this.position = window.obiWidgetConfig.position || this.position;
|
|
18177
18213
|
this.user = window.obiWidgetConfig.user || this.user;
|
|
18178
|
-
if (
|
|
18179
|
-
this.
|
|
18214
|
+
if (this.urlBlacklist.length === 0) {
|
|
18215
|
+
this.urlBlacklist = window.obiWidgetConfig.urlBlacklist || [];
|
|
18180
18216
|
}
|
|
18181
18217
|
if (window.obiWidgetConfig.linkOnlyAccess !== void 0) {
|
|
18182
|
-
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;
|
|
18183
18222
|
}
|
|
18184
18223
|
if (window.obiWidgetConfig.showMenu === true) {
|
|
18185
18224
|
this.state = SDKState.LOADING;
|
|
@@ -18348,7 +18387,7 @@ class ObiWidget extends i$1 {
|
|
|
18348
18387
|
window.addEventListener("beforeunload", this.boundSaveSessionData);
|
|
18349
18388
|
window.addEventListener("pagehide", this.boundSaveSessionData);
|
|
18350
18389
|
this.addEventListener("course-select", this.handleCourseSelectEvent);
|
|
18351
|
-
if (this.isActive) {
|
|
18390
|
+
if (this.isActive && !isCurrentUrlBlacklisted(this.urlBlacklist)) {
|
|
18352
18391
|
this.sessionConnectionCheck();
|
|
18353
18392
|
}
|
|
18354
18393
|
}
|
|
@@ -18376,7 +18415,7 @@ class ObiWidget extends i$1 {
|
|
|
18376
18415
|
if (this.position) {
|
|
18377
18416
|
this.setAttribute("position", this.position);
|
|
18378
18417
|
}
|
|
18379
|
-
if (needsInit) {
|
|
18418
|
+
if (needsInit && !isCurrentUrlBlacklisted(this.urlBlacklist)) {
|
|
18380
18419
|
this.sessionConnectionCheck();
|
|
18381
18420
|
}
|
|
18382
18421
|
this.requestUpdate();
|
|
@@ -18436,6 +18475,9 @@ class ObiWidget extends i$1 {
|
|
|
18436
18475
|
return E;
|
|
18437
18476
|
if (this.linkOnlyAccess && this.state === SDKState.READY)
|
|
18438
18477
|
return E;
|
|
18478
|
+
if (isCurrentUrlBlacklisted(this.urlBlacklist)) {
|
|
18479
|
+
return E;
|
|
18480
|
+
}
|
|
18439
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(
|
|
18440
18482
|
N$1.union(SDKState.USER_SPEAKING, SDKState.AGENT_SPEAKING),
|
|
18441
18483
|
() => x`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`
|
|
@@ -18648,6 +18690,9 @@ __decorateClass([
|
|
|
18648
18690
|
__decorateClass([
|
|
18649
18691
|
r$1()
|
|
18650
18692
|
], ObiWidget.prototype, "linkOnlyAccess", 2);
|
|
18693
|
+
__decorateClass([
|
|
18694
|
+
r$1()
|
|
18695
|
+
], ObiWidget.prototype, "urlBlacklist", 2);
|
|
18651
18696
|
__decorateClass([
|
|
18652
18697
|
r$1()
|
|
18653
18698
|
], ObiWidget.prototype, "position", 2);
|
|
@@ -18711,4 +18756,4 @@ export {
|
|
|
18711
18756
|
withSentryAsyncHandler as w,
|
|
18712
18757
|
x
|
|
18713
18758
|
};
|
|
18714
|
-
//# sourceMappingURL=obi-widget-
|
|
18759
|
+
//# sourceMappingURL=obi-widget-d8d64ad7.js.map
|