@developer.notchatbot/webchat 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/useVisitorChat.d.ts +2 -1
- package/dist/utils/shopify-attribution.d.ts +12 -0
- package/dist/utils/tiendanube-attribution.d.ts +8 -0
- package/dist/utils/visitor-session.d.ts +12 -0
- package/dist/utils/vtex-attribution.d.ts +13 -0
- package/dist/webchat-bundle.min.js +4978 -4756
- package/dist/webchat-bundle.min.umd.cjs +42 -42
- package/package.json +59 -58
|
@@ -18,7 +18,7 @@ interface PendingSend {
|
|
|
18
18
|
currentUrl: string;
|
|
19
19
|
}
|
|
20
20
|
/** Owns the visitor lifecycle shared by floating and embedded chat surfaces. */
|
|
21
|
-
export declare function useVisitorChat(config: WebChatConfig, isOpen: boolean): {
|
|
21
|
+
export declare function useVisitorChat(config: WebChatConfig, isOpen: boolean, awaitingReplyTimeoutMs?: number): {
|
|
22
22
|
react: (messageId: string, emoji: string | null) => Promise<boolean>;
|
|
23
23
|
teamOnline: boolean;
|
|
24
24
|
staffTypingAuthor: {
|
|
@@ -32,6 +32,7 @@ export declare function useVisitorChat(config: WebChatConfig, isOpen: boolean):
|
|
|
32
32
|
draftRevision: number;
|
|
33
33
|
messages: Message[];
|
|
34
34
|
sending: boolean;
|
|
35
|
+
awaitingReply: boolean;
|
|
35
36
|
error: string;
|
|
36
37
|
unread: boolean;
|
|
37
38
|
unreadCount: number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ShopifyAttributionReference {
|
|
2
|
+
conversationId: string;
|
|
3
|
+
expiresAt: number;
|
|
4
|
+
}
|
|
5
|
+
/** Cart API bridge. Only runs network work after engagement or for cleanup of our saved reference. */
|
|
6
|
+
export declare function observeShopifyAttribution(doc: Document, readReference: () => ShopifyAttributionReference | null, storage: {
|
|
7
|
+
read(): string | null;
|
|
8
|
+
write(value: string): void;
|
|
9
|
+
}, request?: typeof fetch): {
|
|
10
|
+
refresh: () => Promise<void>;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface AttributionReference {
|
|
2
|
+
token: string;
|
|
3
|
+
expiresAt: number;
|
|
4
|
+
}
|
|
5
|
+
/** Attach only to same-origin Tiendanube purchase forms; unrelated forms remain untouched. */
|
|
6
|
+
export declare function attachTiendanubeAttribution(doc: Document, token: string): number;
|
|
7
|
+
/** Owns field lifecycle across cart rendering; never intercepts payment or blocks navigation. */
|
|
8
|
+
export declare function observeTiendanubeAttribution(doc: Document, reference: AttributionReference, storeId: string, readPlatform: () => unknown, onRetired?: () => void): () => void;
|
|
@@ -13,6 +13,18 @@ export interface VisitorSession {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
export declare const visitorStorageKey: (uid: string, item: string) => string;
|
|
16
|
+
export declare const ORIGIN_NOT_ALLOWED_MESSAGE = "El chat no est\u00E1 disponible en este sitio.";
|
|
17
|
+
/** A distinct, identifiable failure so a catch site can surface this specific message instead of its generic one. */
|
|
18
|
+
export declare class OriginNotAllowedError extends Error {
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
/** Defensive JSON parse: a non-JSON or empty body must never crash the caller. */
|
|
22
|
+
export declare function safeParseJson(response: Response): Promise<unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Detects the server's origin-allowlist rejection (403 with `code: 'ORIGIN_NOT_ALLOWED'`).
|
|
25
|
+
* Logs a store-owner-actionable console error and reports the match; the caller decides how to fail.
|
|
26
|
+
*/
|
|
27
|
+
export declare function checkOriginNotAllowed(response: Response): Promise<boolean>;
|
|
16
28
|
/** Tenant/site-scoped storage with a stable in-memory fallback for blocked browser storage. */
|
|
17
29
|
export declare function readVisitorData(uid: string, item: string): string | null;
|
|
18
30
|
export declare function writeVisitorData(uid: string, item: string, value: string | null): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface Reference {
|
|
2
|
+
conversationId: string;
|
|
3
|
+
expiresAt: number;
|
|
4
|
+
}
|
|
5
|
+
/** Uses the store's existing vtexjs checkout transport. Configure its shared queue at integration time. */
|
|
6
|
+
export declare function observeVtexAttribution(doc: Document, readReference: () => Reference | null, storage: {
|
|
7
|
+
read(): string | null;
|
|
8
|
+
write(value: string): void;
|
|
9
|
+
}): {
|
|
10
|
+
refresh: () => Promise<void>;
|
|
11
|
+
dispose: () => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|