@sonordev/site-kit 7.1.2 → 7.3.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/AGENTS.md +1 -1
- package/CHANGELOG.md +60 -0
- package/README.md +9 -8
- package/agent-manifest.json +17 -7
- package/dist/{AnalyticsProvider-ZB33W6MC.js → AnalyticsProvider-DJQA66AG.js} +4 -4
- package/dist/{ArticleViewTracker-GMHYLLLZ.js → ArticleViewTracker-GFOAXFV7.js} +3 -3
- package/dist/{BlocksPopup-EA6LYL25.js → BlocksPopup-AHDU34TL.js} +5 -5
- package/dist/ChatWidget-FHBAHFZX.js +17 -0
- package/dist/{FileField-QKA3JB2Q.js → FileField-J5W5MIAZ.js} +3 -3
- package/dist/{FormSpotlight-AQTIA5TP.js → FormSpotlight-PE5YZBFZ.js} +20 -6
- package/dist/{FormStage-FDTLTP3B.js → FormStage-OOPQC27J.js} +27 -7
- package/dist/ManagedForm-JRZAJ7SZ.js +16 -0
- package/dist/{ManagedNewsletterForm-J6QSAGGP.js → ManagedNewsletterForm-TC5542ZG.js} +7 -5
- package/dist/{SignalCore-JZNXOLNT.js → SignalCore-2YP5FCAS.js} +3 -3
- package/dist/SiteChat-EGEZJJVV.js +5 -0
- package/dist/{SiteDesignReporter-W4EJUSTE.js → SiteDesignReporter-YEEWJKWN.js} +5 -5
- package/dist/SitePopups-LQBIXIFV.js +10 -0
- package/dist/SitemapSync-LSZ2EYOF.js +8 -0
- package/dist/_client/booking-widget.js +5 -5
- package/dist/affiliates/index.js +3 -3
- package/dist/analytics/index.js +4 -4
- package/dist/analytics/send-gate.d.ts +1 -1
- package/dist/articles/index.js +2 -2
- package/dist/articles/server-ui.js +3 -2
- package/dist/articles/server.js +2 -1
- package/dist/{engage → chat}/ChatWidget.d.ts +7 -6
- package/dist/{engage → chat}/EchoUiActions.d.ts +1 -1
- package/dist/chat/SiteChat.d.ts +25 -0
- package/dist/{engage → chat}/brand-color.d.ts +1 -1
- package/dist/{engage → chat}/chat-messages.d.ts +1 -1
- package/dist/{engage → chat}/echo-config.d.ts +1 -1
- package/dist/chat/index.d.ts +10 -6
- package/dist/chat/index.js +14 -8
- package/dist/{engage → chat}/launcher-placement.d.ts +1 -7
- package/dist/{engage → chat}/socket-loader.d.ts +2 -2
- package/dist/chat/types.d.ts +136 -0
- package/dist/chunk-27FISYK4.js +4 -0
- package/dist/{chunk-HF57LG73.js → chunk-2AD3CDRR.js} +43 -29
- package/dist/{chunk-M3YEPKP7.js → chunk-2ECWEUHP.js} +1 -1
- package/dist/{chunk-LUXVWITO.js → chunk-4NTBQNHA.js} +247 -78
- package/dist/{chunk-AH5Q262S.js → chunk-56KNHB4U.js} +1 -1
- package/dist/{chunk-GLHQ3LRO.js → chunk-6U3VLV2C.js} +1 -1
- package/dist/{chunk-3SDOQUUF.js → chunk-BEBR4OJD.js} +2 -2
- package/dist/{chunk-JSZN6LDZ.js → chunk-BF7TZYC3.js} +38 -31
- package/dist/{chunk-AQSNPZY4.js → chunk-C2FZBUSS.js} +80 -1
- package/dist/{chunk-PHYMNUJU.js → chunk-CYUFBKJQ.js} +1 -1
- package/dist/{chunk-6WIQCXOO.js → chunk-DNPNYWVL.js} +1 -1
- package/dist/{chunk-V6FDQLR7.js → chunk-EPT6FJUY.js} +53 -21
- package/dist/chunk-HODO5BX5.js +28 -0
- package/dist/chunk-HW7B43E5.js +14 -0
- package/dist/{chunk-PGMVL4AB.js → chunk-I2YX3HVD.js} +2 -2
- package/dist/{chunk-JTU2GOM4.js → chunk-L7U23XI2.js} +18 -6
- package/dist/{chunk-YEMPUQVU.js → chunk-MKMD2HJW.js} +2 -2
- package/dist/{chunk-Q4W23JYM.js → chunk-MRQ2U4LZ.js} +1 -1
- package/dist/chunk-MVR4FY5R.js +187 -0
- package/dist/{chunk-VGH4MDTU.js → chunk-NI2XNEMR.js} +1 -1
- package/dist/{chunk-4Y5FWDPM.js → chunk-NZ4RXN3G.js} +55 -7
- package/dist/{chunk-RHNWA34F.js → chunk-O5RGXTWU.js} +41 -7
- package/dist/{chunk-TXBAOEKG.js → chunk-PKGN32AU.js} +5 -4
- package/dist/chunk-Q6E4OPGG.js +40 -0
- package/dist/chunk-RDPW4D33.js +45 -0
- package/dist/{chunk-UXOGCKL6.js → chunk-T4DLETKR.js} +1 -1
- package/dist/{chunk-NK4CSJNP.js → chunk-UPRSH6Q4.js} +2 -2
- package/dist/{chunk-ERXXITG4.js → chunk-VF4F5WXZ.js} +1 -1
- package/dist/chunk-VWWITFWM.js +300 -0
- package/dist/{chunk-WWSHFRDL.js → chunk-WDQB4OXY.js} +7 -3
- package/dist/{chunk-VDF5DFWT.js → chunk-WGG6GTKW.js} +1 -1
- package/dist/{chunk-CSTQDNGK.js → chunk-WGIDC6QP.js} +43 -24
- package/dist/{chunk-V3PUVBME.js → chunk-XLSQTTUE.js} +2 -4
- package/dist/{chunk-JBE46QJZ.js → chunk-Y6LP36UW.js} +1 -1
- package/dist/chunk-YJLS6JBI.js +370 -0
- package/dist/{chunk-QEDHRBAT.js → chunk-Z65DHMTW.js} +26 -9
- package/dist/{chunk-ILU5I6RW.js → chunk-ZHS2XFLV.js} +1 -1
- package/dist/{chunk-D5EC5KVO.js → chunk-ZKHI4E2B.js} +2 -2
- package/dist/{chunk-CIG5UL2S.js → chunk-ZTLMPUO6.js} +3 -2
- package/dist/client/index.js +3 -3
- package/dist/commerce/index.js +4 -4
- package/dist/contracts/color.d.ts +1 -1
- package/dist/contracts/entries.d.ts +1 -1
- package/dist/contracts/error-page.d.ts +183 -0
- package/dist/contracts/llms.d.ts +1 -0
- package/dist/contracts/proposal-sitemap.d.ts +130 -0
- package/dist/contracts/schema-placeholders.d.ts +87 -0
- package/dist/engage/EngageWidget.d.ts +13 -12
- package/dist/engage/index.d.ts +10 -9
- package/dist/engage/index.js +31 -35
- package/dist/engage/types.d.ts +19 -244
- package/dist/fleet/FleetHeartbeat.d.ts +1 -1
- package/dist/fleet/index.js +4 -4
- package/dist/forms/FormEnhancer.d.ts +25 -12
- package/dist/forms/ServerForm.d.ts +11 -10
- package/dist/forms/StaticForm.d.ts +3 -1
- package/dist/forms/field-autocomplete.d.ts +28 -0
- package/dist/forms/form-dom-values.d.ts +42 -0
- package/dist/forms/index.js +11 -9
- package/dist/forms/server.js +6 -4
- package/dist/forms/static.js +3 -2
- package/dist/forms/submitForm.d.ts +8 -1
- package/dist/forms/types.d.ts +41 -2
- package/dist/forms/useForm.d.ts +21 -4
- package/dist/forms/webmcp.d.ts +38 -0
- package/dist/images/index.js +4 -4
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -1
- package/dist/layout/SiteKitClientProviders.d.ts +3 -3
- package/dist/layout/SiteKitLayout.d.ts +4 -4
- package/dist/layout/client.d.ts +3 -3
- package/dist/layout/client.js +7 -7
- package/dist/layout/index.js +8 -8
- package/dist/layout/types.d.ts +5 -4
- package/dist/llms/agent-access.d.ts +4 -0
- package/dist/llms/contract.js +1 -1
- package/dist/llms/index.js +6 -6
- package/dist/maps/index.js +3 -3
- package/dist/mcp/WebMcpTools.d.ts +5 -4
- package/dist/mcp/client.js +14 -7
- package/dist/mcp/discovery.d.ts +48 -0
- package/dist/mcp/handlers.d.ts +13 -7
- package/dist/mcp/index.d.ts +5 -3
- package/dist/mcp/index.js +62 -30
- package/dist/mcp/serverCard.d.ts +6 -7
- package/dist/mcp/sonor.js +14 -11
- package/dist/revalidate/index.js +2 -2
- package/dist/seo/client.js +4 -4
- package/dist/seo/index.js +15 -8
- package/dist/seo/llms/contract.js +1 -1
- package/dist/seo/llms.js +6 -6
- package/dist/seo/register-sitemap-cli.js +1 -1
- package/dist/seo/sitemap.js +4 -4
- package/dist/server/index.js +2 -2
- package/dist/shared/dialog.d.ts +27 -0
- package/dist/shared/identity.d.ts +1 -1
- package/dist/shared/layers.d.ts +7 -0
- package/dist/shared/mid-form.d.ts +53 -0
- package/dist/shared/reporting-gate.d.ts +1 -1
- package/dist/shared/version.d.ts +1 -1
- package/dist/shared/visual-viewport-gap.d.ts +1 -1
- package/dist/signal/index.js +2 -2
- package/dist/signal/types.d.ts +1 -1
- package/dist/sitemap/index.js +4 -4
- package/dist/{socket-loader-R24ZSRSQ.js → socket-loader-CGIPEG74.js} +1 -1
- package/dist/sync/index.js +5 -5
- package/dist/types.d.ts +3 -1
- package/dist/{web-vitals.attribution-GD6LGLVF.js → web-vitals.attribution-N2PCCF4Q.js} +1 -1
- package/dist/website/BlocksPopup.d.ts +1 -1
- package/dist/website/PopupBlocks.d.ts +5 -2
- package/dist/website/SitePopups.d.ts +25 -0
- package/dist/website/images.js +4 -4
- package/dist/website/index.js +6 -6
- package/dist/website/popup-rules.d.ts +46 -0
- package/dist/website/popup-types.d.ts +113 -0
- package/dist/website/popups.d.ts +2 -6
- package/dist/website/popups.js +6 -14
- package/dist/{writeLLMsTxt-G3JBNBC5.js → writeLLMsTxt-2NQVDGYI.js} +3 -3
- package/docs/MIGRATING-TO-7.md +41 -9
- package/docs.json +2 -1
- package/package.json +2 -2
- package/src/analytics/README.md +2 -2
- package/src/articles/README.md +4 -1
- package/src/{engage → chat}/README.md +63 -62
- package/src/forms/README.md +49 -3
- package/src/layout/README.md +8 -5
- package/src/llms/README.md +69 -0
- package/src/mcp/README.md +50 -16
- package/src/seo/README.md +3 -1
- package/src/sync/README.md +10 -0
- package/src/website/README.md +133 -0
- package/dist/ChatWidget-UCDWMWCW.js +0 -15
- package/dist/EngageWidget-7ZYSK4GE.js +0 -11
- package/dist/ManagedForm-H7BVAH2W.js +0 -14
- package/dist/SitemapSync-XBANGKHZ.js +0 -8
- package/dist/chunk-NDF4A5JM.js +0 -37
- package/dist/chunk-VLARKWZU.js +0 -100
- package/dist/chunk-YCJT4JJG.js +0 -837
- package/dist/engage/DesignRenderer.d.ts +0 -57
- package/dist/engage/element-rules.d.ts +0 -38
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @sonordev/site-kit/
|
|
2
|
+
* @sonordev/site-kit/chat - Chat Widget (Redesigned)
|
|
3
3
|
*
|
|
4
4
|
* Features:
|
|
5
5
|
* - Pulls brand colors (primary/secondary) + business info from project settings via API
|
|
@@ -63,9 +63,9 @@ interface WidgetConfigFromApi {
|
|
|
63
63
|
* Whether Echo belongs on this site, given the project's widget config.
|
|
64
64
|
*
|
|
65
65
|
* Sonor decides this and sends it as `is_enabled` on `GET /engage/widget/config`:
|
|
66
|
-
* the
|
|
67
|
-
* settings counts as on) and the project's
|
|
68
|
-
* server-side. Only an explicit `false` hides
|
|
66
|
+
* the "Show the chat widget" switch (Messages → Chat settings; a project that
|
|
67
|
+
* never saved chat settings counts as on) and the project's Website chat
|
|
68
|
+
* module (Project Settings), resolved once server-side. Only an explicit `false` hides
|
|
69
69
|
* Echo, which also keeps an API that predates the field showing it. `null`
|
|
70
70
|
* means the config hasn't arrived or couldn't be fetched, and the chat can't
|
|
71
71
|
* run without it either.
|
|
@@ -85,8 +85,9 @@ interface EchoChatProps extends ChatWidgetProps {
|
|
|
85
85
|
/**
|
|
86
86
|
* Echo itself, mounted by ChatWidget once the project's config says chat is
|
|
87
87
|
* on. Exported for the launcher tests, which render it with a resolved config
|
|
88
|
-
* because the package's vitest has no DOM to run ChatWidget's fetch in.
|
|
89
|
-
*
|
|
88
|
+
* because the package's vitest has no DOM to run ChatWidget's fetch in.
|
|
89
|
+
* `@sonordev/site-kit/chat` re-exports it, but a site should mount ChatWidget
|
|
90
|
+
* (or SiteChat), which fetches the config and follows the project's switch.
|
|
90
91
|
*/
|
|
91
92
|
export declare function EchoChat({ projectId, widgetConfig, config, apiUrl: propApiUrl, signalUrl: propSignalUrl, suggested_questions: propSuggestedQuestions, assistant_name: propAssistantName, welcome_message: propWelcomeMessage, assistant_avatar: propAssistantAvatar }: EchoChatProps): React.JSX.Element;
|
|
92
93
|
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sonordev/site-kit/chat - SiteChat: the Website chat a site shows
|
|
3
|
+
* (Sonor → Messages).
|
|
4
|
+
*
|
|
5
|
+
* Echo's launcher, mounted once the browser is idle. SiteKitLayout mounts it
|
|
6
|
+
* for you (its `chat` prop); mount it yourself only on a site without
|
|
7
|
+
* SiteKitLayout. ChatWidget, its markdown renderer and its socket download
|
|
8
|
+
* when it first renders, never with the page. It shows only while the
|
|
9
|
+
* project's chat is switched on in Sonor (see ChatWidget's isChatEnabled).
|
|
10
|
+
*/
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import type { ChatLauncherPlacement } from './types';
|
|
13
|
+
import { type AnalyticsGateOptions } from '../shared/reporting-gate';
|
|
14
|
+
export interface SiteChatProps extends ChatLauncherPlacement, AnalyticsGateOptions {
|
|
15
|
+
apiUrl?: string;
|
|
16
|
+
apiKey?: string;
|
|
17
|
+
/** For chat routing. Resolved from the API key when absent. */
|
|
18
|
+
projectId?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Same gate as analytics (frames, localhost, a key to send with): a chat
|
|
22
|
+
* launcher in a case study's device frame would talk to the agency's visitor,
|
|
23
|
+
* not this site's.
|
|
24
|
+
*/
|
|
25
|
+
export declare function SiteChat(props: SiteChatProps): React.JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @sonordev/site-kit/
|
|
2
|
+
* @sonordev/site-kit/chat — Echo's transcript: message shapes and turns
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for what ChatWidget adds to the transcript when a
|
|
5
5
|
* visitor speaks, and for the one AI turn every send path goes through.
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
* @sonordev/site-kit/chat — Website chat (Sonor → Messages).
|
|
3
3
|
*
|
|
4
4
|
* The chat launcher and Echo conversation a site shows. SiteKitLayout mounts
|
|
5
|
-
* it for you (its `chat` prop
|
|
6
|
-
*
|
|
5
|
+
* it for you (its `chat` prop); `SiteChat` places it yourself the same way
|
|
6
|
+
* (idle-deferred, gated like analytics), and `ChatWidget` is the widget
|
|
7
|
+
* itself. `@sonordev/site-kit/engage` (deprecated) re-exports these.
|
|
7
8
|
*/
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export
|
|
11
|
-
export type {
|
|
9
|
+
export { SiteChat, type SiteChatProps } from './SiteChat';
|
|
10
|
+
export { ChatWidget, EchoChat, isChatEnabled } from './ChatWidget';
|
|
11
|
+
export { chatLauncherStyles, DEFAULT_LAUNCHER_OFFSET_BOTTOM } from './launcher-placement';
|
|
12
|
+
export type { ChatLauncherStyles } from './launcher-placement';
|
|
13
|
+
export { SONOR_PUBLIC_ECHO_DEFAULTS, getEchoWidgetProps } from './echo-config';
|
|
14
|
+
export type { EchoPublicConfig } from './echo-config';
|
|
15
|
+
export type { ChatAvailability, ChatConfig, ChatConversation, ChatLauncherPlacement, ChatLauncherPosition, ChatMessage, UiAction, UiActionType, } from './types';
|
package/dist/chat/index.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export {
|
|
2
|
+
export { SONOR_PUBLIC_ECHO_DEFAULTS, getEchoWidgetProps } from '../chunk-HODO5BX5.js';
|
|
3
|
+
export { ChatWidget, DEFAULT_LAUNCHER_OFFSET_BOTTOM, EchoChat, chatLauncherStyles, isChatEnabled } from '../chunk-O5RGXTWU.js';
|
|
4
|
+
export { SiteChat } from '../chunk-RDPW4D33.js';
|
|
5
5
|
import '../chunk-6T6CQVNL.js';
|
|
6
|
-
import '../chunk-
|
|
7
|
-
import '../chunk-
|
|
6
|
+
import '../chunk-JE4A5S4F.js';
|
|
7
|
+
import '../chunk-27FISYK4.js';
|
|
8
|
+
import '../chunk-EPT6FJUY.js';
|
|
9
|
+
import '../chunk-Q6E4OPGG.js';
|
|
10
|
+
import '../chunk-C2FZBUSS.js';
|
|
8
11
|
import '../chunk-5SQK3D53.js';
|
|
12
|
+
import '../chunk-HW7B43E5.js';
|
|
9
13
|
import '../chunk-NJCTQH2P.js';
|
|
10
14
|
import '../chunk-S22FSH7C.js';
|
|
11
15
|
import '../chunk-L2V5PUFN.js';
|
|
12
16
|
import '../chunk-GJWI74ZZ.js';
|
|
13
|
-
import '../chunk-
|
|
14
|
-
import '../chunk-
|
|
15
|
-
import '../chunk-
|
|
17
|
+
import '../chunk-43OCZ3JA.js';
|
|
18
|
+
import '../chunk-EKBEOXTH.js';
|
|
19
|
+
import '../chunk-BEBR4OJD.js';
|
|
20
|
+
import '../chunk-WGG6GTKW.js';
|
|
21
|
+
import '../chunk-56KNHB4U.js';
|
|
16
22
|
import '../chunk-PKBMQBKP.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @sonordev/site-kit/
|
|
2
|
+
* @sonordev/site-kit/chat - Chat launcher placement
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for where the Echo launcher sits and, derived from
|
|
5
5
|
* it, where the chat popup opens, on screen and in the stacking order.
|
|
@@ -14,12 +14,6 @@ import type { CSSProperties } from 'react';
|
|
|
14
14
|
import type { ChatLauncherPlacement } from './types';
|
|
15
15
|
/** Launcher clearance above the bottom edge when a site sets nothing. */
|
|
16
16
|
export declare const DEFAULT_LAUNCHER_OFFSET_BOTTOM = "20px";
|
|
17
|
-
/**
|
|
18
|
-
* Layer everything Engage renders stacks on when a site sets nothing:
|
|
19
|
-
* popups, nudges, bars and the chat launcher, with the chat popup one below.
|
|
20
|
-
* EngageWidget's default comes from here too.
|
|
21
|
-
*/
|
|
22
|
-
export declare const DEFAULT_ENGAGE_Z_INDEX = 9999;
|
|
23
17
|
/**
|
|
24
18
|
* Custom property a stylesheet can set to move the launcher. Wins over the
|
|
25
19
|
* `offsetBottom` option. Deliberately never declared by the kit: a property
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Socket } from 'socket.io-client';
|
|
2
2
|
/**
|
|
3
3
|
* Lazy socket.io loader — kept in a separate file so bundlers
|
|
4
|
-
* (Turbopack, webpack) never pull socket.io-client into the
|
|
5
|
-
*
|
|
4
|
+
* (Turbopack, webpack) never pull socket.io-client into the chat
|
|
5
|
+
* chunk. Only loaded when the user actually opens the chat.
|
|
6
6
|
*
|
|
7
7
|
* This module owns site-kit's entire socket.io surface. If you are wondering
|
|
8
8
|
* why package.json declares `engine.io-client` and `socket.io-parser` when
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sonordev/site-kit/chat: Website chat types (Sonor → Messages).
|
|
3
|
+
*/
|
|
4
|
+
/** The corner the Echo chat launcher sits in. */
|
|
5
|
+
export type ChatLauncherPosition = 'bottom-right' | 'bottom-left';
|
|
6
|
+
/**
|
|
7
|
+
* Where the Echo chat launcher sits, including the layer it stacks on. The
|
|
8
|
+
* single definition of launcher placement: the layout's `chat` config,
|
|
9
|
+
* SiteChat's props and ChatConfig all extend it, so a new placement option is
|
|
10
|
+
* added once. ChatWidget turns it into styles through `chatLauncherStyles`
|
|
11
|
+
* (./launcher-placement).
|
|
12
|
+
*/
|
|
13
|
+
export interface ChatLauncherPlacement {
|
|
14
|
+
/** Corner. Default: 'bottom-right' */
|
|
15
|
+
position?: ChatLauncherPosition;
|
|
16
|
+
/**
|
|
17
|
+
* Distance from the bottom of the viewport to the launcher, as any CSS
|
|
18
|
+
* length (`'88px'`, `'5.5rem'`, `'calc(4rem + 8px)'`). A number is pixels.
|
|
19
|
+
* Default: `'20px'`.
|
|
20
|
+
*
|
|
21
|
+
* The device's safe-area inset is added on top, so pass the clearance you
|
|
22
|
+
* want above your own UI, not the inset. The chat popup opens above the
|
|
23
|
+
* launcher wherever this puts it.
|
|
24
|
+
*
|
|
25
|
+
* A `--sk-echo-offset-bottom` custom property set anywhere above the
|
|
26
|
+
* launcher (`:root`, `body`, a media query, a `:has()` rule) wins over this
|
|
27
|
+
* value. Use that when the offset depends on the page or the breakpoint,
|
|
28
|
+
* such as clearing a sticky bar that only some pages render.
|
|
29
|
+
*/
|
|
30
|
+
offsetBottom?: string | number;
|
|
31
|
+
/**
|
|
32
|
+
* Stacking layer. The launcher sits on it and the chat popup one layer
|
|
33
|
+
* beneath. Default: 9999.
|
|
34
|
+
*
|
|
35
|
+
* Through SiteKitLayout the same number also stacks popups, banners and
|
|
36
|
+
* toasts, so everything a site's widgets render shares one layer. Lower it
|
|
37
|
+
* when the site's own fixed UI (a mobile menu, a cookie banner) has to
|
|
38
|
+
* cover the chat.
|
|
39
|
+
*/
|
|
40
|
+
zIndex?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface ChatConfig extends ChatLauncherPlacement {
|
|
43
|
+
/** Widget position */
|
|
44
|
+
position: ChatLauncherPosition;
|
|
45
|
+
/** Widget appearance */
|
|
46
|
+
buttonIcon?: 'chat' | 'help' | 'custom';
|
|
47
|
+
buttonColor?: string;
|
|
48
|
+
buttonText?: string;
|
|
49
|
+
/** Brand primary color */
|
|
50
|
+
brandPrimary?: string;
|
|
51
|
+
/** Welcome message */
|
|
52
|
+
welcomeMessage?: string;
|
|
53
|
+
/** Operating hours */
|
|
54
|
+
operatingHours?: {
|
|
55
|
+
enabled: boolean;
|
|
56
|
+
timezone: string;
|
|
57
|
+
hours: {
|
|
58
|
+
[day: number]: {
|
|
59
|
+
start: string;
|
|
60
|
+
end: string;
|
|
61
|
+
} | null;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/** AI vs Live Chat */
|
|
65
|
+
mode: 'ai' | 'live' | 'hybrid';
|
|
66
|
+
/** AI settings (if mode is 'ai' or 'hybrid') */
|
|
67
|
+
aiSettings?: {
|
|
68
|
+
skillId?: string;
|
|
69
|
+
handoffToLive?: boolean;
|
|
70
|
+
handoffKeywords?: string[];
|
|
71
|
+
/** When AI should suggest handoff based on sentiment or keywords */
|
|
72
|
+
handoffTriggers?: {
|
|
73
|
+
negativesentiment?: boolean;
|
|
74
|
+
keywords?: string[];
|
|
75
|
+
afterMessages?: number;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/** Offline mode settings (when no agents available) */
|
|
79
|
+
offlineMode?: 'form' | 'ai' | 'message';
|
|
80
|
+
/** Form slug to show when offline (defaults to 'contact') */
|
|
81
|
+
offlineFormSlug?: string;
|
|
82
|
+
/** AI fallback when no agents online (hybrid mode) */
|
|
83
|
+
aiFallbackEnabled?: boolean;
|
|
84
|
+
/** Custom offline message */
|
|
85
|
+
offlineMessage?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* UI actions the visitor Echo endpoint (POST /echo/public/chat) may return on
|
|
89
|
+
* the JSON response alongside `content` / `conversationId`. The chat widget
|
|
90
|
+
* renders each as an inline card or chip beneath the assistant message.
|
|
91
|
+
*
|
|
92
|
+
* This mirrors the shape Echo's endpoint sends. It is a LOCAL contract on
|
|
93
|
+
* purpose: the kit never imports from the API.
|
|
94
|
+
*
|
|
95
|
+
* - `show_form` → data.formSlug (+ optional data.prefill) — offer the managed form inline.
|
|
96
|
+
* - `suggest_action` → data.action + data.message — clickable chip (send message or navigate).
|
|
97
|
+
* - `show_portfolio_item` → data.slug — the generic widget ignores it (a site's own chat UI handles it).
|
|
98
|
+
*/
|
|
99
|
+
export type UiActionType = 'show_form' | 'suggest_action' | 'show_portfolio_item';
|
|
100
|
+
export interface UiAction {
|
|
101
|
+
type: UiActionType | string;
|
|
102
|
+
data: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
export interface ChatMessage {
|
|
105
|
+
id: string;
|
|
106
|
+
conversation_id: string;
|
|
107
|
+
role: 'user' | 'assistant' | 'agent' | 'system';
|
|
108
|
+
content: string;
|
|
109
|
+
metadata?: Record<string, unknown>;
|
|
110
|
+
created_at: string;
|
|
111
|
+
/** Name of the agent (for agent messages) */
|
|
112
|
+
sender_name?: string;
|
|
113
|
+
/** Avatar URL of the agent */
|
|
114
|
+
sender_avatar?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface ChatConversation {
|
|
117
|
+
id: string;
|
|
118
|
+
project_id: string;
|
|
119
|
+
visitor_id: string;
|
|
120
|
+
status: 'active' | 'ai' | 'pending_handoff' | 'human' | 'closed';
|
|
121
|
+
assigned_to?: string;
|
|
122
|
+
last_message_at: string;
|
|
123
|
+
created_at: string;
|
|
124
|
+
/** AI summary of the conversation */
|
|
125
|
+
ai_summary?: string;
|
|
126
|
+
/** Visitor info */
|
|
127
|
+
visitor_name?: string;
|
|
128
|
+
visitor_email?: string;
|
|
129
|
+
}
|
|
130
|
+
/** Availability status returned by the widget API */
|
|
131
|
+
export interface ChatAvailability {
|
|
132
|
+
available: boolean;
|
|
133
|
+
mode: 'live' | 'ai' | 'offline';
|
|
134
|
+
agentsOnline: number;
|
|
135
|
+
operatingHoursActive: boolean;
|
|
136
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { SITE_EDIT_PARAM } from './chunk-6G43IRWR.js';
|
|
3
|
-
import { publishSiteCredential } from './chunk-
|
|
4
|
-
import { FleetHeartbeat } from './chunk-
|
|
5
|
-
import { SignalBridge } from './chunk-
|
|
3
|
+
import { publishSiteCredential } from './chunk-VF4F5WXZ.js';
|
|
4
|
+
import { FleetHeartbeat } from './chunk-UPRSH6Q4.js';
|
|
5
|
+
import { SignalBridge } from './chunk-CYUFBKJQ.js';
|
|
6
6
|
import { useDeferredActivation } from './chunk-YC7ELZS3.js';
|
|
7
7
|
import { resolveSiteHost } from './chunk-FESKKJAS.js';
|
|
8
8
|
import { getOrCreateVisitorId, getOrCreateSessionId } from './chunk-24QZEO3Q.js';
|
|
@@ -33,19 +33,23 @@ function startEditBridge() {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
var LazyAnalyticsProvider = dynamic(
|
|
36
|
-
() => import('./AnalyticsProvider-
|
|
36
|
+
() => import('./AnalyticsProvider-DJQA66AG.js').then((m) => ({ default: m.AnalyticsProvider })),
|
|
37
37
|
{ ssr: false }
|
|
38
38
|
);
|
|
39
|
-
var
|
|
40
|
-
() => import('./
|
|
39
|
+
var LazySiteChat = dynamic(
|
|
40
|
+
() => import('./SiteChat-EGEZJJVV.js').then((m) => ({ default: m.SiteChat })),
|
|
41
|
+
{ ssr: false }
|
|
42
|
+
);
|
|
43
|
+
var LazySitePopups = dynamic(
|
|
44
|
+
() => import('./SitePopups-LQBIXIFV.js').then((m) => ({ default: m.SitePopups })),
|
|
41
45
|
{ ssr: false }
|
|
42
46
|
);
|
|
43
47
|
var LazySiteDesignReporter = dynamic(
|
|
44
|
-
() => import('./SiteDesignReporter-
|
|
48
|
+
() => import('./SiteDesignReporter-YEEWJKWN.js').then((m) => ({ default: m.SiteDesignReporter })),
|
|
45
49
|
{ ssr: false }
|
|
46
50
|
);
|
|
47
51
|
var LazySitemapSync = dynamic(
|
|
48
|
-
() => import('./SitemapSync-
|
|
52
|
+
() => import('./SitemapSync-LSZ2EYOF.js').then((m) => ({ default: m.SitemapSync })),
|
|
49
53
|
{ ssr: false }
|
|
50
54
|
);
|
|
51
55
|
function SiteKitClientProviders({
|
|
@@ -121,30 +125,40 @@ function SiteKitClientProviders({
|
|
|
121
125
|
) }) }, "sk-analytics")
|
|
122
126
|
);
|
|
123
127
|
}
|
|
124
|
-
const
|
|
128
|
+
const launcher = {
|
|
129
|
+
...typeof engage === "object" ? engage : {},
|
|
130
|
+
...typeof chat === "object" ? chat : {}
|
|
131
|
+
};
|
|
132
|
+
const chatOn = engage !== false && chat !== false && launcher.chatEnabled !== false;
|
|
125
133
|
const popupsOn = engage !== false && popups !== false;
|
|
126
134
|
if (chatOn || popupsOn) {
|
|
127
|
-
const
|
|
128
|
-
...typeof engage === "object" ? engage : {},
|
|
129
|
-
...typeof chat === "object" ? chat : {}
|
|
130
|
-
};
|
|
131
|
-
const engageInFrame = engageConfig.allowInFrame === true;
|
|
135
|
+
const shown = modulesReady && (launcher.allowInFrame === true || !isCrossOriginFrame());
|
|
132
136
|
siblings.push(
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
137
|
+
/* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
138
|
+
shown && popupsOn && /* @__PURE__ */ jsx(
|
|
139
|
+
LazySitePopups,
|
|
140
|
+
{
|
|
141
|
+
apiUrl,
|
|
142
|
+
apiKey,
|
|
143
|
+
allowInFrame: analyticsConfig.allowInFrame === true,
|
|
144
|
+
allowLocalhost: analyticsConfig.allowLocalhost === true,
|
|
145
|
+
zIndex: launcher.zIndex
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
shown && chatOn && /* @__PURE__ */ jsx(
|
|
149
|
+
LazySiteChat,
|
|
150
|
+
{
|
|
151
|
+
apiUrl,
|
|
152
|
+
apiKey,
|
|
153
|
+
projectId,
|
|
154
|
+
allowInFrame: analyticsConfig.allowInFrame === true,
|
|
155
|
+
allowLocalhost: analyticsConfig.allowLocalhost === true,
|
|
156
|
+
position: launcher.position || "bottom-right",
|
|
157
|
+
offsetBottom: launcher.offsetBottom,
|
|
158
|
+
zIndex: launcher.zIndex
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
] }, "sk-widgets")
|
|
148
162
|
);
|
|
149
163
|
}
|
|
150
164
|
if (sitemapSync) {
|