@moveo-ai/web-client 0.114.0 → 0.115.1-true.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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @moveo-ai/web-client v0.114.0
3
+ * @moveo-ai/web-client v0.115.1-true.1
4
4
  * Copyright (c) Moveo.ai (TM)
5
5
  *
6
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moveo-ai/web-client",
3
- "version": "0.114.0",
3
+ "version": "0.115.1-true.1",
4
4
  "description": "Client side library to load the moveo chat widget and connect it with your agent",
5
5
  "main": "dist/web-client.min.js",
6
6
  "types": "web-client.d.ts",
@@ -13,7 +13,7 @@
13
13
  "lint": "npm run lint:js && npm run lint:css",
14
14
  "lint:js": "eslint .",
15
15
  "lint:css": "npx stylelint \"{src,test}/**/*.css\"",
16
- "prepare": "npm run build",
16
+ "prepare": "node scripts/prepare.mjs",
17
17
  "prettier": "prettier --write \"{src,test}/**/*.{ts,tsx,css,json}\"",
18
18
  "setup:certs": "node scripts/setup-certs.mjs",
19
19
  "start": "webpack serve",
package/web-client.d.ts CHANGED
@@ -18,6 +18,7 @@ export type AnalyticsEventName =
18
18
  | 'close_opening_message_click'
19
19
  | 'teaser_quick_reply_clicked'
20
20
  | 'teaser_composer_submitted'
21
+ | 'section_not_found'
21
22
  | 'download_conversation_clicked'
22
23
  | 'restart_conversation_clicked'
23
24
  | 'session_start'
@@ -84,20 +85,24 @@ export type Context = {
84
85
  /** Normalized before sending: trimmed, transliterated, deduplicated. */
85
86
  tags?: string[];
86
87
  /**
87
- * Host-page identity (`qm_*`, `client_*`) is shipped by the widget when
88
+ * Host-page identity, shipped as plain context vars when
88
89
  * `feature_flags.fiserv_web_activity` is on. `qm_session_id` comes from the
89
- * in-frame session replay, never the host page.
90
+ * in-frame session replay, never the host page. `null` on `qm_subscription`
91
+ * and `qm_user_id` is the opt-out tombstone.
90
92
  */
93
+ qm_partner_id?: string;
94
+ qm_client_id?: string;
95
+ qm_config_id?: string;
96
+ qm_page_template?: string;
97
+ qm_subscription?: string | null;
98
+ qm_user_id?: string | null;
99
+ qm_session_id?: string;
100
+ /** The walk (`client_*`) and the widget's own page fields. Nothing vendor-specific. */
91
101
  global?: {
92
102
  client_url?: string;
93
103
  ref?: string;
94
104
  disclaimer_accepted?: boolean;
95
105
  visitor_form_completed?: boolean;
96
- qm_partner_id?: string;
97
- qm_client_id?: string;
98
- qm_config_id?: string;
99
- qm_page_template?: string;
100
- qm_session_id?: string;
101
106
  client_path?: string;
102
107
  client_journey?: string;
103
108
  [key: string]: unknown;
@@ -108,12 +113,20 @@ export type Context = {
108
113
  export interface WidgetController {
109
114
  openWindow(): void;
110
115
  closeWindow(): void;
111
- /** Ends the conversation; the widget hides unless `hide` is `false`. */
116
+ /**
117
+ * Ends the conversation; the widget hides unless `hide` is `false`. Any
118
+ * context update still queued is sent first.
119
+ */
112
120
  closeConversation(options: { hide?: boolean }): void;
113
121
  /** Sends `text` into the conversation as the visitor. */
114
122
  sendMessage(message: { text: string }): void;
115
123
  /** Shows the teaser bubble, with the configured message when none is given. */
116
124
  showTeaserMessage(message?: string): void;
125
+ /**
126
+ * Merges `context` into the conversation. Calls inside a 300 ms window
127
+ * coalesce into one update; arrays replace the stored value. A call made
128
+ * before a conversation exists is held until the session opens.
129
+ */
117
130
  updateContext(context: Context): void;
118
131
  /** Overrides widget theme variables, e.g. `{ '--color-accent': '#f00' }`. */
119
132
  setCSSVariables(variables: Record<string, string>): void;
@@ -166,6 +179,31 @@ export type TeaserConfig =
166
179
  /** Launcher only. */
167
180
  | { variant: 'none' };
168
181
 
182
+ /**
183
+ * One `sections[]` entry: a teaser, plus the part of the page it belongs to.
184
+ *
185
+ * A section is chosen at runtime by what the visitor is looking at, not by its
186
+ * position in the list, so the order here is presentational. The loader walks
187
+ * `match` in order and observes the first selector that matches anything on
188
+ * the page; durability is decided when the list is authored, by putting the
189
+ * strongest anchor first and a positional fallback last.
190
+ */
191
+ export type TeaserSection = TeaserConfig & {
192
+ /**
193
+ * Authored, and stable across a reorder of the list — it names the section
194
+ * in analytics, so deriving it from the position would break the history
195
+ * whenever someone moved a row.
196
+ */
197
+ id: string;
198
+ /**
199
+ * CSS selectors, strongest first. The first that matches wins, and a
200
+ * selector matching several elements resolves to the first in document
201
+ * order. Nothing but a selector is ever tried: no heading text, no CMS
202
+ * awareness.
203
+ */
204
+ match: string[];
205
+ };
206
+
169
207
  /**
170
208
  * One `pages[]` entry: a teaser, plus the URL it belongs to.
171
209
  *
@@ -173,7 +211,16 @@ export type TeaserConfig =
173
211
  * host page's URL, compared case-insensitively. Nothing is escaped and nothing
174
212
  * is compiled, so a stray `.` or `(` cannot change what matches or throw.
175
213
  */
176
- export type TeaserPage = TeaserConfig & { url: string };
214
+ export type TeaserPage = TeaserConfig & {
215
+ url: string;
216
+ /** Authored name for the page, so analytics can refer to it by more than its URL hint. */
217
+ id?: string | null;
218
+ /**
219
+ * A different teaser per part of this page. The section with the largest
220
+ * visible share of the viewport wins; none in view falls back to this entry.
221
+ */
222
+ sections?: TeaserSection[] | null;
223
+ };
177
224
 
178
225
  /**
179
226
  * The `teaser` block: the teaser the visitor gets, and optionally a different