@v-tilt/browser 1.12.0 → 1.13.1

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.
Files changed (109) hide show
  1. package/dist/all-external-dependencies.js.map +1 -1
  2. package/dist/array.chat.js +2 -0
  3. package/dist/array.chat.js.map +1 -0
  4. package/dist/array.chat.no-external.js +2 -0
  5. package/dist/array.chat.no-external.js.map +1 -0
  6. package/dist/array.full.chat.js +2 -0
  7. package/dist/array.full.chat.js.map +1 -0
  8. package/dist/array.full.chat.no-external.js +2 -0
  9. package/dist/array.full.chat.no-external.js.map +1 -0
  10. package/dist/array.full.js +1 -1
  11. package/dist/array.full.js.map +1 -1
  12. package/dist/array.full.no-external.js +2 -0
  13. package/dist/array.full.no-external.js.map +1 -0
  14. package/dist/array.js +1 -1
  15. package/dist/array.js.map +1 -1
  16. package/dist/array.no-external.js +1 -1
  17. package/dist/array.no-external.js.map +1 -1
  18. package/dist/chat.js +1 -1
  19. package/dist/chat.js.map +1 -1
  20. package/dist/entrypoints/all-external-dependencies.d.ts +10 -3
  21. package/dist/entrypoints/array.chat.d.ts +10 -0
  22. package/dist/entrypoints/array.chat.no-external.d.ts +6 -0
  23. package/dist/entrypoints/array.full.chat.d.ts +13 -0
  24. package/dist/entrypoints/array.full.chat.no-external.d.ts +7 -0
  25. package/dist/entrypoints/array.full.d.ts +5 -9
  26. package/dist/entrypoints/array.full.no-external.d.ts +12 -0
  27. package/dist/entrypoints/module.chat.es.d.ts +7 -0
  28. package/dist/entrypoints/module.full.chat.es.d.ts +12 -0
  29. package/dist/entrypoints/module.full.es.d.ts +12 -0
  30. package/dist/entrypoints/module.no-external.es.d.ts +1 -0
  31. package/dist/extensions/chat/bubble-drag.d.ts +20 -5
  32. package/dist/extensions/chat/chat-wrapper.d.ts +8 -2
  33. package/dist/extensions/chat/chat.d.ts +21 -221
  34. package/dist/extensions/chat/controller/__tests__/fakes/ably-realtime-fake.d.ts +84 -0
  35. package/dist/extensions/chat/controller/ably-client.d.ts +160 -0
  36. package/dist/extensions/chat/controller/ably-handlers.d.ts +95 -0
  37. package/dist/extensions/chat/controller/ably-token.d.ts +67 -0
  38. package/dist/extensions/chat/controller/chat-controller.d.ts +194 -0
  39. package/dist/extensions/chat/controller/message-delivery-status.d.ts +6 -0
  40. package/dist/extensions/chat/controller/message-order.d.ts +12 -0
  41. package/dist/extensions/chat/controller/message-stream.d.ts +49 -0
  42. package/dist/extensions/chat/lib/bubble-offset.d.ts +18 -0
  43. package/dist/extensions/chat/lib/merge-chat-config.d.ts +3 -0
  44. package/dist/extensions/chat/normalize-send-content.d.ts +2 -0
  45. package/dist/extensions/chat/outbox/message-delivery.d.ts +17 -0
  46. package/dist/extensions/chat/outbox/message-outbox.d.ts +57 -0
  47. package/dist/extensions/chat/store/chat-store.d.ts +122 -0
  48. package/dist/extensions/chat/types.d.ts +1 -19
  49. package/dist/extensions/chat/ui/ChannelItem.d.ts +12 -0
  50. package/dist/extensions/chat/ui/ChannelListView.d.ts +14 -0
  51. package/dist/extensions/chat/ui/ChatBubble.d.ts +14 -0
  52. package/dist/extensions/chat/ui/ChatHeader.d.ts +13 -0
  53. package/dist/extensions/chat/ui/ChatPanel.d.ts +14 -0
  54. package/dist/extensions/chat/ui/ChatRoot.d.ts +31 -0
  55. package/dist/extensions/chat/ui/ClosedBanner.d.ts +7 -0
  56. package/dist/extensions/chat/ui/ConnectionBanner.d.ts +32 -0
  57. package/dist/extensions/chat/ui/ConversationView.d.ts +14 -0
  58. package/dist/extensions/chat/ui/MessageBubble.d.ts +25 -0
  59. package/dist/extensions/chat/ui/MessageInput.d.ts +14 -0
  60. package/dist/extensions/chat/ui/MessageList.d.ts +19 -0
  61. package/dist/extensions/chat/ui/NewMessagesPill.d.ts +13 -0
  62. package/dist/extensions/chat/ui/Skeletons.d.ts +14 -0
  63. package/dist/extensions/chat/ui/TypingBubble.d.ts +23 -0
  64. package/dist/extensions/chat/ui/TypingIndicator.d.ts +12 -0
  65. package/dist/extensions/chat/ui/WidgetSlot.d.ts +20 -0
  66. package/dist/extensions/chat/ui/hooks/use-auto-mark-read.d.ts +18 -0
  67. package/dist/extensions/chat/ui/hooks/use-scroll-preservation.d.ts +33 -0
  68. package/dist/extensions/chat/ui/icons.d.ts +18 -0
  69. package/dist/extensions/chat/ui/message-render.d.ts +18 -0
  70. package/dist/extensions/chat/ui/shadow-styles.d.ts +13 -0
  71. package/dist/extensions/chat/ui/utils/mobile-body-scroll-lock.d.ts +14 -0
  72. package/dist/extensions/chat/widget-registry.d.ts +21 -5
  73. package/dist/extensions/chat/widgets/collect-email.d.ts +4 -2
  74. package/dist/extensions/chat/widgets/escalate-to-human.d.ts +2 -1
  75. package/dist/external-scripts-loader.js +1 -1
  76. package/dist/external-scripts-loader.js.map +1 -1
  77. package/dist/feature.d.ts +1 -0
  78. package/dist/lib/merge-vtilt-config.d.ts +9 -0
  79. package/dist/main.js +1 -1
  80. package/dist/main.js.map +1 -1
  81. package/dist/module.chat.d.ts +1788 -0
  82. package/dist/module.chat.js +2 -0
  83. package/dist/module.chat.js.map +1 -0
  84. package/dist/module.d.ts +48 -3
  85. package/dist/module.full.chat.d.ts +1792 -0
  86. package/dist/module.full.chat.js +2 -0
  87. package/dist/module.full.chat.js.map +1 -0
  88. package/dist/module.full.d.ts +1793 -0
  89. package/dist/module.full.js +2 -0
  90. package/dist/module.full.js.map +1 -0
  91. package/dist/module.js +1 -1
  92. package/dist/module.js.map +1 -1
  93. package/dist/module.no-external.d.ts +48 -3
  94. package/dist/module.no-external.js +1 -1
  95. package/dist/module.no-external.js.map +1 -1
  96. package/dist/recorder.js.map +1 -1
  97. package/dist/snippet-stub-methods.d.ts +14 -0
  98. package/dist/utils/globals.d.ts +53 -27
  99. package/dist/utils/index.d.ts +8 -0
  100. package/dist/vtilt.d.ts +6 -1
  101. package/dist/web-vitals.js.map +1 -1
  102. package/package.json +4 -1
  103. package/dist/extensions/chat/chat-styles.d.ts +0 -27
  104. package/dist/extensions/chat/message-content-styles.d.ts +0 -1
  105. package/dist/extensions/chat/message-html.d.ts +0 -6
  106. package/dist/extensions/chat/message-markdown.d.ts +0 -8
  107. package/dist/extensions/ga4-proxy.d.ts +0 -59
  108. package/dist/utils/type-utils.d.ts +0 -4
  109. package/dist/web-vitals.d.ts +0 -81
package/dist/module.d.ts CHANGED
@@ -37,6 +37,25 @@ interface SendChatMessageOptions {
37
37
  * `markdown` and `html` use the same sanitized rendering as AI/agent messages.
38
38
  */
39
39
  format?: "text" | "markdown" | "html";
40
+ /**
41
+ * Marks the message as automatically injected by your site (form submit, CTA,
42
+ * etc.) rather than typed by the visitor in the widget. Stored on the message
43
+ * as `message_source` metadata so the AI can respond appropriately — e.g.
44
+ * `source: "landing_form"`. Slug-like: letters, numbers, `_`, `-`, max 64 chars.
45
+ */
46
+ source?: string;
47
+ }
48
+ /**
49
+ * Pixel inset of the chat bubble from the viewport edges.
50
+ * Use to clear host floating buttons, cookie banners, or mobile tab bars.
51
+ */
52
+ interface BubbleOffset {
53
+ /** Distance from the bottom edge (default: 20) */
54
+ bottom?: number;
55
+ /** Distance from the right edge when `position` is `bottom-right` (default: 20) */
56
+ right?: number;
57
+ /** Distance from the left edge when `position` is `bottom-left` (default: 20) */
58
+ left?: number;
40
59
  }
41
60
  /**
42
61
  * Chat bubble appearance and behavior configuration
@@ -46,6 +65,12 @@ interface BubbleConfig {
46
65
  draggable?: boolean;
47
66
  /** Show the bubble on load (default: true). Set to false to control via vt.chat.show() */
48
67
  visible?: boolean;
68
+ /**
69
+ * Viewport inset in pixels. Prefer this over custom CSS so positioning
70
+ * survives widget UI updates. Pass `null` in `vt.updateConfig({ chat: { bubble: { offset: null } } })` to reset
71
+ * to SDK defaults (20px).
72
+ */
73
+ offset?: BubbleOffset | null;
49
74
  }
50
75
 
51
76
  /**
@@ -1664,7 +1689,7 @@ declare class VTilt {
1664
1689
  * Send a chat message. By default uses the active conversation; pass options to
1665
1690
  * start a new conversation, target a channel, or open the widget panel.
1666
1691
  */
1667
- sendChatMessage(content: SendChatMessageContent, options?: SendChatMessageOptions): void;
1692
+ sendChatMessage(content: SendChatMessageContent, options?: SendChatMessageOptions): Promise<void>;
1668
1693
  /**
1669
1694
  * Raw `gtag(...)` passthrough. Queues calls made before the feature is
1670
1695
  * enabled or before `gtag.js` has loaded, flushed FIFO once ready. Safe
@@ -1710,6 +1735,11 @@ declare class VTilt {
1710
1735
  getDistinctId(): string;
1711
1736
  getAnonymousId(): string;
1712
1737
  toString(): string;
1738
+ /**
1739
+ * Merge a partial config patch into the live SDK config and notify all features.
1740
+ * Use for any post-`init()` change (autocapture, `chat`, persistence, etc.).
1741
+ * Top-level keys shallow-merge; nested `chat` deep-merges.
1742
+ */
1713
1743
  updateConfig(config: Partial<VTiltConfig>): void;
1714
1744
  buildUrl(): string;
1715
1745
  buildEndpointUrl(path: string): string;
@@ -1733,7 +1763,22 @@ declare class VTilt {
1733
1763
  _dom_loaded(): void;
1734
1764
  }
1735
1765
 
1766
+ /**
1767
+ * Method names registered on the inline `window.vt` stub before `array.js` loads.
1768
+ *
1769
+ * npm / ESM imports (`import { vt } from '@v-tilt/browser'`) do **not** use this
1770
+ * list — `vt` is the real SDK instance. Only the HTML snippet's loader IIFE
1771
+ * needs these names so calls queue in `window.vt._i` until the bundle loads.
1772
+ *
1773
+ * When adding a new public `vt.*` method that integrators may call before
1774
+ * `init()` completes, append it here and update public install docs.
1775
+ */
1776
+ declare const VTILT_SNIPPET_STUB_METHOD_NAMES: readonly ["init", "capture", "identify", "setUserProperties", "resetUser", "getUserIdentity", "getDeviceId", "getUserState", "alias", "getConfig", "getSessionId", "updateConfig", "setConsent", "on", "once", "off", "startAutocapture", "stopAutocapture", "startSessionRecording", "stopSessionRecording", "openChat", "closeChat", "toggleChat", "showChat", "hideChat", "sendChatMessage", "gtag", "setGoogleUserData"];
1777
+ /** Space-separated stub method string for the minified install snippet. */
1778
+ declare const VTILT_SNIPPET_STUB_METHODS: string;
1779
+ type VtiltSnippetStubMethodName = (typeof VTILT_SNIPPET_STUB_METHOD_NAMES)[number];
1780
+
1736
1781
  declare const vt: VTilt;
1737
1782
 
1738
- export { ALL_WEB_VITALS_METRICS, DEFAULT_WEB_VITALS_METRICS, VTilt, vt as default, vt };
1739
- export type { AutocaptureOptions, CaptureOptions, CapturePerformanceConfig, CaptureResult, ChatWidgetConfig, EventPayload, FeatureFlagsConfig, GeolocationData, GoogleAdsConversionMapping, GoogleConsentOverride, GoogleConsentValue, GoogleTagClientConfig, GoogleTagEventMapping, GoogleTagParamMapping, GoogleTagProxyMode, GroupsConfig, IdentityUpdate, PersistenceMethod, Properties, Property, PropertyOperations, RemoteConfig, RequestOptions, SessionData, SessionIdChangedCallback, SessionRecordingMaskInputOptions, SessionRecordingOptions, SupportedWebVitalsMetric, TrackingEvent, UserIdentity, UserProperties, VTiltConfig, WebVitalMetric };
1783
+ export { ALL_WEB_VITALS_METRICS, DEFAULT_WEB_VITALS_METRICS, VTILT_SNIPPET_STUB_METHODS, VTILT_SNIPPET_STUB_METHOD_NAMES, VTilt, vt as default, vt };
1784
+ export type { AutocaptureOptions, CaptureOptions, CapturePerformanceConfig, CaptureResult, ChatWidgetConfig, EventPayload, FeatureFlagsConfig, GeolocationData, GoogleAdsConversionMapping, GoogleConsentOverride, GoogleConsentValue, GoogleTagClientConfig, GoogleTagEventMapping, GoogleTagParamMapping, GoogleTagProxyMode, GroupsConfig, IdentityUpdate, PersistenceMethod, Properties, Property, PropertyOperations, RemoteConfig, RequestOptions, SessionData, SessionIdChangedCallback, SessionRecordingMaskInputOptions, SessionRecordingOptions, SupportedWebVitalsMetric, TrackingEvent, UserIdentity, UserProperties, VTiltConfig, VtiltSnippetStubMethodName, WebVitalMetric };