@gengage/assistant-fe 0.6.48 → 0.6.50

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.
@@ -375,6 +375,7 @@ export declare const chatCatalog: {
375
375
  title: z.ZodOptional<z.ZodString>;
376
376
  children: z.ZodArray<z.ZodString>;
377
377
  }, z.core.$strip>>>;
378
+ panelTitle: z.ZodOptional<z.ZodString>;
378
379
  endOfList: z.ZodOptional<z.ZodBoolean>;
379
380
  rankingState: z.ZodOptional<z.ZodEnum<{
380
381
  pending: "pending";
@@ -395,14 +396,6 @@ export declare const chatCatalog: {
395
396
  }, z.core.$strip>;
396
397
  readonly description: "A list of highlighted customer reviews with sentiment and ratings.";
397
398
  };
398
- readonly ProsAndCons: {
399
- readonly schema: z.ZodObject<{
400
- productName: z.ZodOptional<z.ZodString>;
401
- pros: z.ZodOptional<z.ZodArray<z.ZodString>>;
402
- cons: z.ZodOptional<z.ZodArray<z.ZodString>>;
403
- }, z.core.$strip>;
404
- readonly description: "A pros and cons list for a product.";
405
- };
406
399
  readonly CategoriesContainer: {
407
400
  readonly schema: z.ZodObject<{
408
401
  groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -424,14 +417,6 @@ export declare const chatCatalog: {
424
417
  }, z.core.$strip>;
425
418
  readonly description: "Tabbed product groups with optional filter tag buttons.";
426
419
  };
427
- readonly HandoffNotice: {
428
- readonly schema: z.ZodObject<{
429
- summary: z.ZodOptional<z.ZodString>;
430
- products_discussed: z.ZodOptional<z.ZodArray<z.ZodString>>;
431
- user_sentiment: z.ZodOptional<z.ZodString>;
432
- }, z.core.$strip>;
433
- readonly description: "A notice shown when the conversation is escalated to a human agent.";
434
- };
435
420
  readonly PanelRestoreCard: {
436
421
  readonly schema: z.ZodObject<{
437
422
  eyebrow: z.ZodOptional<z.ZodString>;
@@ -86,6 +86,22 @@ export declare class GengageChat extends BaseWidget<ChatWidgetConfig> {
86
86
  private _pdpLaunched;
87
87
  private _plpLaunched;
88
88
  private _homepageLaunched;
89
+ /**
90
+ * True ONLY when this widget actually restored a non-empty thread that now owns the
91
+ * surface. When set, the generic page-context auto-launch (homepage/PLP greeting) is
92
+ * suppressed so the restored thread — and its in-flight continuation — are not
93
+ * clobbered by a "Merhaba!" welcome. See R1 (yataş store-finder nav clobber).
94
+ *
95
+ * INVARIANT (regression #1 fix): this flag is tied to ACTUAL restored on-screen
96
+ * content, never to mere restore-KEY presence. If a restore no-ops (stale/missing
97
+ * session, cross-SKU guard, IDB absent, empty thread, rejected freshness token) the
98
+ * flag stays/returns false so the NORMAL greeting/auto-launch fires — the surface is
99
+ * never left blank.
100
+ */
101
+ private _restorePending;
102
+ /** One-shot gate for an assistant-driven soft navigation update in the same document. */
103
+ private _assistantSoftNavigationPending;
104
+ private _assistantSoftNavigationTimer;
89
105
  private _entryContextPrimed;
90
106
  /** True while a silent context-prime launch (PDP/PLP/homepage) is in flight. */
91
107
  private _contextPrimingInFlight;
@@ -177,6 +193,42 @@ export declare class GengageChat extends BaseWidget<ChatWidgetConfig> {
177
193
  }): void;
178
194
  close(): void;
179
195
  saveSession(sessionId: string, sku: string): void;
196
+ /**
197
+ * Set the restore handoff marker for an assistant-driven PAGE navigation that has
198
+ * no associated product (R1, e.g. the store-finder redirect). Mirrors saveSession()
199
+ * but without a SKU — the destination is not a PDP, so there is nothing to gate the
200
+ * restore on. The restore session id alone tells the re-mounted widget "the chat
201
+ * navigated you here; restore the thread and continue, do not auto-launch a greeting".
202
+ *
203
+ * Only stamps the marker when there is a real session id to restore; otherwise it is
204
+ * a no-op (a user/site navigation should stay a fresh session).
205
+ */
206
+ saveSessionForNavigation(): void;
207
+ /** Read the persisted same-document nav sequence (0 when absent/corrupt). */
208
+ private _readNavSeq;
209
+ /**
210
+ * Stamp the freshness token onto the current restore marker: bump the nav seq and
211
+ * record it (with a timestamp) so the immediately-following mount can recognize this
212
+ * marker as fresh. Best-effort — non-fatal if sessionStorage is unavailable.
213
+ */
214
+ private _stampRestoreFreshnessToken;
215
+ /**
216
+ * True when the current restore marker was produced by the immediately-preceding
217
+ * navigation (its token's seq matches the current nav seq). A stale/stranded marker
218
+ * — or one with no/corrupt token (e.g. an empty-SKU saveSession) — is NOT fresh.
219
+ */
220
+ private _isRestoreMarkerFresh;
221
+ /**
222
+ * Clear the restore marker and its freshness token in one place — the single
223
+ * guaranteed-consume point so a marker never strands. Called on mount (onInit, after
224
+ * the freshness decision) and on any state reset (_resetForNewPage / soft-nav).
225
+ * Leaves gengage_nav_seq intact: it is the monotonic clock, not part of the marker.
226
+ */
227
+ private _clearRestoreMarker;
228
+ private _markAssistantSoftNavigationPending;
229
+ private _clearAssistantSoftNavigationPending;
230
+ private _expireAssistantSoftNavigationIfUnclaimed;
231
+ private _scheduleAssistantSoftNavigationExpiry;
180
232
  get isOpen(): boolean;
181
233
  /**
182
234
  * Register a callback for integration events (e.g. 'gengage-cart-add', 'gengage-product-favorite').
@@ -339,11 +391,29 @@ export declare class GengageChat extends BaseWidget<ChatWidgetConfig> {
339
391
  private _hasUnavailableProductContext;
340
392
  private _ensureAssistantMessageRendered;
341
393
  private _saveSessionAndOpenURL;
394
+ /**
395
+ * Assistant-driven page navigation (R1): persist the thread, stamp the restore
396
+ * handoff marker, then navigate. On the SPA re-mount the widget restores the thread
397
+ * and continues its flow — the homepage/PLP auto-launch greeting is suppressed
398
+ * (see _restorePending / _primeOpenPageContext) so the assistant's answer is not
399
+ * clobbered by a generic welcome. Same-origin only; cross-origin/new-tab callers
400
+ * keep the raw navigation since the current page (and its thread) is not replaced.
401
+ *
402
+ * The restore-key stamp is the durable "the chat initiated this navigation" marker
403
+ * across the navigation boundary — we distinguish assistant-vs-user navigation by
404
+ * WHO called this (an assistant action handler), never by inspecting the URL.
405
+ */
406
+ private _navigateAssistantDriven;
342
407
  private _loadPayload;
343
408
  /**
344
409
  * Attempt to restore chat session from IndexedDB.
345
- * Always restores when IDB has session data for the current sessionId.
410
+ * Restores when IDB has non-empty session data for the current sessionId AND an
411
+ * explicit handoff is pending.
346
412
  * Best-effort — failures are silently ignored.
413
+ *
414
+ * @returns true ONLY when a non-empty thread was actually replayed onto the surface.
415
+ * Every no-op/early-return path returns false so the caller leaves the normal
416
+ * greeting/auto-launch enabled (regression #1: never suppress launch over nothing).
347
417
  */
348
418
  private _restoreFromIndexedDB;
349
419
  /**
@@ -64,7 +64,7 @@ var h = a({
64
64
  type: o(),
65
65
  payload: e().optional()
66
66
  }).optional()
67
- }), _ = a({ suggestions: t(S) }), f = a({
67
+ }), _ = a({ suggestions: t(S) }), C = a({
68
68
  title: o().optional(),
69
69
  text: o().optional(),
70
70
  reviewCount: o().optional(),
@@ -73,7 +73,7 @@ var h = a({
73
73
  type: o(),
74
74
  payload: e().optional()
75
75
  })
76
- }), C = a({ entries: t(a({
76
+ }), f = a({ entries: t(a({
77
77
  name: o(),
78
78
  image: o().optional(),
79
79
  description: o().optional(),
@@ -174,6 +174,7 @@ var h = a({
174
174
  title: o().optional(),
175
175
  children: t(o())
176
176
  })).optional(),
177
+ panelTitle: o().optional(),
177
178
  endOfList: n().optional(),
178
179
  rankingState: r(["pending", "final"]).optional(),
179
180
  sequenceId: o().optional()
@@ -183,10 +184,6 @@ var h = a({
183
184
  review_rating: s([o(), i()]).optional(),
184
185
  review_tag: o().optional()
185
186
  }), T = a({ reviews: t(I).optional() }), R = a({
186
- productName: o().optional(),
187
- pros: t(o()).optional(),
188
- cons: t(o()).optional()
189
- }), x = a({
190
187
  groups: t(a({
191
188
  groupName: o(),
192
189
  image: o().optional(),
@@ -199,11 +196,7 @@ var h = a({
199
196
  title: o(),
200
197
  action: u.optional()
201
198
  })).optional()
202
- }), B = a({
203
- summary: o().optional(),
204
- products_discussed: t(o()).optional(),
205
- user_sentiment: o().optional()
206
- }), H = a({
199
+ }), x = a({
207
200
  eyebrow: o().optional(),
208
201
  title: o().optional(),
209
202
  showTitle: n().optional(),
@@ -215,7 +208,7 @@ var h = a({
215
208
  imageUrl: o().url().optional(),
216
209
  name: o().optional()
217
210
  })).optional()
218
- }), q = a({
211
+ }), B = a({
219
212
  summary: o(),
220
213
  strengths: t(o()).optional(),
221
214
  focus_points: t(o()).optional(),
@@ -223,13 +216,13 @@ var h = a({
223
216
  celeb_style_reason: o().optional(),
224
217
  next_question: o().optional(),
225
218
  style_images: t(o()).optional()
226
- }), G = a({
219
+ }), q = a({
227
220
  processing: n().optional(),
228
221
  title: o().optional(),
229
222
  description: o().optional(),
230
223
  upload_label: o().optional(),
231
224
  skip_label: o().optional()
232
- }), M = { components: {
225
+ }), H = { components: {
233
226
  MessageBubble: {
234
227
  schema: h,
235
228
  description: "A single chat message bubble for user or assistant turns."
@@ -263,11 +256,11 @@ var h = a({
263
256
  description: "Rich AI-curated product suggestion cards with roles, sentiment labels, scores, and review quotes."
264
257
  },
265
258
  GroundingReviewCard: {
266
- schema: f,
259
+ schema: C,
267
260
  description: "A card showing review grounding data with review count and CTA."
268
261
  },
269
262
  AIGroupingCards: {
270
- schema: C,
263
+ schema: f,
271
264
  description: "Category grouping cards with images and labels for product discovery."
272
265
  },
273
266
  AISuggestedSearchCards: {
@@ -286,31 +279,23 @@ var h = a({
286
279
  schema: T,
287
280
  description: "A list of highlighted customer reviews with sentiment and ratings."
288
281
  },
289
- ProsAndCons: {
290
- schema: R,
291
- description: "A pros and cons list for a product."
292
- },
293
282
  CategoriesContainer: {
294
- schema: x,
283
+ schema: R,
295
284
  description: "Tabbed product groups with optional filter tag buttons."
296
285
  },
297
- HandoffNotice: {
298
- schema: B,
299
- description: "A notice shown when the conversation is escalated to a human agent."
300
- },
301
286
  PanelRestoreCard: {
302
- schema: H,
287
+ schema: x,
303
288
  description: "A frontend-owned transcript card that reopens a related panel snapshot."
304
289
  },
305
290
  PhotoAnalysisCard: {
306
- schema: q,
291
+ schema: B,
307
292
  description: "Structured photo analysis card with strengths, focus points, celeb vibe, and follow-up question."
308
293
  },
309
294
  BeautyPhotoStep: {
310
- schema: G,
295
+ schema: q,
311
296
  description: "Transient selfie upload prompt for beauty consulting init flow."
312
297
  }
313
298
  } };
314
299
  export {
315
- M as t
300
+ H as t
316
301
  };
@@ -1,4 +1,4 @@
1
- import { c as e, d as t, f as r, i as s, l as n, n as i, r as l, s as C, t as c, u as d } from "./runtime-CtOsorKK.js";
1
+ import { c as e, d as t, f as r, i as s, l as n, n as i, r as l, s as C, t as c, u as d } from "./runtime-9f9SB4WE.js";
2
2
  export {
3
3
  d as CHAT_SCROLL_ELEMENT_ID,
4
4
  s as ChatPresentationState,