@tellyouai/plugin 0.1.6 → 0.1.8
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/README.md +24 -0
- package/dist/package/index.js +366 -360
- package/dist/package/public.d.ts +13 -5
- package/package.json +2 -1
package/dist/package/index.js
CHANGED
|
@@ -22308,14 +22308,11 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22308
22308
|
}, Nt = (e) => document.querySelector(e)?.textContent?.replace(/\s+/g, " ").trim() || void 0, Pt = () => {
|
|
22309
22309
|
let e = At();
|
|
22310
22310
|
return document.body.classList.contains("woocommerce") || document.body.classList.contains("woocommerce-page") || e.wc_add_to_cart_params || e.wc_cart_fragments_params ? "woocommerce" : e.Shopify || e.ShopifyAnalytics ? "shopify" : e.BCData || Mt(/BigCommerce/i) ? "bigcommerce" : e.checkoutConfig || document.querySelector("script[src*=\"/static/version\"]") || document.querySelector("body[data-container='body'] [data-mage-init]") ? "magento" : e.Squarespace || e.Static?.SQUARESPACE_CONTEXT ? "squarespace" : e.wixBiSession || e.Wix || Mt(/Wix\.com/i) ? "wix" : e.wp || e.wpApiSettings || Mt(/WordPress/i) ? "wordpress" : "unknown";
|
|
22311
|
-
}, Ft = (e) => {
|
|
22312
|
-
|
|
22313
|
-
|
|
22314
|
-
|
|
22315
|
-
|
|
22316
|
-
description: t?.description || ""
|
|
22317
|
-
}));
|
|
22318
|
-
}, It = (e) => {
|
|
22311
|
+
}, Ft = (e, t = []) => ({
|
|
22312
|
+
type: "object",
|
|
22313
|
+
properties: e,
|
|
22314
|
+
required: t
|
|
22315
|
+
}), It = (e) => {
|
|
22319
22316
|
let t = new URL(e, window.location.origin);
|
|
22320
22317
|
if (t.protocol !== "http:" && t.protocol !== "https:") throw Error("Unsupported URL scheme");
|
|
22321
22318
|
if (t.origin !== window.location.origin) throw Error("Refusing to navigate off-site");
|
|
@@ -22323,11 +22320,10 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22323
22320
|
}, Lt = () => ({
|
|
22324
22321
|
"navigate-to": {
|
|
22325
22322
|
description: "Navigate the user to a page on this site. Accepts a relative path (e.g. /about, /contact) or a full same-origin URL.",
|
|
22326
|
-
|
|
22327
|
-
name: "path",
|
|
22323
|
+
inputSchema: Ft({ path: {
|
|
22328
22324
|
type: "string",
|
|
22329
22325
|
description: "Destination path or same-origin URL to navigate the user to."
|
|
22330
|
-
}],
|
|
22326
|
+
} }, ["path"]),
|
|
22331
22327
|
execute: async ({ path: e }) => {
|
|
22332
22328
|
let t = String(e || "").trim();
|
|
22333
22329
|
if (!t) throw Error("No destination provided");
|
|
@@ -22340,13 +22336,13 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22340
22336
|
},
|
|
22341
22337
|
"go-back": {
|
|
22342
22338
|
description: "Navigate the user back to the previous page.",
|
|
22343
|
-
|
|
22339
|
+
inputSchema: Ft({}),
|
|
22344
22340
|
execute: async () => (window.history.back(), { success: !0 })
|
|
22345
22341
|
}
|
|
22346
22342
|
}), Rt = () => ({
|
|
22347
22343
|
"get-page-content": {
|
|
22348
22344
|
description: "Get the main text content of the page the user is currently viewing, so it can be summarised or answered from directly in the chat.",
|
|
22349
|
-
|
|
22345
|
+
inputSchema: Ft({}),
|
|
22350
22346
|
execute: async () => {
|
|
22351
22347
|
let e = ((document.querySelector("main, article, [role='main'], #content, .entry-content") || document.body).textContent || "").replace(/\s+/g, " ").trim().slice(0, 8e3);
|
|
22352
22348
|
return {
|
|
@@ -22358,11 +22354,10 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22358
22354
|
},
|
|
22359
22355
|
"scroll-to": {
|
|
22360
22356
|
description: "Scroll the current page to the first heading or section whose text matches the given query, and briefly highlight it.",
|
|
22361
|
-
|
|
22362
|
-
name: "query",
|
|
22357
|
+
inputSchema: Ft({ query: {
|
|
22363
22358
|
type: "string",
|
|
22364
22359
|
description: "Text to find on the page and scroll to."
|
|
22365
|
-
}],
|
|
22360
|
+
} }, ["query"]),
|
|
22366
22361
|
execute: async ({ query: e }) => {
|
|
22367
22362
|
let t = String(e || "").trim().toLowerCase();
|
|
22368
22363
|
if (!t) throw Error("No text to scroll to");
|
|
@@ -22407,15 +22402,16 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22407
22402
|
}), Vt = () => ({
|
|
22408
22403
|
"get-post": {
|
|
22409
22404
|
description: "Fetch the full content of a WordPress post or page by its ID or slug, so it can be answered from directly in the chat.",
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
|
|
22413
|
-
|
|
22414
|
-
|
|
22415
|
-
|
|
22416
|
-
|
|
22417
|
-
|
|
22418
|
-
|
|
22405
|
+
inputSchema: Ft({
|
|
22406
|
+
id: {
|
|
22407
|
+
type: "string",
|
|
22408
|
+
description: "The post/page ID. Provide this or slug."
|
|
22409
|
+
},
|
|
22410
|
+
slug: {
|
|
22411
|
+
type: "string",
|
|
22412
|
+
description: "The post/page slug. Provide this or id."
|
|
22413
|
+
}
|
|
22414
|
+
}),
|
|
22419
22415
|
execute: async ({ id: e, slug: t }) => {
|
|
22420
22416
|
let n = String(e || "").trim(), r = String(t || "").trim();
|
|
22421
22417
|
if (!n && !r) throw Error("Provide a post id or slug");
|
|
@@ -22439,11 +22435,10 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22439
22435
|
},
|
|
22440
22436
|
"list-recent-posts": {
|
|
22441
22437
|
description: "List the most recent posts on this WordPress site (title + link).",
|
|
22442
|
-
|
|
22443
|
-
name: "limit",
|
|
22438
|
+
inputSchema: Ft({ limit: {
|
|
22444
22439
|
type: "number",
|
|
22445
22440
|
description: "How many posts to return. Defaults to 5."
|
|
22446
|
-
}
|
|
22441
|
+
} }),
|
|
22447
22442
|
execute: async ({ limit: e }) => {
|
|
22448
22443
|
let t = Math.min(Math.max(Number(e) || 5, 1), 20), n = await fetch(`/wp-json/wp/v2/posts?per_page=${t}&orderby=date&_fields=id,title,link,date`, {
|
|
22449
22444
|
headers: { Accept: "application/json" },
|
|
@@ -22464,7 +22459,7 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22464
22459
|
},
|
|
22465
22460
|
"get-site-info": {
|
|
22466
22461
|
description: "Get basic information about this WordPress site (name, description, home URL).",
|
|
22467
|
-
|
|
22462
|
+
inputSchema: Ft({}),
|
|
22468
22463
|
execute: async () => {
|
|
22469
22464
|
let e = await fetch("/wp-json", {
|
|
22470
22465
|
headers: { Accept: "application/json" },
|
|
@@ -22482,15 +22477,16 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22482
22477
|
}), Ht = () => ({
|
|
22483
22478
|
"search-site": {
|
|
22484
22479
|
description: "Search this WordPress site's posts and pages and return the matching results (title + link) so they can be shown directly in the chat.",
|
|
22485
|
-
|
|
22486
|
-
|
|
22487
|
-
|
|
22488
|
-
|
|
22489
|
-
|
|
22490
|
-
|
|
22491
|
-
|
|
22492
|
-
|
|
22493
|
-
|
|
22480
|
+
inputSchema: Ft({
|
|
22481
|
+
query: {
|
|
22482
|
+
type: "string",
|
|
22483
|
+
description: "The search terms."
|
|
22484
|
+
},
|
|
22485
|
+
limit: {
|
|
22486
|
+
type: "number",
|
|
22487
|
+
description: "Maximum number of results to return. Defaults to 5."
|
|
22488
|
+
}
|
|
22489
|
+
}, ["query"]),
|
|
22494
22490
|
execute: async ({ query: e, limit: t }) => {
|
|
22495
22491
|
let n = String(e || "").trim();
|
|
22496
22492
|
if (!n) throw Error("No search query provided");
|
|
@@ -22513,11 +22509,10 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22513
22509
|
},
|
|
22514
22510
|
"open-search-results": {
|
|
22515
22511
|
description: "Open the site's search results page for the given query in the browser.",
|
|
22516
|
-
|
|
22517
|
-
name: "query",
|
|
22512
|
+
inputSchema: Ft({ query: {
|
|
22518
22513
|
type: "string",
|
|
22519
22514
|
description: "The search terms."
|
|
22520
|
-
}],
|
|
22515
|
+
} }, ["query"]),
|
|
22521
22516
|
execute: async ({ query: e }) => {
|
|
22522
22517
|
let t = String(e || "").trim();
|
|
22523
22518
|
if (!t) throw Error("No search query provided");
|
|
@@ -22548,15 +22543,16 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22548
22543
|
...Vt(),
|
|
22549
22544
|
"search-products": {
|
|
22550
22545
|
description: "Search this store's products and return the matches (name, price, link) so they can be shown directly in the chat.",
|
|
22551
|
-
|
|
22552
|
-
|
|
22553
|
-
|
|
22554
|
-
|
|
22555
|
-
|
|
22556
|
-
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22546
|
+
inputSchema: Ft({
|
|
22547
|
+
query: {
|
|
22548
|
+
type: "string",
|
|
22549
|
+
description: "The product search terms."
|
|
22550
|
+
},
|
|
22551
|
+
limit: {
|
|
22552
|
+
type: "number",
|
|
22553
|
+
description: "Maximum number of results to return. Defaults to 5."
|
|
22554
|
+
}
|
|
22555
|
+
}, ["query"]),
|
|
22560
22556
|
execute: async ({ query: e, limit: t }) => {
|
|
22561
22557
|
let n = String(e || "").trim();
|
|
22562
22558
|
if (!n) throw Error("No search query provided");
|
|
@@ -22581,11 +22577,10 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22581
22577
|
},
|
|
22582
22578
|
"get-product-details": {
|
|
22583
22579
|
description: "Get full details for a product (description, price, stock, variations). Defaults to the product the user is currently viewing.",
|
|
22584
|
-
|
|
22585
|
-
name: "productId",
|
|
22580
|
+
inputSchema: Ft({ productId: {
|
|
22586
22581
|
type: "string",
|
|
22587
22582
|
description: "WooCommerce product ID. Omit to use the current product."
|
|
22588
|
-
}
|
|
22583
|
+
} }),
|
|
22589
22584
|
execute: async ({ productId: t }) => {
|
|
22590
22585
|
let n = String(t || e?.productId || "").trim();
|
|
22591
22586
|
if (!n) throw Error("No product specified");
|
|
@@ -22607,7 +22602,7 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22607
22602
|
},
|
|
22608
22603
|
"view-cart": {
|
|
22609
22604
|
description: "Read the current shopping cart and return its items and total so they can be shown in the chat.",
|
|
22610
|
-
|
|
22605
|
+
inputSchema: Ft({}),
|
|
22611
22606
|
execute: async () => {
|
|
22612
22607
|
let e = await fetch("/wp-json/wc/store/v1/cart", {
|
|
22613
22608
|
headers: { Accept: "application/json" },
|
|
@@ -22630,15 +22625,16 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22630
22625
|
},
|
|
22631
22626
|
"update-cart-quantity": {
|
|
22632
22627
|
description: "Change the quantity of a product already in the cart. Defaults to the product the user is currently viewing.",
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
|
|
22637
|
-
|
|
22638
|
-
|
|
22639
|
-
|
|
22640
|
-
|
|
22641
|
-
|
|
22628
|
+
inputSchema: Ft({
|
|
22629
|
+
productId: {
|
|
22630
|
+
type: "string",
|
|
22631
|
+
description: "WooCommerce product ID. Omit to use the current product."
|
|
22632
|
+
},
|
|
22633
|
+
quantity: {
|
|
22634
|
+
type: "number",
|
|
22635
|
+
description: "The new quantity (use 0 to remove)."
|
|
22636
|
+
}
|
|
22637
|
+
}, ["quantity"]),
|
|
22642
22638
|
execute: async ({ productId: t, quantity: r }) => {
|
|
22643
22639
|
let i = String(t || e?.productId || "").trim();
|
|
22644
22640
|
if (!i) throw Error("No product specified");
|
|
@@ -22668,11 +22664,10 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22668
22664
|
},
|
|
22669
22665
|
"apply-coupon": {
|
|
22670
22666
|
description: "Apply a discount coupon code to the cart.",
|
|
22671
|
-
|
|
22672
|
-
name: "code",
|
|
22667
|
+
inputSchema: Ft({ code: {
|
|
22673
22668
|
type: "string",
|
|
22674
22669
|
description: "The coupon code to apply."
|
|
22675
|
-
}],
|
|
22670
|
+
} }, ["code"]),
|
|
22676
22671
|
execute: async ({ code: e }) => {
|
|
22677
22672
|
let t = String(e || "").trim();
|
|
22678
22673
|
if (!t) throw Error("No coupon code provided");
|
|
@@ -22694,15 +22689,16 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22694
22689
|
},
|
|
22695
22690
|
"add-to-cart": {
|
|
22696
22691
|
description: "Add a product to the shopping cart. Defaults to the product the user is currently viewing if no productId is given.",
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22692
|
+
inputSchema: Ft({
|
|
22693
|
+
productId: {
|
|
22694
|
+
type: "string",
|
|
22695
|
+
description: "WooCommerce product ID. Omit to use the current product."
|
|
22696
|
+
},
|
|
22697
|
+
quantity: {
|
|
22698
|
+
type: "number",
|
|
22699
|
+
description: "Quantity to add. Defaults to 1."
|
|
22700
|
+
}
|
|
22701
|
+
}),
|
|
22706
22702
|
execute: async ({ productId: t, quantity: r }) => {
|
|
22707
22703
|
let i = String(t || e?.productId || "").trim();
|
|
22708
22704
|
if (!i) throw Error("No product to add to cart");
|
|
@@ -22725,11 +22721,10 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22725
22721
|
},
|
|
22726
22722
|
"remove-from-cart": {
|
|
22727
22723
|
description: "Remove a product from the shopping cart. Defaults to the product the user is currently viewing if no productId is given.",
|
|
22728
|
-
|
|
22729
|
-
name: "productId",
|
|
22724
|
+
inputSchema: Ft({ productId: {
|
|
22730
22725
|
type: "string",
|
|
22731
22726
|
description: "WooCommerce product ID to remove. Omit to use the current product."
|
|
22732
|
-
}
|
|
22727
|
+
} }),
|
|
22733
22728
|
execute: async ({ productId: t }) => {
|
|
22734
22729
|
let r = String(t || e?.productId || "").trim();
|
|
22735
22730
|
if (!r) throw Error("No product to remove from cart");
|
|
@@ -22760,7 +22755,7 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22760
22755
|
},
|
|
22761
22756
|
"go-to-checkout": {
|
|
22762
22757
|
description: "Navigate the user to the checkout page.",
|
|
22763
|
-
|
|
22758
|
+
inputSchema: Ft({}),
|
|
22764
22759
|
execute: async () => (window.location.assign("/checkout/"), { success: !0 })
|
|
22765
22760
|
}
|
|
22766
22761
|
}
|
|
@@ -22776,15 +22771,16 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22776
22771
|
clientTools: {
|
|
22777
22772
|
"search-products": {
|
|
22778
22773
|
description: "Search this store's products and return the matches (title, price, link) so they can be shown directly in the chat.",
|
|
22779
|
-
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
|
|
22785
|
-
|
|
22786
|
-
|
|
22787
|
-
|
|
22774
|
+
inputSchema: Ft({
|
|
22775
|
+
query: {
|
|
22776
|
+
type: "string",
|
|
22777
|
+
description: "The product search terms."
|
|
22778
|
+
},
|
|
22779
|
+
limit: {
|
|
22780
|
+
type: "number",
|
|
22781
|
+
description: "Maximum number of results to return. Defaults to 5."
|
|
22782
|
+
}
|
|
22783
|
+
}, ["query"]),
|
|
22788
22784
|
execute: async ({ query: e, limit: t }) => {
|
|
22789
22785
|
let n = String(e || "").trim();
|
|
22790
22786
|
if (!n) throw Error("No search query provided");
|
|
@@ -22808,7 +22804,7 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22808
22804
|
},
|
|
22809
22805
|
"view-cart": {
|
|
22810
22806
|
description: "Read the current cart and return its items and total so they can be shown in the chat.",
|
|
22811
|
-
|
|
22807
|
+
inputSchema: Ft({}),
|
|
22812
22808
|
execute: async () => {
|
|
22813
22809
|
let e = await fetch("/cart.js", {
|
|
22814
22810
|
headers: { Accept: "application/json" },
|
|
@@ -22831,15 +22827,16 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22831
22827
|
},
|
|
22832
22828
|
"add-to-cart": {
|
|
22833
22829
|
description: "Add a product variant to the cart. Defaults to the variant of the product the user is currently viewing.",
|
|
22834
|
-
|
|
22835
|
-
|
|
22836
|
-
|
|
22837
|
-
|
|
22838
|
-
|
|
22839
|
-
|
|
22840
|
-
|
|
22841
|
-
|
|
22842
|
-
|
|
22830
|
+
inputSchema: Ft({
|
|
22831
|
+
variantId: {
|
|
22832
|
+
type: "string",
|
|
22833
|
+
description: "Shopify variant ID. Omit to use the current variant."
|
|
22834
|
+
},
|
|
22835
|
+
quantity: {
|
|
22836
|
+
type: "number",
|
|
22837
|
+
description: "Quantity to add. Defaults to 1."
|
|
22838
|
+
}
|
|
22839
|
+
}),
|
|
22843
22840
|
execute: async ({ variantId: e, quantity: t }) => {
|
|
22844
22841
|
let r = String(e || n || "").trim();
|
|
22845
22842
|
if (!r) throw Error("No variant to add to cart");
|
|
@@ -22858,15 +22855,16 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22858
22855
|
},
|
|
22859
22856
|
"update-cart-quantity": {
|
|
22860
22857
|
description: "Change the quantity of a variant already in the cart. Defaults to the current variant. Use 0 to remove it.",
|
|
22861
|
-
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
|
|
22868
|
-
|
|
22869
|
-
|
|
22858
|
+
inputSchema: Ft({
|
|
22859
|
+
variantId: {
|
|
22860
|
+
type: "string",
|
|
22861
|
+
description: "Shopify variant ID. Omit to use the current variant."
|
|
22862
|
+
},
|
|
22863
|
+
quantity: {
|
|
22864
|
+
type: "number",
|
|
22865
|
+
description: "The new quantity (use 0 to remove)."
|
|
22866
|
+
}
|
|
22867
|
+
}, ["quantity"]),
|
|
22870
22868
|
execute: async ({ variantId: e, quantity: t }) => {
|
|
22871
22869
|
let r = String(e || n || "").trim();
|
|
22872
22870
|
if (!r) throw Error("No variant specified");
|
|
@@ -22885,11 +22883,10 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22885
22883
|
},
|
|
22886
22884
|
"remove-from-cart": {
|
|
22887
22885
|
description: "Remove a product variant from the cart. Defaults to the variant of the product the user is currently viewing.",
|
|
22888
|
-
|
|
22889
|
-
name: "variantId",
|
|
22886
|
+
inputSchema: Ft({ variantId: {
|
|
22890
22887
|
type: "string",
|
|
22891
22888
|
description: "Shopify variant ID to remove. Omit to use the current variant."
|
|
22892
|
-
}
|
|
22889
|
+
} }),
|
|
22893
22890
|
execute: async ({ variantId: e }) => {
|
|
22894
22891
|
let t = String(e || n || "").trim();
|
|
22895
22892
|
if (!t) throw Error("No variant to remove from cart");
|
|
@@ -22908,7 +22905,7 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22908
22905
|
},
|
|
22909
22906
|
"go-to-checkout": {
|
|
22910
22907
|
description: "Navigate the user to the checkout page.",
|
|
22911
|
-
|
|
22908
|
+
inputSchema: Ft({}),
|
|
22912
22909
|
execute: async () => (window.location.assign("/checkout"), { success: !0 })
|
|
22913
22910
|
}
|
|
22914
22911
|
}
|
|
@@ -22925,15 +22922,16 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22925
22922
|
clientTools: {
|
|
22926
22923
|
"add-to-cart": {
|
|
22927
22924
|
description: "Add a product to the cart. Defaults to the product the user is currently viewing.",
|
|
22928
|
-
|
|
22929
|
-
|
|
22930
|
-
|
|
22931
|
-
|
|
22932
|
-
|
|
22933
|
-
|
|
22934
|
-
|
|
22935
|
-
|
|
22936
|
-
|
|
22925
|
+
inputSchema: Ft({
|
|
22926
|
+
productId: {
|
|
22927
|
+
type: "string",
|
|
22928
|
+
description: "BigCommerce product ID. Omit to use the current product."
|
|
22929
|
+
},
|
|
22930
|
+
quantity: {
|
|
22931
|
+
type: "number",
|
|
22932
|
+
description: "Quantity to add. Defaults to 1."
|
|
22933
|
+
}
|
|
22934
|
+
}),
|
|
22937
22935
|
execute: async ({ productId: t, quantity: n }) => {
|
|
22938
22936
|
let r = String(t || e || "").trim();
|
|
22939
22937
|
if (!r) throw Error("No product to add to cart");
|
|
@@ -22952,7 +22950,7 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22952
22950
|
},
|
|
22953
22951
|
"go-to-checkout": {
|
|
22954
22952
|
description: "Navigate the user to the checkout page.",
|
|
22955
|
-
|
|
22953
|
+
inputSchema: Ft({}),
|
|
22956
22954
|
execute: async () => (window.location.assign("/checkout"), { success: !0 })
|
|
22957
22955
|
}
|
|
22958
22956
|
}
|
|
@@ -22968,7 +22966,7 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22968
22966
|
context: e,
|
|
22969
22967
|
clientTools: { "go-to-checkout": {
|
|
22970
22968
|
description: "Navigate the user to the checkout page.",
|
|
22971
|
-
|
|
22969
|
+
inputSchema: Ft({}),
|
|
22972
22970
|
execute: async () => (window.location.assign("/checkout"), { success: !0 })
|
|
22973
22971
|
} }
|
|
22974
22972
|
};
|
|
@@ -22990,22 +22988,20 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
22990
22988
|
pageUrl: window.location.href
|
|
22991
22989
|
},
|
|
22992
22990
|
clientTools: {}
|
|
22993
|
-
}), Xt = () => {
|
|
22994
|
-
let
|
|
22995
|
-
if (!
|
|
22996
|
-
let t = [];
|
|
22991
|
+
}), Xt = async (e = !0) => {
|
|
22992
|
+
let t = document.modelContext;
|
|
22993
|
+
if (!t || typeof t.getTools != "function") return {};
|
|
22997
22994
|
try {
|
|
22998
|
-
|
|
22995
|
+
let n = await t.getTools(), r = Object.create(null);
|
|
22996
|
+
for (let i of n) i && typeof i.name == "string" && (e !== "readonly" || i.annotations?.readOnlyHint === !0) && (r[i.name] = {
|
|
22997
|
+
description: i.description || i.name,
|
|
22998
|
+
inputSchema: i.inputSchema && typeof i.inputSchema == "object" ? i.inputSchema : Ft({}),
|
|
22999
|
+
execute: async (e) => JSON.parse(await t.executeTool(i, e))
|
|
23000
|
+
});
|
|
23001
|
+
return r;
|
|
22999
23002
|
} catch (e) {
|
|
23000
|
-
return console.warn("modelContext tool
|
|
23003
|
+
return console.warn("modelContext tool discovery failed", e), {};
|
|
23001
23004
|
}
|
|
23002
|
-
let n = {};
|
|
23003
|
-
for (let e of t) e && typeof e.name == "string" && typeof e.execute == "function" && (n[e.name] = {
|
|
23004
|
-
description: e.description || e.name,
|
|
23005
|
-
parameters: Ft(e.inputSchema || e.parameters),
|
|
23006
|
-
execute: (t) => e.execute(t)
|
|
23007
|
-
});
|
|
23008
|
-
return n;
|
|
23009
23005
|
}, Zt = (e) => {
|
|
23010
23006
|
switch (e) {
|
|
23011
23007
|
case "woocommerce": return Wt();
|
|
@@ -23017,24 +23013,23 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
23017
23013
|
case "wordpress": return Bt();
|
|
23018
23014
|
default: return {};
|
|
23019
23015
|
}
|
|
23020
|
-
}, Qt = (e = !0) => {
|
|
23021
|
-
let t = Pt(), n = Zt(t), r = Xt(), i =
|
|
23016
|
+
}, Qt = async (e = !0) => {
|
|
23017
|
+
let t = Pt(), n = Zt(t), r = await Xt(e), i = {
|
|
23022
23018
|
...Lt(),
|
|
23023
23019
|
...Rt(),
|
|
23024
23020
|
...n.clientTools || {},
|
|
23025
23021
|
...r
|
|
23026
|
-
},
|
|
23027
|
-
e === "readonly" && (
|
|
23028
|
-
let
|
|
23029
|
-
return
|
|
23022
|
+
}, a = i;
|
|
23023
|
+
e === "readonly" && (a = Object.fromEntries(Object.entries(i).filter(([e]) => !!r[e] || !kt.has(e))));
|
|
23024
|
+
let o = Object.keys(a), s = e === "readonly" ? Object.keys(i).filter((e) => !a[e]) : [], c = `${t}|${e}|${o.join(",")}`;
|
|
23025
|
+
return c !== jt && (jt = c, console.log(`Tellyou AI: premade tools — platform="${t}", mode="${e}", ${o.length} tool(s) added`, {
|
|
23030
23026
|
platform: t,
|
|
23031
23027
|
mode: e,
|
|
23032
|
-
tools:
|
|
23033
|
-
...
|
|
23034
|
-
...c.length ? { strippedWriteTools: c } : {}
|
|
23028
|
+
tools: o,
|
|
23029
|
+
...s.length ? { strippedWriteTools: s } : {}
|
|
23035
23030
|
})), {
|
|
23036
23031
|
context: n.context,
|
|
23037
|
-
clientTools:
|
|
23032
|
+
clientTools: a
|
|
23038
23033
|
};
|
|
23039
23034
|
};
|
|
23040
23035
|
})), en = /* @__PURE__ */ s(((e) => {
|
|
@@ -23220,30 +23215,19 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
23220
23215
|
let t = window.tellyouai || {}, n = Array.isArray(t) ? t : [t], r = n[e] ? { ...n[e] } : {};
|
|
23221
23216
|
r.user ||= { name: " " };
|
|
23222
23217
|
let i = document.title || window.location.pathname;
|
|
23223
|
-
|
|
23224
|
-
let e = Qt(r.autoTools ?? !0);
|
|
23225
|
-
e.clientTools && (r.clientTools = {
|
|
23226
|
-
...e.clientTools,
|
|
23227
|
-
...r.clientTools || {}
|
|
23228
|
-
}), e.context && (r.context = {
|
|
23229
|
-
...e.context,
|
|
23230
|
-
...r.context || {}
|
|
23231
|
-
});
|
|
23232
|
-
} catch (e) {
|
|
23233
|
-
console.warn(Vl + ": premade tools detection failed", e);
|
|
23234
|
-
}
|
|
23235
|
-
r.withSources === void 0 && (r.withSources = !1);
|
|
23218
|
+
r.user.name || (r.user.name = " "), r.context ||= { pageName: i }, r.withSources === void 0 && (r.withSources = !1);
|
|
23236
23219
|
let a = window.__tellyouaiEntryUrl || import.meta.url, o = new URLSearchParams(new URL(a).search), s = r.thingId || o.get("id") || void 0, c = r.entityId || o.get("entityId") || void 0, l = r.widgetId || o.get("widget") || o.get("widgetId") || void 0;
|
|
23237
23220
|
return !s && !c && console.error(Vl + ": id missing"), r.thingId = s, r.entityId = c, r.widgetId = l, r;
|
|
23238
23221
|
}, sn = (0, rn.createContext)({
|
|
23222
|
+
config: {},
|
|
23239
23223
|
thingId: void 0,
|
|
23240
23224
|
entityId: void 0,
|
|
23241
23225
|
widgetId: void 0,
|
|
23242
23226
|
target: "tellyouai-plugin",
|
|
23243
23227
|
isCustomTarget: !0,
|
|
23244
|
-
getDynamic: () => ({})
|
|
23228
|
+
getDynamic: async () => ({})
|
|
23245
23229
|
}), cn = ({ instanceIndex: e, target: t, isCustomTarget: n, children: r }) => {
|
|
23246
|
-
let i =
|
|
23230
|
+
let i = on(e), [, a] = (0, rn.useState)(0);
|
|
23247
23231
|
(0, rn.useEffect)(() => {
|
|
23248
23232
|
let e = (e) => {
|
|
23249
23233
|
let n = e.detail || {};
|
|
@@ -23251,15 +23235,31 @@ var A, j, M, N, P, F, ne, re, ie, ae, oe, I, se, ce, le, ue, de, fe, pe, L, me,
|
|
|
23251
23235
|
};
|
|
23252
23236
|
return window.addEventListener("tellyouai-config-changed", e), () => window.removeEventListener("tellyouai-config-changed", e);
|
|
23253
23237
|
}, [t]);
|
|
23254
|
-
let o = (0, rn.useCallback)(() =>
|
|
23255
|
-
|
|
23256
|
-
|
|
23257
|
-
|
|
23258
|
-
|
|
23259
|
-
|
|
23260
|
-
|
|
23238
|
+
let o = (0, rn.useCallback)(async () => {
|
|
23239
|
+
let t = on(e);
|
|
23240
|
+
if (t.autoTools !== !1) try {
|
|
23241
|
+
let e = await Qt(t.autoTools ?? !0);
|
|
23242
|
+
t.clientTools = {
|
|
23243
|
+
...e.clientTools,
|
|
23244
|
+
...t.clientTools
|
|
23245
|
+
}, t.context = {
|
|
23246
|
+
...e.context,
|
|
23247
|
+
...t.context
|
|
23248
|
+
};
|
|
23249
|
+
} catch (e) {
|
|
23250
|
+
console.warn(Vl + ": premade tools detection failed", e);
|
|
23251
|
+
}
|
|
23252
|
+
return {
|
|
23253
|
+
...t,
|
|
23254
|
+
target: void 0,
|
|
23255
|
+
thingId: void 0,
|
|
23256
|
+
entityId: void 0,
|
|
23257
|
+
widgetId: void 0
|
|
23258
|
+
};
|
|
23259
|
+
}, [e]);
|
|
23261
23260
|
return /* @__PURE__ */ (0, an.jsx)(sn.Provider, {
|
|
23262
23261
|
value: {
|
|
23262
|
+
config: i,
|
|
23263
23263
|
isCustomTarget: n,
|
|
23264
23264
|
target: t,
|
|
23265
23265
|
thingId: i.thingId,
|
|
@@ -32605,12 +32605,12 @@ var Tl, El, Dl, Ol, kl, Al, jl, Ml, Nl, Pl, Fl, Il = o((() => {
|
|
|
32605
32605
|
graphicType: t[12] || void 0
|
|
32606
32606
|
};
|
|
32607
32607
|
}, Kl = () => {
|
|
32608
|
-
let { thingId: e, entityId: t, widgetId: n,
|
|
32608
|
+
let { thingId: e, entityId: t, widgetId: n, config: r } = ql(), i = r.accessToken, a = !e && !t ? null : vn(`${Wl}${e ? `/${e}` : ""}`, {
|
|
32609
32609
|
entityId: t,
|
|
32610
32610
|
widget: n
|
|
32611
32611
|
}), { data: o, isLoading: s } = mt(a ? [a, i] : null, ([e, t]) => fetch(e, { headers: t ? { Authorization: `Bearer ${t}` } : void 0 }).then((e) => e.ok ? e : Promise.reject(e)).then((e) => e.json())), c = { ...o || {} };
|
|
32612
32612
|
c.withHelp === void 0 && (c.withHelp = !0), c.withVoice === void 0 && (c.withVoice = !!c.voiceId), c.withMessageAvatars === void 0 && (c.withMessageAvatars = !0), c.withQuickActions === void 0 && (c.withQuickActions = "visible-desktop"), c.quickActionsSpeed === void 0 && (c.quickActionsSpeed = "normal");
|
|
32613
|
-
let l = r
|
|
32613
|
+
let l = r.options;
|
|
32614
32614
|
return l?.theme !== void 0 && (c.theme = l.theme === "auto" ? void 0 : l.theme), l?.background !== void 0 && (c.background = l.background === "none" ? void 0 : l.background), l?.backgroundIntensity !== void 0 && (c.backgroundIntensity = l.backgroundIntensity), l?.borderRadius !== void 0 && (c.borderRadius = l.borderRadius), l?.shadow !== void 0 && (c.shadow = l.shadow), l?.avatarId !== void 0 && (c.avatarId = l.avatarId, l.avatarId && (c.mediaUrl = void 0)), l?.mediaUrl !== void 0 && (c.mediaUrl = l.mediaUrl, l.mediaUrl && (c.avatarId = void 0)), l?.mediaUrls !== void 0 && (c.mediaUrls = l.mediaUrls), l?.name !== void 0 && (c.name = l.name), l?.withEmoji !== void 0 && (c.withEmoji = l.withEmoji), l?.withFiles !== void 0 && (c.withFiles = l.withFiles), l?.withMessageAvatars !== void 0 && (c.withMessageAvatars = l.withMessageAvatars), l?.withDisplaySize !== void 0 && (c.withDisplaySize = l.withDisplaySize), l?.withLocale !== void 0 && (c.withLocale = l.withLocale), l?.withQuickActions !== void 0 && (c.withQuickActions = l.withQuickActions), l?.withVoice !== void 0 && (c.withVoice = l.withVoice), l?.greeting !== void 0 && (c.greeting = l.greeting), l?.quickActions !== void 0 && (c.quickActions = l.quickActions), l?.quickActionsSpeed !== void 0 && (c.quickActionsSpeed = l.quickActionsSpeed), l?.styles && (c.styles = {
|
|
32615
32615
|
...c.styles || {},
|
|
32616
32616
|
...l.styles
|
|
@@ -32759,7 +32759,7 @@ var Tl, El, Dl, Ol, kl, Al, jl, Ml, Nl, Pl, Fl, Il = o((() => {
|
|
|
32759
32759
|
};
|
|
32760
32760
|
})), vu, yu, bu, xu, Su = o((() => {
|
|
32761
32761
|
vu = /* @__PURE__ */ u(w(), 1), yu = /* @__PURE__ */ u(m(), 1), vt(), Dt(), $l(), _u(), bu = Vl + "Auth", xu = () => {
|
|
32762
|
-
let { thingId: e, entityId: t,
|
|
32762
|
+
let { thingId: e, entityId: t, config: n } = ql(), { user: r } = n, i = gu(n.consent), a = i.status !== "unknown" && i.functional, [o] = (0, yu.useState)(() => ({ entityId: Tt() })), { data: s, mutate: c, isLoading: l } = _t(a ? "auth" : null, async () => vu.default.getItem(bu)), u = r?.entityId, { data: d, isLoading: f } = _t(r?.id && !u && (e || t) ? [
|
|
32763
32763
|
"identified-auth",
|
|
32764
32764
|
e,
|
|
32765
32765
|
t,
|
|
@@ -41017,7 +41017,7 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41017
41017
|
let r = await navigator.mediaDevices.enumerateDevices(), i = r.find((e) => e.kind === "audioinput" && e.deviceId === n), a = r.find((e) => e.kind === "audiooutput" && i?.groupId && e.groupId === i.groupId);
|
|
41018
41018
|
a && await e.setSinkId(a.deviceId);
|
|
41019
41019
|
}, lce = (e) => {
|
|
41020
|
-
let { config: { entityId: t } } = Kl(), { entityId: n } = xu(), { locale: r } = cA(), i = ql(), a = gu(i.
|
|
41020
|
+
let { config: { entityId: t } } = Kl(), { entityId: n } = xu(), { locale: r } = cA(), i = ql(), a = gu(i.config.consent), [o, s] = (0, lA.useState)([]), [c, l] = (0, lA.useState)(!1), [u, d] = (0, lA.useState)(!1), f = (0, lA.useRef)(null), p = (0, lA.useRef)(null), m = (0, lA.useRef)(null), h = (0, lA.useRef)(null), g = (0, lA.useRef)(null), _ = (0, lA.useRef)(0), v = (0, lA.useRef)(/* @__PURE__ */ new Set()), y = (0, lA.useRef)(null), b = (0, lA.useRef)(null), x = (0, lA.useCallback)((e) => {
|
|
41021
41021
|
s((t) => {
|
|
41022
41022
|
let n = e.filter((e) => t.some((t) => t.id === e.id)), r = e.filter((e) => !t.some((t) => t.id === e.id));
|
|
41023
41023
|
return [...t.map((e) => {
|
|
@@ -41110,14 +41110,7 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41110
41110
|
type: "function",
|
|
41111
41111
|
name: e,
|
|
41112
41112
|
description: t.description,
|
|
41113
|
-
parameters:
|
|
41114
|
-
type: "object",
|
|
41115
|
-
properties: Object.fromEntries((t.parameters || []).map((e) => [e.name, {
|
|
41116
|
-
type: e.type,
|
|
41117
|
-
description: e.description
|
|
41118
|
-
}])),
|
|
41119
|
-
required: (t.parameters || []).map((e) => e.name)
|
|
41120
|
-
}
|
|
41113
|
+
parameters: t.inputSchema
|
|
41121
41114
|
}))
|
|
41122
41115
|
}));
|
|
41123
41116
|
}, x.onmessage = async (e) => {
|
|
@@ -41245,7 +41238,7 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41245
41238
|
withResponse: t,
|
|
41246
41239
|
...o ? { aiEntityId: o } : {}
|
|
41247
41240
|
}), mce = (e, t = !1) => {
|
|
41248
|
-
let { config: { entityId: n, avatarId: r, mediaUrl: i, name: a } } = Kl(), {
|
|
41241
|
+
let { config: { entityId: n, avatarId: r, mediaUrl: i, name: a } } = Kl(), { config: o, getDynamic: s } = ql(), c = gu(o.consent), { entityId: l } = xu(), { data: u, isLoading: d } = mt(e && t ? `${Ul}/cm?chatId=${e}&count=100` : null, (e) => fetch(e).then((e) => e.ok ? e : Promise.reject(e)).then((e) => e.json()), { onError: (e) => console.warn("Failed to fetch chat messages:", e) }), [f, p] = (0, dA.useState)([]), [m, h] = (0, dA.useState)(!1), g = (0, dA.useCallback)((e) => {
|
|
41249
41242
|
if (e && e === n) return {
|
|
41250
41243
|
id: n,
|
|
41251
41244
|
name: a || "",
|
|
@@ -41257,8 +41250,8 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41257
41250
|
i,
|
|
41258
41251
|
n,
|
|
41259
41252
|
a
|
|
41260
|
-
]),
|
|
41261
|
-
|
|
41253
|
+
]), _ = (0, dA.useCallback)((t) => {
|
|
41254
|
+
p((n) => {
|
|
41262
41255
|
let r = t.filter((e) => n.some((t) => t.id === e.id)), i = t.filter((e) => !n.some((t) => t.id === e.id));
|
|
41263
41256
|
return [...n.map((e) => {
|
|
41264
41257
|
let t = r.find((t) => t.id === e.id);
|
|
@@ -41271,15 +41264,15 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41271
41264
|
id: t.id || Tt(),
|
|
41272
41265
|
createdAt: t.createdAt || /* @__PURE__ */ new Date(),
|
|
41273
41266
|
chatId: e,
|
|
41274
|
-
entity: t.entity ||
|
|
41267
|
+
entity: t.entity || g(t.entityId)
|
|
41275
41268
|
}))];
|
|
41276
41269
|
});
|
|
41277
|
-
}, [e,
|
|
41270
|
+
}, [e, g]), v = (0, dA.useEffectEvent)(_);
|
|
41278
41271
|
return (0, dA.useLayoutEffect)(() => {
|
|
41279
|
-
|
|
41272
|
+
p([]);
|
|
41280
41273
|
}, [e]), (0, dA.useEffect)(() => {
|
|
41281
|
-
|
|
41282
|
-
}, [
|
|
41274
|
+
u && v([...u].reverse());
|
|
41275
|
+
}, [u]), (0, dA.useEffect)(() => {
|
|
41283
41276
|
if (!e || !t) return;
|
|
41284
41277
|
let n = !1, r = `chatMessages:chat-${e}:${Tt()}`, i = xl.channel(r);
|
|
41285
41278
|
return i.on("postgres_changes", {
|
|
@@ -41288,48 +41281,48 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41288
41281
|
table: "chatMessages",
|
|
41289
41282
|
filter: `chatId=eq.${e}`
|
|
41290
41283
|
}, async (e) => {
|
|
41291
|
-
let t = e.new, n =
|
|
41292
|
-
|
|
41284
|
+
let t = e.new, n = g(t.entityId);
|
|
41285
|
+
_([{
|
|
41293
41286
|
...t,
|
|
41294
41287
|
entity: n
|
|
41295
41288
|
}]);
|
|
41296
41289
|
}).subscribe((e) => {
|
|
41297
|
-
console.log(e), !n && e === "SUBSCRIBED" &&
|
|
41290
|
+
console.log(e), !n && e === "SUBSCRIBED" && h(!0);
|
|
41298
41291
|
}), () => {
|
|
41299
41292
|
n = !0, xl.removeChannel(i);
|
|
41300
41293
|
};
|
|
41301
41294
|
}, [
|
|
41302
41295
|
e,
|
|
41303
41296
|
t,
|
|
41304
|
-
|
|
41305
|
-
|
|
41297
|
+
g,
|
|
41298
|
+
_
|
|
41306
41299
|
]), {
|
|
41307
41300
|
sendMessage: (0, dA.useCallback)(async (t, r) => {
|
|
41308
|
-
let i =
|
|
41301
|
+
let i = l !== n, a = [], o = {
|
|
41309
41302
|
id: Tt(),
|
|
41310
41303
|
createdAt: /* @__PURE__ */ new Date(),
|
|
41311
|
-
entityId:
|
|
41304
|
+
entityId: l || "",
|
|
41312
41305
|
content: t,
|
|
41313
41306
|
chatId: e
|
|
41314
41307
|
};
|
|
41315
|
-
a.push(
|
|
41308
|
+
a.push(o);
|
|
41316
41309
|
let u = Tt();
|
|
41317
41310
|
i && a.push({
|
|
41318
41311
|
id: u,
|
|
41319
41312
|
entityId: n || "",
|
|
41320
|
-
entity:
|
|
41313
|
+
entity: g(n),
|
|
41321
41314
|
content: "",
|
|
41322
41315
|
status: "saving",
|
|
41323
41316
|
createdAt: /* @__PURE__ */ new Date(),
|
|
41324
41317
|
chatId: e
|
|
41325
|
-
}),
|
|
41326
|
-
let { clientTools: d, servers:
|
|
41318
|
+
}), p((e) => [...e.filter((e) => e.status !== "saving"), ...a]);
|
|
41319
|
+
let { clientTools: d, servers: f, context: m, user: h } = await s(), _ = await fetch(`${Ul}/cm/`, {
|
|
41327
41320
|
method: "POST",
|
|
41328
41321
|
headers: { "Content-Type": "application/json" },
|
|
41329
|
-
body: JSON.stringify(pce(
|
|
41322
|
+
body: JSON.stringify(pce(o, u, {
|
|
41330
41323
|
...m || {},
|
|
41331
41324
|
...r || {}
|
|
41332
|
-
},
|
|
41325
|
+
}, h, d, f, n, c.analytics))
|
|
41333
41326
|
});
|
|
41334
41327
|
if (!_.ok) throw _.statusText;
|
|
41335
41328
|
let v = _.body?.getReader(), y = new TextDecoder();
|
|
@@ -41353,7 +41346,7 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41353
41346
|
...S[C],
|
|
41354
41347
|
type: "tool-call",
|
|
41355
41348
|
input: {}
|
|
41356
|
-
},
|
|
41349
|
+
}, p((e) => e.map((e) => e.id === u ? {
|
|
41357
41350
|
...e,
|
|
41358
41351
|
steps: [...S]
|
|
41359
41352
|
} : e))), t.type === "tool-input-delta" && t.delta && C >= 0 && S[C]) try {
|
|
@@ -41361,7 +41354,7 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41361
41354
|
S[C].input = {
|
|
41362
41355
|
...S[C].input,
|
|
41363
41356
|
...e
|
|
41364
|
-
},
|
|
41357
|
+
}, p((e) => e.map((e) => e.id === u ? {
|
|
41365
41358
|
...e,
|
|
41366
41359
|
steps: [...S]
|
|
41367
41360
|
} : e));
|
|
@@ -41373,7 +41366,7 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41373
41366
|
...S[C],
|
|
41374
41367
|
type: "tool-call",
|
|
41375
41368
|
input: t.input
|
|
41376
|
-
},
|
|
41369
|
+
}, p((e) => e.map((e) => e.id === u ? {
|
|
41377
41370
|
...e,
|
|
41378
41371
|
steps: [...S]
|
|
41379
41372
|
} : e));
|
|
@@ -41387,7 +41380,7 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41387
41380
|
...S[C],
|
|
41388
41381
|
type: "tool-result",
|
|
41389
41382
|
text: JSON.stringify(e)
|
|
41390
|
-
},
|
|
41383
|
+
}, p((e) => e.map((e) => e.id === u ? {
|
|
41391
41384
|
...e,
|
|
41392
41385
|
steps: [...S]
|
|
41393
41386
|
} : e));
|
|
@@ -41396,7 +41389,7 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41396
41389
|
...S[C],
|
|
41397
41390
|
type: "tool-result",
|
|
41398
41391
|
text: JSON.stringify({ error: t?.message || "Tool execution failed" })
|
|
41399
|
-
},
|
|
41392
|
+
}, p((e) => e.map((e) => e.id === u ? {
|
|
41400
41393
|
...e,
|
|
41401
41394
|
steps: [...S]
|
|
41402
41395
|
} : e));
|
|
@@ -41414,7 +41407,7 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41414
41407
|
...S[C],
|
|
41415
41408
|
type: "tool-result",
|
|
41416
41409
|
text: JSON.stringify(t.output)
|
|
41417
|
-
},
|
|
41410
|
+
}, p((t) => t.map((t) => t.id === u ? {
|
|
41418
41411
|
...t,
|
|
41419
41412
|
steps: [...S],
|
|
41420
41413
|
structuredContent: e ?? t.structuredContent,
|
|
@@ -41423,16 +41416,16 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41423
41416
|
}
|
|
41424
41417
|
if (t.type === "knowledges" && t.content) {
|
|
41425
41418
|
let e = t.content;
|
|
41426
|
-
|
|
41419
|
+
p((t) => t.map((t) => t.id === u ? {
|
|
41427
41420
|
...t,
|
|
41428
41421
|
knowledges: e
|
|
41429
41422
|
} : t));
|
|
41430
41423
|
}
|
|
41431
|
-
t.type === "text-delta" && t.text && (x += t.text,
|
|
41424
|
+
t.type === "text-delta" && t.text && (x += t.text, p((e) => e.map((e) => e.id === u ? {
|
|
41432
41425
|
...e,
|
|
41433
41426
|
content: x,
|
|
41434
41427
|
steps: [...S]
|
|
41435
|
-
} : e))), (t.type === "finish" || t.type === "finish-step") &&
|
|
41428
|
+
} : e))), (t.type === "finish" || t.type === "finish-step") && p((e) => e.map((e) => e.id === u ? {
|
|
41436
41429
|
...e,
|
|
41437
41430
|
content: x,
|
|
41438
41431
|
status: "sent",
|
|
@@ -41445,20 +41438,20 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41445
41438
|
}
|
|
41446
41439
|
}
|
|
41447
41440
|
} finally {
|
|
41448
|
-
v.releaseLock(),
|
|
41441
|
+
v.releaseLock(), p((e) => e.filter((e) => e.status !== "saving"));
|
|
41449
41442
|
}
|
|
41450
41443
|
}, [
|
|
41451
|
-
|
|
41444
|
+
l,
|
|
41452
41445
|
n,
|
|
41453
41446
|
e,
|
|
41454
|
-
|
|
41455
|
-
|
|
41456
|
-
|
|
41447
|
+
s,
|
|
41448
|
+
g,
|
|
41449
|
+
c.analytics
|
|
41457
41450
|
]),
|
|
41458
|
-
messages:
|
|
41459
|
-
onMessages:
|
|
41460
|
-
isConnected:
|
|
41461
|
-
isLoading:
|
|
41451
|
+
messages: f,
|
|
41452
|
+
onMessages: _,
|
|
41453
|
+
isConnected: m,
|
|
41454
|
+
isLoading: d
|
|
41462
41455
|
};
|
|
41463
41456
|
}, hce = (e, t) => {
|
|
41464
41457
|
if (!t.length) return e;
|
|
@@ -41516,7 +41509,7 @@ var bp, xp, Sp, Cp, wp, Tp, Ep, Dp, Op, kp, Ap, jp, Mp, Np, Pp, Fp, Ip, Lp, Rp,
|
|
|
41516
41509
|
let t = e.toLowerCase();
|
|
41517
41510
|
return Cce.some((e) => t.includes(e));
|
|
41518
41511
|
}, wce = (e, t) => {
|
|
41519
|
-
let { target: n,
|
|
41512
|
+
let { target: n, config: r } = ql(), i = gu(r.consent), a = `${n}`, o = n, { locationKey: s } = t || {}, c = (t?.speed || 1e3) * 10, l = c / 3;
|
|
41520
41513
|
(0, pA.useEffect)(() => {
|
|
41521
41514
|
if (!mA(document.title)) return;
|
|
41522
41515
|
let t = setTimeout(() => {
|
|
@@ -67026,26 +67019,26 @@ var rV, iV, Bpe = o((() => {
|
|
|
67026
67019
|
deleteDelay: 18,
|
|
67027
67020
|
betweenDelay: 120
|
|
67028
67021
|
}
|
|
67029
|
-
}, YV = ({ type: e, isLoading: t, isOpen: n, onClickButton: r, isCustomTarget: i,
|
|
67030
|
-
let [
|
|
67031
|
-
let e =
|
|
67032
|
-
return [
|
|
67022
|
+
}, YV = ({ type: e, isLoading: t, isOpen: n, onClickButton: r, isCustomTarget: i, zIndex: a, placement: o, quickActions: s, onClickQuickAction: c, onMessages: l, sendMessage: u, hasChatUserMessages: d, userMessages: f, onClickCall: p, callIsConnected: m, callIsConnecting: h }) => {
|
|
67023
|
+
let [g, _] = (0, KV.useState)(!1), { locale: v, formatMessage: y } = cA(), b = v.split("-")[0].trim(), { styles: { themeColors: x, openerDimensions: S, marginRight: C, transitionSpeed: w, color: T, colorBright: E, colorDark: D, backgroundColor: O, shadowOuter: ee, borderColor: k, borderRadiusLg: te } } = gA(), A = x?.[0], j = dn(A), [M, N] = (0, KV.useState)(!1), { config: { greeting: P, mediaUrl: F, mediaUrls: ne, quickActionsSpeed: re, withVoice: ie } } = Kl(), { widgetId: ae } = ql(), oe = !ae && e === "button" ? F : void 0, I = ne?.[2]?.url || oe, se = t ? "" : P?._ || P?.[b] || P?.en || y({ id: "ask-us-anything" }), ce = (0, KV.useMemo)(() => {
|
|
67024
|
+
let e = s?.map((e) => e.strings._ || e.strings[b] || e.strings.en).filter((e) => !!e) ?? [];
|
|
67025
|
+
return [se, ...e].filter((e, t, n) => !!e && n.indexOf(e) === t);
|
|
67033
67026
|
}, [
|
|
67034
|
-
|
|
67035
|
-
|
|
67036
|
-
|
|
67037
|
-
]), [
|
|
67027
|
+
se,
|
|
67028
|
+
b,
|
|
67029
|
+
s
|
|
67030
|
+
]), [le, ue] = (0, KV.useState)(""), [de, fe] = (0, KV.useState)(!1);
|
|
67038
67031
|
(0, KV.useEffect)(() => {
|
|
67039
|
-
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () =>
|
|
67032
|
+
let e = window.matchMedia("(prefers-reduced-motion: reduce)"), t = () => fe(e.matches);
|
|
67040
67033
|
return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
67041
67034
|
}, []), (0, KV.useEffect)(() => {
|
|
67042
|
-
if (
|
|
67043
|
-
|
|
67035
|
+
if (ce.length <= 1 || de) {
|
|
67036
|
+
ue("");
|
|
67044
67037
|
return;
|
|
67045
67038
|
}
|
|
67046
|
-
let e = JV[
|
|
67047
|
-
let o =
|
|
67048
|
-
if (
|
|
67039
|
+
let e = JV[re || "normal"], t = 0, n = 0, r = !1, i, a = () => {
|
|
67040
|
+
let o = ce[t] ?? "";
|
|
67041
|
+
if (ue(o.slice(0, n)), !r && n < o.length) {
|
|
67049
67042
|
n += 1, i = setTimeout(a, e.typeDelay);
|
|
67050
67043
|
return;
|
|
67051
67044
|
}
|
|
@@ -67057,137 +67050,135 @@ var rV, iV, Bpe = o((() => {
|
|
|
67057
67050
|
--n, i = setTimeout(a, e.deleteDelay);
|
|
67058
67051
|
return;
|
|
67059
67052
|
}
|
|
67060
|
-
r = !1, t = (t + 1) %
|
|
67053
|
+
r = !1, t = (t + 1) % ce.length, i = setTimeout(a, e.betweenDelay);
|
|
67061
67054
|
};
|
|
67062
67055
|
return i = setTimeout(a, 0), () => {
|
|
67063
67056
|
clearTimeout(i);
|
|
67064
67057
|
};
|
|
67065
67058
|
}, [
|
|
67066
|
-
|
|
67067
|
-
|
|
67068
|
-
|
|
67059
|
+
ce,
|
|
67060
|
+
de,
|
|
67061
|
+
re
|
|
67069
67062
|
]);
|
|
67070
|
-
let
|
|
67063
|
+
let pe = ce.length <= 1 || de ? ce[0] ?? "" : le;
|
|
67071
67064
|
return /* @__PURE__ */ (0, qV.jsxs)("div", {
|
|
67072
67065
|
style: {
|
|
67073
|
-
zIndex:
|
|
67074
|
-
|
|
67075
|
-
right: e === "input" ? "50%" : x,
|
|
67076
|
-
transform: e === "input" ? "translateX(50%)" : void 0,
|
|
67066
|
+
zIndex: a,
|
|
67067
|
+
...o,
|
|
67077
67068
|
position: i ? "absolute" : "fixed",
|
|
67078
|
-
maxWidth: `calc(${i ? "100%" : "100dvw"} - ${
|
|
67069
|
+
maxWidth: `calc(${i ? "100%" : "100dvw"} - ${C} - ${C})`,
|
|
67079
67070
|
lineHeight: "initial",
|
|
67080
67071
|
fontSize: "initial"
|
|
67081
67072
|
},
|
|
67082
|
-
children: [e === "input" && /* @__PURE__ */ (0, qV.jsxs)(qV.Fragment, { children: [!n &&
|
|
67083
|
-
let n = e.strings._ || e.strings[
|
|
67073
|
+
children: [e === "input" && /* @__PURE__ */ (0, qV.jsxs)(qV.Fragment, { children: [!n && s?.map((e, t) => {
|
|
67074
|
+
let n = e.strings._ || e.strings[b] || e.strings.en;
|
|
67084
67075
|
return /* @__PURE__ */ (0, qV.jsx)(xV, {
|
|
67085
67076
|
size: "sm",
|
|
67086
|
-
onClick: () =>
|
|
67077
|
+
onClick: () => c?.(n, e.context),
|
|
67087
67078
|
style: {
|
|
67088
|
-
position:
|
|
67079
|
+
position: M ? "static" : "absolute",
|
|
67089
67080
|
bottom: `${t * 40 + 2}px`,
|
|
67090
67081
|
left: 0,
|
|
67091
|
-
zIndex:
|
|
67082
|
+
zIndex: a,
|
|
67092
67083
|
whiteSpace: "nowrap",
|
|
67093
67084
|
height: "36px",
|
|
67094
|
-
borderRadius:
|
|
67085
|
+
borderRadius: te,
|
|
67095
67086
|
fontWeight: "inherit",
|
|
67096
67087
|
fontSize: 14,
|
|
67097
67088
|
padding: "12px 12px",
|
|
67098
67089
|
marginBottom: "8px",
|
|
67099
|
-
opacity: +!!
|
|
67100
|
-
visibility:
|
|
67101
|
-
pointerEvents:
|
|
67102
|
-
transform:
|
|
67103
|
-
transition: "all " +
|
|
67104
|
-
boxShadow:
|
|
67090
|
+
opacity: +!!M,
|
|
67091
|
+
visibility: M ? "visible" : "hidden",
|
|
67092
|
+
pointerEvents: M ? void 0 : "none",
|
|
67093
|
+
transform: M ? "translateY(0)" : "translateY(40px)",
|
|
67094
|
+
transition: "all " + w,
|
|
67095
|
+
boxShadow: ee
|
|
67105
67096
|
},
|
|
67106
67097
|
className: "tellyouai-quick-action-button",
|
|
67107
67098
|
children: n
|
|
67108
67099
|
}, n);
|
|
67109
67100
|
}), /* @__PURE__ */ (0, qV.jsx)(WV, {
|
|
67110
|
-
placeholder:
|
|
67111
|
-
onMessages:
|
|
67112
|
-
sendMessage:
|
|
67113
|
-
userMessages:
|
|
67101
|
+
placeholder: pe,
|
|
67102
|
+
onMessages: l,
|
|
67103
|
+
sendMessage: u,
|
|
67104
|
+
userMessages: f,
|
|
67114
67105
|
onClick: () => {
|
|
67115
|
-
|
|
67106
|
+
d && !n && r?.();
|
|
67116
67107
|
},
|
|
67117
67108
|
style: {
|
|
67118
|
-
borderRadius:
|
|
67109
|
+
borderRadius: te,
|
|
67119
67110
|
padding: "1px",
|
|
67120
|
-
backgroundImage:
|
|
67121
|
-
boxShadow:
|
|
67111
|
+
backgroundImage: x ? "linear-gradient(45deg, " + x.join(", ") + ") " : void 0,
|
|
67112
|
+
boxShadow: ee + ", 0 0 12px -4px " + (A || "transparent")
|
|
67122
67113
|
},
|
|
67123
67114
|
containerStyle: {
|
|
67124
|
-
background:
|
|
67125
|
-
borderRadius:
|
|
67115
|
+
background: O,
|
|
67116
|
+
borderRadius: te
|
|
67126
67117
|
},
|
|
67127
67118
|
inputStyle: {
|
|
67128
|
-
width: e === "input" ?
|
|
67119
|
+
width: e === "input" ? M || n ? "calc(560px)" : "calc(400px)" : void 0,
|
|
67129
67120
|
maxWidth: "100%",
|
|
67130
|
-
transition: "width " +
|
|
67131
|
-
borderRadius:
|
|
67121
|
+
transition: "width " + w,
|
|
67122
|
+
borderRadius: te,
|
|
67132
67123
|
whiteSpace: "nowrap",
|
|
67133
67124
|
fontSize: "initial",
|
|
67134
67125
|
borderWidth: 0,
|
|
67135
67126
|
background: "none"
|
|
67136
67127
|
},
|
|
67137
67128
|
onFocus: () => {
|
|
67138
|
-
|
|
67129
|
+
N(!0);
|
|
67139
67130
|
},
|
|
67140
67131
|
onBlur: (e) => {
|
|
67141
|
-
e.relatedTarget?.classList?.contains("tellyouai-quick-action-button") ||
|
|
67132
|
+
e.relatedTarget?.classList?.contains("tellyouai-quick-action-button") || N(!1);
|
|
67142
67133
|
},
|
|
67143
67134
|
withEmoji: !1,
|
|
67144
|
-
withFiles: n ||
|
|
67145
|
-
withVoice:
|
|
67146
|
-
onClickCall:
|
|
67147
|
-
callIsConnected:
|
|
67148
|
-
callIsConnecting:
|
|
67149
|
-
})] }), e === "button" && /* @__PURE__ */ (0, qV.jsxs)(qV.Fragment, { children: [!n &&
|
|
67150
|
-
let n = e.strings._ || e.strings[
|
|
67135
|
+
withFiles: n || d ? void 0 : !1,
|
|
67136
|
+
withVoice: ie,
|
|
67137
|
+
onClickCall: p,
|
|
67138
|
+
callIsConnected: m,
|
|
67139
|
+
callIsConnecting: h
|
|
67140
|
+
})] }), e === "button" && /* @__PURE__ */ (0, qV.jsxs)(qV.Fragment, { children: [!n && s?.map((e, t) => {
|
|
67141
|
+
let n = e.strings._ || e.strings[b] || e.strings.en, r = t === 0 ? -10 : t === 1 ? -5 : t === 2 ? 40 : 0;
|
|
67151
67142
|
return /* @__PURE__ */ (0, qV.jsx)(xV, {
|
|
67152
67143
|
size: "sm",
|
|
67153
|
-
onClick: () =>
|
|
67144
|
+
onClick: () => c?.(n, e.context),
|
|
67154
67145
|
style: {
|
|
67155
67146
|
position: "absolute",
|
|
67156
67147
|
bottom: `${t * 40 + 2}px`,
|
|
67157
|
-
right: `calc(${
|
|
67158
|
-
zIndex:
|
|
67148
|
+
right: `calc(${S} - ${r}px)`,
|
|
67149
|
+
zIndex: a,
|
|
67159
67150
|
whiteSpace: "nowrap",
|
|
67160
67151
|
height: "32px",
|
|
67161
67152
|
borderRadius: "16px",
|
|
67162
67153
|
fontSize: 14,
|
|
67163
67154
|
padding: "10px 12px",
|
|
67164
|
-
boxShadow:
|
|
67155
|
+
boxShadow: ee
|
|
67165
67156
|
},
|
|
67166
67157
|
children: n
|
|
67167
67158
|
}, n);
|
|
67168
67159
|
}), /* @__PURE__ */ (0, qV.jsxs)("button", {
|
|
67169
67160
|
"aria-expanded": n,
|
|
67170
|
-
onPointerEnter: () =>
|
|
67171
|
-
onPointerLeave: () =>
|
|
67172
|
-
onFocus: () =>
|
|
67173
|
-
onBlur: () =>
|
|
67161
|
+
onPointerEnter: () => _(!0),
|
|
67162
|
+
onPointerLeave: () => _(!1),
|
|
67163
|
+
onFocus: () => _(!0),
|
|
67164
|
+
onBlur: () => _(!1),
|
|
67174
67165
|
style: {
|
|
67175
67166
|
display: "flex",
|
|
67176
67167
|
alignItems: "center",
|
|
67177
67168
|
justifyContent: "center",
|
|
67178
|
-
width:
|
|
67179
|
-
height:
|
|
67169
|
+
width: S,
|
|
67170
|
+
height: S,
|
|
67180
67171
|
boxSizing: "border-box",
|
|
67181
|
-
padding:
|
|
67182
|
-
border: `0.5px solid ${
|
|
67172
|
+
padding: I ? "" : 11.9,
|
|
67173
|
+
border: `0.5px solid ${k}`,
|
|
67183
67174
|
borderRadius: "100%",
|
|
67184
|
-
backgroundColor: t ? "transparent" : n ||
|
|
67185
|
-
color: n ?
|
|
67175
|
+
backgroundColor: t ? "transparent" : n || I ? O : A,
|
|
67176
|
+
color: n ? T : j === !0 ? D : j === !1 ? E : void 0,
|
|
67186
67177
|
cursor: "pointer",
|
|
67187
|
-
boxShadow:
|
|
67188
|
-
transition: "all " +
|
|
67178
|
+
boxShadow: ee,
|
|
67179
|
+
transition: "all " + w,
|
|
67189
67180
|
opacity: +!t,
|
|
67190
|
-
scale:
|
|
67181
|
+
scale: g ? 1.1 : 1,
|
|
67191
67182
|
overflow: "hidden"
|
|
67192
67183
|
},
|
|
67193
67184
|
disabled: t,
|
|
@@ -67195,7 +67186,7 @@ var rV, iV, Bpe = o((() => {
|
|
|
67195
67186
|
children: [!t && /* @__PURE__ */ (0, qV.jsx)(qV.Fragment, { children: n ? /* @__PURE__ */ (0, qV.jsx)(TV, {
|
|
67196
67187
|
id: "down",
|
|
67197
67188
|
size: "md"
|
|
67198
|
-
}) :
|
|
67189
|
+
}) : I ? /* @__PURE__ */ (0, qV.jsx)("img", {
|
|
67199
67190
|
alt: "",
|
|
67200
67191
|
style: {
|
|
67201
67192
|
width: "100%",
|
|
@@ -67203,13 +67194,13 @@ var rV, iV, Bpe = o((() => {
|
|
|
67203
67194
|
objectFit: "cover",
|
|
67204
67195
|
objectPosition: "center"
|
|
67205
67196
|
},
|
|
67206
|
-
src:
|
|
67197
|
+
src: I
|
|
67207
67198
|
}) : /* @__PURE__ */ (0, qV.jsx)(hV, {
|
|
67208
67199
|
animation: "appear",
|
|
67209
67200
|
size: "80%"
|
|
67210
67201
|
}) }), /* @__PURE__ */ (0, qV.jsx)("span", {
|
|
67211
67202
|
className: "tellyouai-sr-only",
|
|
67212
|
-
children:
|
|
67203
|
+
children: y(n ? { id: "close" } : { id: "chat-with-me" })
|
|
67213
67204
|
})]
|
|
67214
67205
|
})] })]
|
|
67215
67206
|
});
|
|
@@ -67453,7 +67444,7 @@ var rV, iV, Bpe = o((() => {
|
|
|
67453
67444
|
};
|
|
67454
67445
|
})), gH, _H, vH, yH, bH, xH = o((() => {
|
|
67455
67446
|
gH = /* @__PURE__ */ u(m(), 1), Hp(), aA(), yA(), Ot(), _H = nn(), vH = (0, gH.createContext)({ setLocale: () => {} }), yH = () => (0, gH.useContext)(vH).setLocale, bH = ({ children: e }) => {
|
|
67456
|
-
let { config: { language: t, languages: n } } = Kl(), {
|
|
67447
|
+
let { config: { language: t, languages: n } } = Kl(), { config: r } = ql(), i = (r.languages || n || []).map(rA).filter((e) => !!e), a = rA(t), o = a && i.includes(a) ? a : i[0], s = i.includes(iA()) || !i.length ? iA() : o, [c, l] = (0, gH.useState)(s), u = !i?.length || i.includes(c);
|
|
67457
67448
|
(0, gH.useEffect)(() => {
|
|
67458
67449
|
u || l(s);
|
|
67459
67450
|
}, [u, s]);
|
|
@@ -68567,77 +68558,90 @@ var rV, iV, Bpe = o((() => {
|
|
|
68567
68558
|
};
|
|
68568
68559
|
})), Pq, Fq, Iq, eye = o((() => {
|
|
68569
68560
|
Pq = /* @__PURE__ */ u(m(), 1), yA(), Gpe(), fH(), hH(), Nq(), Fq = nn(), Iq = ({ canStore: e, displayMode: t, displaySize: n, onClickQuickAction: r, onClickDisplaySize: i, onMessages: a, sendMessage: o, children: s, onOpenChange: c, hasChatUserMessages: l, userMessages: u, mode: d, onClickNewChat: f, onClickCall: p, callIsConnected: m, callIsConnecting: h }) => {
|
|
68570
|
-
let { formatMessage: g } = cA(), { isMobile: _ } = Tu(), { config: { entityId: v, withQuickActions: y, quickActions: b, withLocale: x, withConsent: S, privacyUrl: C }, isLoading:
|
|
68571
|
-
|
|
68572
|
-
}, [
|
|
68573
|
-
|
|
68574
|
-
}, [
|
|
68561
|
+
let { formatMessage: g } = cA(), { isMobile: _ } = Tu(), { config: { entityId: v, withQuickActions: y, quickActions: b, withLocale: x, withConsent: S, privacyUrl: C, position: w, style: T }, isLoading: E } = Kl(), { entityId: D } = xu(), O = y === "visible" || y === "visible-desktop" && !_, { background: ee, styles: { color: k, borderColor: te, backgroundColor70: A, spacingXS: j, spacingMD: M, marginRight: N, marginBottom: P, openerDimensions: F, transitionSpeed: ne, borderRadiusLg: re, shadowOuter: ie, themeColors: ae } } = gA(), { config: oe, target: I, isCustomTarget: se } = ql(), { session: ce, setSession: le } = Yl(v, D, I, oe.widgetId, e), [ue, de] = (0, Pq.useState)(), fe = ue ?? oe.isOpen ?? ce.isOpen ?? !1, pe = ce.isMaximized ?? oe.isMaximized ?? !1, L = oe.position === void 0 ? w : oe.position, me = oe.style === void 0 ? T : oe.style, he = me?.zIndex ?? L?.z ?? 8, ge = (0, Pq.useRef)(null), _e = (0, Pq.useRef)(null), R = (0, Pq.useRef)(!1), ve = (0, Pq.useCallback)((e) => {
|
|
68562
|
+
de(e), le({ isOpen: e }), c?.(e);
|
|
68563
|
+
}, [le, c]), ye = (0, Pq.useCallback)((e) => {
|
|
68564
|
+
le({ isMaximized: e });
|
|
68565
|
+
}, [le]);
|
|
68575
68566
|
(0, Pq.useEffect)(() => {
|
|
68576
68567
|
let e = (e) => {
|
|
68577
68568
|
let t = e.detail?.id, n = e.detail?.open;
|
|
68578
|
-
t && t !==
|
|
68569
|
+
t && t !== I || n !== void 0 && (console.log("tellyouai open event", t, n), ve(n));
|
|
68579
68570
|
};
|
|
68580
68571
|
return window.addEventListener("tellyouai-plugin", e), () => {
|
|
68581
68572
|
window.removeEventListener("tellyouai-plugin", e);
|
|
68582
68573
|
};
|
|
68583
68574
|
}, [
|
|
68584
68575
|
t,
|
|
68585
|
-
|
|
68586
|
-
|
|
68576
|
+
I,
|
|
68577
|
+
ve
|
|
68587
68578
|
]), (0, Pq.useEffect)(() => {
|
|
68588
|
-
if (
|
|
68589
|
-
|
|
68579
|
+
if (fe && !R.current) {
|
|
68580
|
+
_e.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
68590
68581
|
let e = requestAnimationFrame(() => {
|
|
68591
|
-
(
|
|
68582
|
+
(ge.current?.querySelector("textarea, input:not([type=\"hidden\"]), select, button, a[href], [tabindex]:not([tabindex=\"-1\"])") ?? ge.current)?.focus();
|
|
68592
68583
|
});
|
|
68593
|
-
return
|
|
68594
|
-
}
|
|
68595
|
-
!
|
|
68596
|
-
}, [
|
|
68597
|
-
let
|
|
68598
|
-
|
|
68599
|
-
},
|
|
68584
|
+
return R.current = !0, () => cancelAnimationFrame(e);
|
|
68585
|
+
}
|
|
68586
|
+
!fe && R.current && (_e.current?.focus(), _e.current = null, R.current = !1);
|
|
68587
|
+
}, [fe]);
|
|
68588
|
+
let be = (e, t) => {
|
|
68589
|
+
ve(!0), r(e, t);
|
|
68590
|
+
}, xe = t === "overlay" || t === "overlay-maximized" || t === "bar" || t === "bar-maximized", Se = t === "overlay" || t === "overlay-maximized", Ce = xe ? pe ? "90dvw" : "560px" : pe ? "700px" : "400px", we = Se ? "90dvh" : pe || _ ? "100dvh" : t === "bar" ? "500px" : "700px", Te = xe ? "50%" : N, Ee = Se ? "53%" : t === "bar" ? `calc(${P} + 64px)` : _ ? `calc(${P})` : `calc(${P} + ${F} + ${M})`, De = re, Oe = t !== "bar" && t !== "bar-maximized" ? "button" : "input", ke = me, Ae = L?.x ?? (Oe === "input" ? "center" : "right"), je = L?.y ?? "bottom", Me = ke?.left !== void 0 || ke?.right !== void 0, Ne = ke?.top !== void 0 || ke?.bottom !== void 0, Pe = {
|
|
68591
|
+
left: Me ? ke?.left : Ae === "left" ? N : Ae === "center" ? "50%" : void 0,
|
|
68592
|
+
right: Me ? ke?.right : Ae === "right" ? N : void 0,
|
|
68593
|
+
top: Ne ? ke?.top : je === "top" ? P : je === "center" ? "50%" : void 0,
|
|
68594
|
+
bottom: Ne ? ke?.bottom : je === "bottom" ? P : void 0,
|
|
68595
|
+
transform: `translate(${!Me && Ae === "center" ? "-50%" : "0"}, ${!Ne && je === "center" ? "-50%" : "0"})`
|
|
68596
|
+
}, Fe = Pe.top !== void 0 && Pe.top !== "auto", Ie = Fe ? `calc(${Pe.top} + ${F} + ${M})` : void 0, Le = Fe ? void 0 : Pe.bottom !== void 0 && Pe.bottom !== "auto" ? `calc(${Pe.bottom} + ${F} + ${M})` : Ee, Re = {
|
|
68597
|
+
top: Ie,
|
|
68598
|
+
bottom: Le,
|
|
68599
|
+
left: Pe.left,
|
|
68600
|
+
right: Pe.right,
|
|
68601
|
+
transform: `translate(${!Me && Ae === "center" ? "-50%" : "0"}, 0)`
|
|
68602
|
+
}, ze = !xe && !Se, Be = ze ? Ie ?? Le ?? Ee : Ee, Ve = dH(ee, ae, "bottom"), He = uH(t, d, ee), Ue = d === "text" && S !== !0;
|
|
68600
68603
|
return /* @__PURE__ */ (0, Fq.jsxs)(Fq.Fragment, { children: [/* @__PURE__ */ (0, Fq.jsxs)("div", {
|
|
68601
|
-
ref:
|
|
68604
|
+
ref: ge,
|
|
68602
68605
|
role: "dialog",
|
|
68603
68606
|
"aria-label": g({ id: "chat-with-me" }),
|
|
68604
68607
|
tabIndex: -1,
|
|
68605
68608
|
onKeyDown: (e) => {
|
|
68606
|
-
e.key === "Escape" && (e.stopPropagation(),
|
|
68609
|
+
e.key === "Escape" && (e.stopPropagation(), ve(!1));
|
|
68607
68610
|
},
|
|
68608
68611
|
style: {
|
|
68609
|
-
position:
|
|
68610
|
-
zIndex:
|
|
68611
|
-
transform: `translate(${
|
|
68612
|
-
bottom:
|
|
68613
|
-
right:
|
|
68614
|
-
|
|
68612
|
+
position: se ? "absolute" : "fixed",
|
|
68613
|
+
zIndex: he + 1,
|
|
68614
|
+
transform: `translate(${xe ? "50%" : "0"}, ${Se ? "50%" : "0"})`,
|
|
68615
|
+
bottom: Ee,
|
|
68616
|
+
right: Te,
|
|
68617
|
+
...ze ? Re : {},
|
|
68618
|
+
backgroundColor: A,
|
|
68615
68619
|
backdropFilter: "blur(48px)",
|
|
68616
68620
|
boxSizing: "border-box",
|
|
68617
|
-
width: `min(calc(100% - ${
|
|
68618
|
-
height:
|
|
68619
|
-
maxWidth:
|
|
68620
|
-
maxHeight:
|
|
68621
|
+
width: `min(calc(100% - ${N} - ${N}), ${Ce})`,
|
|
68622
|
+
height: Se ? "80dvh" : `min(calc(100dvh - ${P} - ${Be}), ${we})`,
|
|
68623
|
+
maxWidth: xe ? "1000px" : void 0,
|
|
68624
|
+
maxHeight: Se ? "1000px" : `calc(100dvh - ${Be} - ${M})`,
|
|
68621
68625
|
display: "flex",
|
|
68622
|
-
visibility:
|
|
68623
|
-
opacity:
|
|
68624
|
-
translate:
|
|
68626
|
+
visibility: fe ? "visible" : "hidden",
|
|
68627
|
+
opacity: fe ? "1" : "0",
|
|
68628
|
+
translate: fe ? "0 0" : "0 100%",
|
|
68625
68629
|
flexDirection: "column",
|
|
68626
68630
|
alignItems: "center",
|
|
68627
|
-
border: `0.5px solid ${
|
|
68628
|
-
borderRadius:
|
|
68629
|
-
boxShadow:
|
|
68630
|
-
transition: "all " +
|
|
68631
|
-
color:
|
|
68631
|
+
border: `0.5px solid ${te}`,
|
|
68632
|
+
borderRadius: De,
|
|
68633
|
+
boxShadow: ie,
|
|
68634
|
+
transition: "all " + ne,
|
|
68635
|
+
color: k,
|
|
68632
68636
|
fontSize: `${14 + (n - 1)}px`,
|
|
68633
68637
|
lineHeight: `${(14 + (n - 1)) * 1.7}px`
|
|
68634
68638
|
},
|
|
68635
68639
|
children: [/* @__PURE__ */ (0, Fq.jsx)(jq.Provider, {
|
|
68636
68640
|
value: {
|
|
68637
68641
|
onClickDisplaySize: i,
|
|
68638
|
-
onChangeDisplayMode: () =>
|
|
68639
|
-
maximized:
|
|
68640
|
-
onClose: () =>
|
|
68642
|
+
onChangeDisplayMode: () => ye(!pe),
|
|
68643
|
+
maximized: pe,
|
|
68644
|
+
onClose: () => ve(!fe),
|
|
68641
68645
|
onClickNewChat: f,
|
|
68642
68646
|
withLocale: x
|
|
68643
68647
|
},
|
|
@@ -68646,16 +68650,16 @@ var rV, iV, Bpe = o((() => {
|
|
|
68646
68650
|
style: {
|
|
68647
68651
|
opacity: "0.5",
|
|
68648
68652
|
flexShrink: 0,
|
|
68649
|
-
color:
|
|
68650
|
-
paddingBottom:
|
|
68653
|
+
color: He ? Ve : void 0,
|
|
68654
|
+
paddingBottom: j,
|
|
68651
68655
|
width: "100%",
|
|
68652
68656
|
textAlign: "center",
|
|
68653
|
-
borderBottomLeftRadius:
|
|
68654
|
-
borderBottomRightRadius:
|
|
68657
|
+
borderBottomLeftRadius: De,
|
|
68658
|
+
borderBottomRightRadius: De
|
|
68655
68659
|
},
|
|
68656
68660
|
children: /* @__PURE__ */ (0, Fq.jsx)("span", {
|
|
68657
68661
|
style: { fontSize: "0.7em" },
|
|
68658
|
-
children:
|
|
68662
|
+
children: Ue ? g({ id: "chat-privacy-notice" }, { 0: C ? /* @__PURE__ */ (0, Fq.jsx)(mH, {
|
|
68659
68663
|
href: C,
|
|
68660
68664
|
target: "_blank",
|
|
68661
68665
|
rel: "noopener noreferrer",
|
|
@@ -68677,25 +68681,27 @@ var rV, iV, Bpe = o((() => {
|
|
|
68677
68681
|
})
|
|
68678
68682
|
})]
|
|
68679
68683
|
}), /* @__PURE__ */ (0, Fq.jsx)(YV, {
|
|
68680
|
-
type:
|
|
68681
|
-
isLoading:
|
|
68682
|
-
isOpen:
|
|
68684
|
+
type: Oe,
|
|
68685
|
+
isLoading: E,
|
|
68686
|
+
isOpen: fe,
|
|
68683
68687
|
onClickButton: () => {
|
|
68684
|
-
|
|
68688
|
+
ve(!fe);
|
|
68685
68689
|
},
|
|
68686
68690
|
hasChatUserMessages: l,
|
|
68687
68691
|
userMessages: u,
|
|
68688
|
-
isCustomTarget:
|
|
68689
|
-
|
|
68690
|
-
|
|
68692
|
+
isCustomTarget: se,
|
|
68693
|
+
zIndex: he,
|
|
68694
|
+
placement: Pe,
|
|
68695
|
+
quickActions: O ? b : [],
|
|
68696
|
+
onClickQuickAction: be,
|
|
68691
68697
|
onMessages: (e) => {
|
|
68692
|
-
a(e),
|
|
68698
|
+
a(e), ve(!0);
|
|
68693
68699
|
},
|
|
68694
68700
|
sendMessage: (e) => {
|
|
68695
|
-
o(e),
|
|
68701
|
+
o(e), ve(!0);
|
|
68696
68702
|
},
|
|
68697
68703
|
onClickCall: () => {
|
|
68698
|
-
m ||
|
|
68704
|
+
m || ve(!0), p();
|
|
68699
68705
|
},
|
|
68700
68706
|
callIsConnected: m,
|
|
68701
68707
|
callIsConnecting: h
|
|
@@ -85038,7 +85044,7 @@ var x4, S4, ike, ake, C4, oke, ske, w4, T4, cke, Q, E4, D4, O4, k4, A4, j4, M4,
|
|
|
85038
85044
|
return (async () => {
|
|
85039
85045
|
h(void 0), d(void 0);
|
|
85040
85046
|
try {
|
|
85041
|
-
let { servers: r } = n(), i = e.serverId ? r?.[e.serverId] : void 0, a = JSON.stringify({
|
|
85047
|
+
let { servers: r } = await n(), i = e.serverId ? r?.[e.serverId] : void 0, a = JSON.stringify({
|
|
85042
85048
|
resourceUri: e.resourceUri,
|
|
85043
85049
|
resourceToken: e.resourceToken,
|
|
85044
85050
|
serverId: e.serverId,
|
|
@@ -85117,7 +85123,7 @@ var x4, S4, ike, ake, C4, oke, ske, w4, T4, cke, Q, E4, D4, O4, k4, A4, j4, M4,
|
|
|
85117
85123
|
serverResources: { listChanged: !1 },
|
|
85118
85124
|
serverTools: { listChanged: !1 }
|
|
85119
85125
|
}), []), A = (0, m9.useCallback)(async (t) => {
|
|
85120
|
-
let { servers: r } = n(), i = await fetch(`${Ul}/mcp-app-resource`, {
|
|
85126
|
+
let { servers: r } = await n(), i = await fetch(`${Ul}/mcp-app-resource`, {
|
|
85121
85127
|
method: "POST",
|
|
85122
85128
|
headers: { "Content-Type": "application/json" },
|
|
85123
85129
|
body: JSON.stringify({
|
|
@@ -85195,7 +85201,7 @@ var x4, S4, ike, ake, C4, oke, ske, w4, T4, cke, Q, E4, D4, O4, k4, A4, j4, M4,
|
|
|
85195
85201
|
};
|
|
85196
85202
|
})), C9, w9, T9, Nje, Pje, Fje = o((() => {
|
|
85197
85203
|
C9 = /* @__PURE__ */ u(m(), 1), yA(), gV(), zl(), SV(), EV(), m(), Hq(), Mje(), w9 = nn(), T9 = ({ message: e, style: t = {}, sendMessage: n, onClickKnowledges: r, withTextAnimation: i = !1, onTextAnimate: a }) => {
|
|
85198
|
-
let { formatMessage: o } = cA(), s = Nje(e.content), c = e.mcpApps || [], {
|
|
85204
|
+
let { formatMessage: o } = cA(), s = Nje(e.content), c = e.mcpApps || [], { config: l } = ql(), { withSources: u, consent: d } = l, f = gu(d), { config: { entityId: p } } = Kl(), { entityId: m } = xu(), h = e.reactions?.find((e) => e.entityId === m)?.emotion, [g, _] = (0, C9.useState)(h), [v, y] = (0, C9.useState)(!1);
|
|
85199
85205
|
(0, C9.useEffect)(() => _(h), [h]);
|
|
85200
85206
|
let b = async (t) => {
|
|
85201
85207
|
if (!m || v) return;
|
|
@@ -86549,7 +86555,7 @@ var Y9, aMe = o((() => {
|
|
|
86549
86555
|
//#endregion
|
|
86550
86556
|
//#region src/App.tsx
|
|
86551
86557
|
function oMe() {
|
|
86552
|
-
let { config: { entityId: e, withContextualAssist: t, withConsent: n, withDisplaySize: r, displayMode: i } } = Kl(), { entityId: a } = xu(), { target: o, widgetId: s,
|
|
86558
|
+
let { config: { entityId: e, withContextualAssist: t, withConsent: n, withDisplaySize: r, displayMode: i } } = Kl(), { entityId: a } = xu(), { target: o, widgetId: s, config: c } = ql(), l = c.consent, u = gu(l), d = c.displayMode || i, f = c.widgetId;
|
|
86553
86559
|
return !e || !a || s && !d ? null : /* @__PURE__ */ (0, Z9.jsx)(sMe, {
|
|
86554
86560
|
thingEntityId: e,
|
|
86555
86561
|
authEntityId: a,
|
|
@@ -86562,7 +86568,7 @@ function oMe() {
|
|
|
86562
86568
|
}, `${e}.${a}.${o || "default"}.${f || "default"}.${u.functional}`);
|
|
86563
86569
|
}
|
|
86564
86570
|
function sMe({ thingEntityId: e, authEntityId: t, canStore: n, chatTtlDays: r, withContextualAssist: i, withConsent: a, withDisplaySize: o, displayMode: s }) {
|
|
86565
|
-
let { formatMessage: c } = cA(), { target: l,
|
|
86571
|
+
let { formatMessage: c } = cA(), { target: l, config: u } = ql(), { session: d, sessionKey: f, setSession: p } = Yl(e, t, l, u.widgetId, n), { chatId: m, setChatId: h } = Ql(f, n, r), g = u.chat?.textChatId || m || d.chat?.textChatId, [_, v] = (0, X9.useState)(1), y = g || s === "bar" ? "text" : "start", [b, x] = (0, X9.useState)(y);
|
|
86566
86572
|
(0, X9.useLayoutEffect)(() => {
|
|
86567
86573
|
x((e) => e || y);
|
|
86568
86574
|
}, [y]);
|
|
@@ -86677,7 +86683,7 @@ function sMe({ thingEntityId: e, authEntityId: t, canStore: n, chatTtlDays: r, w
|
|
|
86677
86683
|
});
|
|
86678
86684
|
let R = () => {
|
|
86679
86685
|
x("call"), j ? A() : te();
|
|
86680
|
-
}, ve = (0, X9.useMemo)(() => [t, e].filter(Boolean), [t, e]), ye = o === !1 ? void 0 : () => v((e) => e === 5 ? 1 : e + 1), be = s === "widget" || s === "widget-maximized" || s === "overlay" || s === "overlay-maximized" || s === "bar" || s === "bar-maximized", [xe, Se] = (0, X9.useState)(u
|
|
86686
|
+
}, ve = (0, X9.useMemo)(() => [t, e].filter(Boolean), [t, e]), ye = o === !1 ? void 0 : () => v((e) => e === 5 ? 1 : e + 1), be = s === "widget" || s === "widget-maximized" || s === "overlay" || s === "overlay-maximized" || s === "bar" || s === "bar-maximized", [xe, Se] = (0, X9.useState)(u.isOpen ?? d.isOpen ?? !1);
|
|
86681
86687
|
return be ? /* @__PURE__ */ (0, Z9.jsx)(Iq, {
|
|
86682
86688
|
canStore: n,
|
|
86683
86689
|
mode: b,
|