@developer.notchatbot/webchat 1.7.1 → 2.1.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/README.md +2 -0
- package/dist/components/ChatBot.d.ts +3 -4
- package/dist/components/ContactCapture.d.ts +7 -0
- package/dist/components/MessageActions.d.ts +8 -0
- package/dist/components/MessageAlertSettings.d.ts +5 -0
- package/dist/components/MessageSelectionActions.d.ts +4 -0
- package/dist/components/ReplyQuote.d.ts +8 -0
- package/dist/components/UnreadMessagePreview.d.ts +15 -0
- package/dist/components/embedchat/EmbedChat.d.ts +6 -2
- package/dist/config/endpoints.d.ts +0 -5
- package/dist/hooks/useMessageAlerts.d.ts +11 -0
- package/dist/hooks/useMessageGesture.d.ts +14 -0
- package/dist/hooks/useTeamAvailability.d.ts +2 -0
- package/dist/hooks/useVisitorChat.d.ts +48 -0
- package/dist/types.d.ts +86 -14
- package/dist/utils/cart-model.d.ts +23 -0
- package/dist/utils/contact-link.d.ts +2 -0
- package/dist/utils/convex.d.ts +2 -3
- package/dist/utils/markdown.d.ts +2 -0
- package/dist/utils/message-alerts.d.ts +15 -0
- package/dist/utils/message-colors.d.ts +3 -0
- package/dist/utils/message-id.d.ts +2 -0
- package/dist/utils/phone.d.ts +16 -0
- package/dist/utils/shopify-attribution.d.ts +12 -0
- package/dist/utils/storefront-cart.d.ts +6 -0
- package/dist/utils/storefront-identity.d.ts +23 -0
- package/dist/utils/tiendanube-attribution.d.ts +8 -0
- package/dist/utils/transcript.d.ts +23 -0
- package/dist/utils/visitor-presence.d.ts +30 -0
- package/dist/utils/visitor-session.d.ts +31 -0
- package/dist/utils/vtex-attribution.d.ts +13 -0
- package/dist/webchat-bundle.min.js +8707 -5192
- package/dist/webchat-bundle.min.umd.cjs +81 -55
- package/package.json +8 -4
- package/dist/components/ConversationRating.d.ts +0 -7
- package/dist/utils/notchatbot-cookie.d.ts +0 -32
- package/dist/utils/survey.d.ts +0 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@developer.notchatbot/webchat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A beautiful React chatbot widget with single-file bundle",
|
|
5
5
|
"main": "dist/webchat-bundle.min.umd.cjs",
|
|
6
6
|
"module": "dist/webchat-bundle.min.js",
|
|
@@ -11,16 +11,17 @@
|
|
|
11
11
|
],
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
14
15
|
"import": "./dist/webchat-bundle.min.js",
|
|
15
|
-
"require": "./dist/webchat-bundle.min.umd.cjs"
|
|
16
|
-
"types": "./dist/index.d.ts"
|
|
16
|
+
"require": "./dist/webchat-bundle.min.umd.cjs"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"dev": "vite",
|
|
21
21
|
"build": "tsc && vite build",
|
|
22
22
|
"preview": "vite preview",
|
|
23
|
-
"test": "node --test tests/*.test.mjs"
|
|
23
|
+
"test": "node --test tests/*.test.mjs",
|
|
24
|
+
"sandbox": "node sandbox/start.mjs"
|
|
24
25
|
},
|
|
25
26
|
"keywords": [
|
|
26
27
|
"chatbot",
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
"@types/react-dom": "^18.2.18",
|
|
40
41
|
"@vitejs/plugin-react": "^4.2.1",
|
|
41
42
|
"autoprefixer": "^10.4.16",
|
|
43
|
+
"jsdom": "^29.1.1",
|
|
42
44
|
"postcss": "^8.4.32",
|
|
43
45
|
"tailwindcss": "^3.4.0",
|
|
44
46
|
"typescript": "^5.3.3",
|
|
@@ -47,6 +49,8 @@
|
|
|
47
49
|
},
|
|
48
50
|
"dependencies": {
|
|
49
51
|
"convex": "^1.27.3",
|
|
52
|
+
"dompurify": "^3.4.15",
|
|
53
|
+
"libphonenumber-js": "^1.13.12",
|
|
50
54
|
"marked": "^15.0.12",
|
|
51
55
|
"react": "^18.2.0",
|
|
52
56
|
"react-dom": "^18.2.0"
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export interface NotChatbotCookieData {
|
|
2
|
-
conversationId: string;
|
|
3
|
-
conversationStarted: boolean;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Get the notchatbot cookie data, creating it if it doesn't exist
|
|
7
|
-
*/
|
|
8
|
-
export declare function getNotChatbotCookie(): NotChatbotCookieData;
|
|
9
|
-
/**
|
|
10
|
-
* Set the notchatbot cookie with specified data
|
|
11
|
-
*/
|
|
12
|
-
export declare function setNotChatbotCookie(data: NotChatbotCookieData): void;
|
|
13
|
-
/**
|
|
14
|
-
* Update the conversationStarted flag in the cookie
|
|
15
|
-
*/
|
|
16
|
-
export declare function setConversationStarted(started: boolean): NotChatbotCookieData;
|
|
17
|
-
/**
|
|
18
|
-
* Get current conversation ID from the cookie
|
|
19
|
-
*/
|
|
20
|
-
export declare function getConversationId(): string;
|
|
21
|
-
/**
|
|
22
|
-
* Check if conversation has been started
|
|
23
|
-
*/
|
|
24
|
-
export declare function isConversationStarted(): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Reset the conversation by creating a new conversation ID and setting conversationStarted to false
|
|
27
|
-
*/
|
|
28
|
-
export declare function resetConversation(): NotChatbotCookieData;
|
|
29
|
-
/**
|
|
30
|
-
* Delete the notchatbot cookie
|
|
31
|
-
*/
|
|
32
|
-
export declare function deleteNotChatbotCookie(): void;
|
package/dist/utils/survey.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Message } from '../types';
|
|
2
|
-
/** Legacy hardcoded threshold, used when the backend does not send one. */
|
|
3
|
-
export declare const DEFAULT_SURVEY_AFTER_USER_MESSAGES = 2;
|
|
4
|
-
/**
|
|
5
|
-
* Resolves the configured auto-survey threshold.
|
|
6
|
-
* Falls back to the default when the backend does not expose the field yet
|
|
7
|
-
* or sends something unusable (non-number, NaN, zero/negative).
|
|
8
|
-
*/
|
|
9
|
-
export declare const resolveSurveyThreshold: (value: unknown) => number;
|
|
10
|
-
/** Counts only messages sent by the end user (bot/employee ones don't count). */
|
|
11
|
-
export declare const countUserMessages: (messages: Message[]) => number;
|
|
12
|
-
/**
|
|
13
|
-
* Whether the survey should auto-open because the user reached the
|
|
14
|
-
* configured message threshold. Never true for already rated conversations.
|
|
15
|
-
*/
|
|
16
|
-
export declare const shouldAutoShowSurvey: (messages: Message[], surveyAfterUserMessages: number | undefined, isRated: boolean) => boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Whether a manual survey request (`webchatSurveyRequestedAt`, a timestamp
|
|
19
|
-
* written by an agent from Livechat) is a new, still unhandled trigger.
|
|
20
|
-
* Comparing against the last handled value — not just presence — keeps
|
|
21
|
-
* re-renders and Convex reconnections from re-opening the survey for the
|
|
22
|
-
* same request, while a fresh timestamp triggers it again.
|
|
23
|
-
*
|
|
24
|
-
* Deliberately NOT gated on `isRated`: a manual request fired after a rating
|
|
25
|
-
* re-opens the survey so the agent can re-validate the experience (the new
|
|
26
|
-
* rating overwrites the previous one server-side). Stale requests can't leak
|
|
27
|
-
* across reloads because the backend clears `webchatSurveyRequestedAt` when a
|
|
28
|
-
* rating is submitted — a present timestamp is always a pending ask.
|
|
29
|
-
*/
|
|
30
|
-
export declare const isNewSurveyRequest: (requestedAt: number | undefined, lastHandledRequestedAt: number | undefined) => boolean;
|