@oxvo/ai-live-assist 7.5.20 → 7.5.21

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 (99) hide show
  1. package/cjs/AiLiveAssist.d.ts +8 -1
  2. package/cjs/AiLiveAssist.js +113 -8
  3. package/cjs/client.d.ts +5 -3
  4. package/cjs/client.js +44 -5
  5. package/cjs/commerce/cartContracts.d.ts +158 -0
  6. package/cjs/commerce/cartContracts.js +228 -0
  7. package/cjs/commerce/cartSession.d.ts +86 -0
  8. package/cjs/commerce/cartSession.js +475 -0
  9. package/cjs/commerce/contracts.d.ts +152 -0
  10. package/cjs/commerce/contracts.js +322 -0
  11. package/cjs/commerce/pageContext.d.ts +50 -0
  12. package/cjs/commerce/pageContext.js +173 -0
  13. package/cjs/commerce/productPanel.d.ts +65 -0
  14. package/cjs/commerce/productPanel.js +662 -0
  15. package/cjs/commerce/realtimeCommerce.d.ts +73 -0
  16. package/cjs/commerce/realtimeCommerce.js +342 -0
  17. package/cjs/commerce/shopifyCart.d.ts +130 -0
  18. package/cjs/commerce/shopifyCart.js +1135 -0
  19. package/cjs/commerce/shopifyCartPresentation.d.ts +12 -0
  20. package/cjs/commerce/shopifyCartPresentation.js +379 -0
  21. package/cjs/commerce/shoppingNotes.d.ts +61 -0
  22. package/cjs/commerce/shoppingNotes.js +313 -0
  23. package/cjs/commerce/shoppingNotesView.d.ts +46 -0
  24. package/cjs/commerce/shoppingNotesView.js +269 -0
  25. package/cjs/control.d.ts +9 -1
  26. package/cjs/control.js +51 -1
  27. package/cjs/guideAdmission.d.ts +5 -2
  28. package/cjs/guideAdmission.js +21 -2
  29. package/cjs/guideInstaller.js +1 -1
  30. package/cjs/guideMeasurement.d.ts +5 -0
  31. package/cjs/guideMeasurement.js +29 -0
  32. package/cjs/guideSubjectStore.js +2 -0
  33. package/cjs/guideTypes.d.ts +18 -0
  34. package/cjs/liveControlChannel.d.ts +43 -1
  35. package/cjs/liveControlChannel.js +166 -14
  36. package/cjs/liveGuideAdmission.d.ts +3 -2
  37. package/cjs/liveGuideAdmission.js +10 -2
  38. package/cjs/liveGuideWidget.d.ts +18 -0
  39. package/cjs/liveGuideWidget.js +228 -23
  40. package/cjs/locales/resources.js +2240 -0
  41. package/cjs/messages.js +56 -0
  42. package/cjs/tabLock.d.ts +2 -0
  43. package/cjs/tabLock.js +11 -1
  44. package/cjs/types.d.ts +6 -2
  45. package/cjs/types.js +56 -0
  46. package/cjs/ui.d.ts +37 -0
  47. package/cjs/ui.js +259 -9
  48. package/cjs/version.d.ts +1 -1
  49. package/cjs/version.js +1 -1
  50. package/lib/AiLiveAssist.d.ts +8 -1
  51. package/lib/AiLiveAssist.js +113 -8
  52. package/lib/client.d.ts +5 -3
  53. package/lib/client.js +44 -5
  54. package/lib/commerce/cartContracts.d.ts +158 -0
  55. package/lib/commerce/cartContracts.js +221 -0
  56. package/lib/commerce/cartSession.d.ts +86 -0
  57. package/lib/commerce/cartSession.js +471 -0
  58. package/lib/commerce/contracts.d.ts +152 -0
  59. package/lib/commerce/contracts.js +300 -0
  60. package/lib/commerce/pageContext.d.ts +50 -0
  61. package/lib/commerce/pageContext.js +168 -0
  62. package/lib/commerce/productPanel.d.ts +65 -0
  63. package/lib/commerce/productPanel.js +657 -0
  64. package/lib/commerce/realtimeCommerce.d.ts +73 -0
  65. package/lib/commerce/realtimeCommerce.js +337 -0
  66. package/lib/commerce/shopifyCart.d.ts +130 -0
  67. package/lib/commerce/shopifyCart.js +1130 -0
  68. package/lib/commerce/shopifyCartPresentation.d.ts +12 -0
  69. package/lib/commerce/shopifyCartPresentation.js +376 -0
  70. package/lib/commerce/shoppingNotes.d.ts +61 -0
  71. package/lib/commerce/shoppingNotes.js +307 -0
  72. package/lib/commerce/shoppingNotesView.d.ts +46 -0
  73. package/lib/commerce/shoppingNotesView.js +265 -0
  74. package/lib/control.d.ts +9 -1
  75. package/lib/control.js +51 -1
  76. package/lib/guideAdmission.d.ts +5 -2
  77. package/lib/guideAdmission.js +21 -2
  78. package/lib/guideInstaller.js +1 -1
  79. package/lib/guideMeasurement.d.ts +5 -0
  80. package/lib/guideMeasurement.js +24 -0
  81. package/lib/guideSubjectStore.js +2 -0
  82. package/lib/guideTypes.d.ts +18 -0
  83. package/lib/liveControlChannel.d.ts +43 -1
  84. package/lib/liveControlChannel.js +166 -14
  85. package/lib/liveGuideAdmission.d.ts +3 -2
  86. package/lib/liveGuideAdmission.js +10 -2
  87. package/lib/liveGuideWidget.d.ts +18 -0
  88. package/lib/liveGuideWidget.js +228 -23
  89. package/lib/locales/resources.js +2240 -0
  90. package/lib/messages.js +56 -0
  91. package/lib/tabLock.d.ts +2 -0
  92. package/lib/tabLock.js +11 -1
  93. package/lib/types.d.ts +6 -2
  94. package/lib/types.js +56 -0
  95. package/lib/ui.d.ts +37 -0
  96. package/lib/ui.js +259 -9
  97. package/lib/version.d.ts +1 -1
  98. package/lib/version.js +1 -1
  99. package/package.json +1 -1
package/lib/ui.js CHANGED
@@ -1,7 +1,11 @@
1
1
  import { AudioLines, Captions, CaptionsOff, CircleStop, Eye, EyeOff, Grid2X2Plus, Hand, Maximize2, MessageSquareText, Mic, MicOff, Minus, Minimize2, Pause, Play, RotateCcw, Send, ShieldCheck, ShieldOff, UserRound, X, createElement as createLucideElement, } from "lucide";
2
2
  import { normalizeAvatarUrl } from "./avatarUrl.js";
3
3
  import { DialogFocusScope } from "./dialogFocusScope.js";
4
+ import { createShoppingNotesScope } from "./commerce/shoppingNotes.js";
5
+ import { ShoppingNotesView, SHOPPING_NOTES_STYLES } from "./commerce/shoppingNotesView.js";
4
6
  import { CtaOfferCard, CTA_OFFER_STYLES, parseCtaOffer } from "./ctaOffer.js";
7
+ import { CommerceProductPanel, COMMERCE_PRODUCT_PANEL_STYLES, formatCommercePrice } from "./commerce/productPanel.js";
8
+ import { parseCommerceBootstrap, sameCommerceStore } from "./commerce/contracts.js";
5
9
  import { resolveWidgetMessages, widgetLocaleAttributes, } from "./locales/index.js";
6
10
  const PANEL_POSITION_KEY = "__oxvo_ai_live_assist_compact_voice_position_v2";
7
11
  const LEGACY_PANEL_POSITION_KEY = "__oxvo_ai_live_assist_panel_position_v1";
@@ -4322,6 +4326,9 @@ const style = `
4322
4326
  export class WidgetView {
4323
4327
  constructor(config, overrides, callbacks, options = {}) {
4324
4328
  this.callbacks = callbacks;
4329
+ this.shoppingNotes = null;
4330
+ this.commercePanel = null;
4331
+ this.commerceCartStatus = null;
4325
4332
  this.ctaCard = null;
4326
4333
  this.ctaSlot = null;
4327
4334
  this.ambient = null;
@@ -4334,6 +4341,7 @@ export class WidgetView {
4334
4341
  this.playbackAttempt = 0;
4335
4342
  this.destroyed = false;
4336
4343
  this.recordingConsent = false;
4344
+ this.commerceCartConsent = false;
4337
4345
  this.mediaPlaybackActive = false;
4338
4346
  this.remoteAudioContext = null;
4339
4347
  this.remoteAudioContextStateListener = null;
@@ -4848,7 +4856,11 @@ export class WidgetView {
4848
4856
  this.host.setAttribute("aria-live", "off");
4849
4857
  this.shadow = this.host.attachShadow({ mode: "closed" });
4850
4858
  const sheet = document.createElement("style");
4851
- sheet.textContent = style + CTA_OFFER_STYLES;
4859
+ sheet.textContent = style + CTA_OFFER_STYLES + COMMERCE_PRODUCT_PANEL_STYLES + SHOPPING_NOTES_STYLES + `
4860
+ .panel:not(.compact) .conversation.commerce-active { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
4861
+ .commerce-slot { flex: 0 1 auto; min-height: 0; max-height: min(55dvh, 420px); overflow: auto; overscroll-behavior: contain; }
4862
+ .panel:not(.compact) .conversation.commerce-active .captions { flex: 1 1 80px; height: auto; min-height: 64px; }
4863
+ `;
4852
4864
  this.shadow.append(sheet);
4853
4865
  this.shadow.append(this.build());
4854
4866
  document.documentElement.append(this.host);
@@ -5676,6 +5688,171 @@ export class WidgetView {
5676
5688
  message(key) {
5677
5689
  return this.messages[key];
5678
5690
  }
5691
+ setCommerceCatalog(catalog, callbacks) {
5692
+ this.clearCommerceCatalog();
5693
+ if (this.destroyed)
5694
+ return;
5695
+ const notes = this.shoppingNotes;
5696
+ const notesMatch = notes && catalog.guideId === notes.scope.guideId &&
5697
+ sameCommerceStore(catalog.store, notes.scope.store);
5698
+ const panel = new CommerceProductPanel(key => this.message(key), {
5699
+ ...callbacks,
5700
+ ...(notesMatch ? { onShoppingNotes: () => { if (notes === this.shoppingNotes)
5701
+ this.openShoppingNotes(); },
5702
+ onSaveItem: (product) => { if (notes === this.shoppingNotes)
5703
+ this.openShoppingNotes(product); } } : {}),
5704
+ });
5705
+ this.commercePanel = panel;
5706
+ panel.element.classList.add("commerce-slot");
5707
+ this.conversation.classList.add("commerce-active");
5708
+ this.conversation.prepend(panel.element);
5709
+ panel.setCatalog(catalog);
5710
+ if (this.active && this.panel.classList.contains("open"))
5711
+ this.setCompact(false);
5712
+ requestAnimationFrame(() => { if (this.commercePanel === panel)
5713
+ panel.refreshVisibility(); });
5714
+ }
5715
+ clearCommerceCatalog() {
5716
+ this.commercePanel?.destroy();
5717
+ this.commercePanel = null;
5718
+ this.conversation?.classList.toggle("commerce-active", this.commerceCartStatus !== null);
5719
+ }
5720
+ configureShoppingNotes() {
5721
+ const scope = this.config.capabilities?.text === true ? createShoppingNotesScope(this.config) : null;
5722
+ if (JSON.stringify(scope) !== JSON.stringify(this.shoppingNotes?.scope ?? null)) {
5723
+ this.shoppingNotes?.destroy();
5724
+ this.shoppingNotes = scope ? new ShoppingNotesView(scope, key => this.message(key), this.dialogFocus, {
5725
+ active: () => this.active || this.endRequested || this.stagedLaunchMode !== null,
5726
+ start: question => this.start("text", question),
5727
+ changed: () => this.syncShoppingNotesEntry(),
5728
+ fallbackFocus: () => this.active ? this.dialogFallbackFocus() : this.require('[data-role="intro-text-input"]'),
5729
+ }) : null;
5730
+ if (this.shoppingNotes)
5731
+ this.shadow.append(this.shoppingNotes.element);
5732
+ }
5733
+ this.syncShoppingNotesEntry();
5734
+ }
5735
+ syncShoppingNotesEntry() {
5736
+ const button = this.shadow.querySelector('[data-role="shopping-notes-entry"]');
5737
+ if (!button)
5738
+ return;
5739
+ button.textContent = this.messages.shoppingNotesReview;
5740
+ button.hidden = this.active || !this.shoppingNotes?.hasSaved();
5741
+ }
5742
+ openShoppingNotes(product) {
5743
+ if (this.destroyed || this.currentConfirmation || this.currentVisualRequest ||
5744
+ this.currentHandoffContextRequest || this.currentPageAssistanceRequest ||
5745
+ !this.require('[data-role="legal-overlay"]').hidden)
5746
+ return;
5747
+ this.releaseActivePushToTalk();
5748
+ this.shoppingNotes?.open(product);
5749
+ }
5750
+ setCommerceBusy(busy) { this.commercePanel?.setBusy(busy); }
5751
+ setCommerceError() { this.commercePanel?.showError(); }
5752
+ setCommerceCartActionHandler(handler, canAdd) {
5753
+ this.commercePanel?.setCartActionHandler(handler, canAdd);
5754
+ }
5755
+ showCommerceCartConfirmation(value, onDecision) {
5756
+ if (this.destroyed || !this.active) {
5757
+ onDecision(false);
5758
+ return;
5759
+ }
5760
+ const price = formatCommercePrice(value.unitPrice.amount, value.unitPrice.currency, value.market.locale);
5761
+ const quantity = new Intl.NumberFormat(value.market.locale).format(value.quantity);
5762
+ this.showConfirmation({ actionId: value.operationId, proposalChecksum: value.proposalChecksum,
5763
+ action: this.messages.commerceAdd, targetLabel: value.title,
5764
+ reason: value.selectedOptions.map(option => `${option.name}: ${option.value}`).join(" · "),
5765
+ expectedEffect: `${quantity} × ${price} · ${new URL(value.store.origin).hostname}`,
5766
+ expiresAt: value.expiresAt, onDecision });
5767
+ }
5768
+ clearCommerceCartConfirmation(operationId) {
5769
+ const current = this.currentConfirmation;
5770
+ if (current?.onDecision && (!operationId || current.actionId === operationId))
5771
+ this.resolveConfirmation(false);
5772
+ }
5773
+ setCommerceCartStatus(outcome, cartUrl, onCheck) {
5774
+ this.clearCommerceCartStatus();
5775
+ if (this.destroyed || !this.active)
5776
+ return;
5777
+ if (this.semanticStatus === this.messages.commerceCartChecking && !this.currentConfirmation &&
5778
+ !this.currentVisualRequest && !this.currentHandoffContextRequest && !this.currentPageAssistanceRequest) {
5779
+ this.setStatus(this.muted && this.voiceActive ? this.messages.muted : this.assistantPresentationMessage());
5780
+ this.setActivity(this.assistantPresentationState());
5781
+ }
5782
+ const status = document.createElement("section");
5783
+ status.className = "commerce-panel commerce-slot commerce-cart-status";
5784
+ status.setAttribute("role", "status");
5785
+ status.setAttribute("aria-live", "polite");
5786
+ const summary = document.createElement("p");
5787
+ const key = outcome.status === "confirmed" && outcome.receipt
5788
+ ? "commerceCartAdded" : outcome.status === "partial" && outcome.receipt ? "commerceCartPartial"
5789
+ : outcome.status === "conflict" ? "commerceCartChanged" : outcome.status === "unavailable"
5790
+ ? "commerceCartUnavailable" : "commerceCartUncertain";
5791
+ summary.textContent = this.messages[key];
5792
+ status.append(summary);
5793
+ if (outcome.local.itemCount !== null && Number.isSafeInteger(outcome.local.itemCount) && outcome.local.itemCount >= 0) {
5794
+ const count = document.createElement("p");
5795
+ count.className = "commerce-product-note";
5796
+ count.textContent = this.messages.commerceCartCount.replace("{count}", new Intl.NumberFormat(this.host.lang || "en").format(outcome.local.itemCount));
5797
+ status.append(count);
5798
+ }
5799
+ const actions = document.createElement("div");
5800
+ actions.className = "commerce-panel-actions";
5801
+ if (onCheck && (outcome.status === "uncertain" ||
5802
+ ((outcome.status === "confirmed" || outcome.status === "partial") && outcome.receipt))) {
5803
+ const check = document.createElement("button");
5804
+ check.type = "button";
5805
+ check.textContent = this.messages.commerceCartRecheck;
5806
+ check.addEventListener("click", async () => {
5807
+ if (check.disabled || this.destroyed || !this.active || this.commerceCartStatus !== status)
5808
+ return;
5809
+ check.disabled = true;
5810
+ check.setAttribute("aria-busy", "true");
5811
+ try {
5812
+ await onCheck();
5813
+ }
5814
+ catch { /* Keep the uncertain result available for another read-only check. */ }
5815
+ finally {
5816
+ if (this.commerceCartStatus === status && check.isConnected && !this.destroyed && this.active) {
5817
+ check.disabled = false;
5818
+ check.removeAttribute("aria-busy");
5819
+ }
5820
+ }
5821
+ });
5822
+ actions.append(check);
5823
+ }
5824
+ try {
5825
+ const url = new URL(cartUrl);
5826
+ if (url.protocol === "https:" && url.origin === window.location.origin && !url.username && !url.password &&
5827
+ /^\/(?:[a-z]{2,3}(?:-[a-z0-9]{2,8})*\/)?cart\/?$/iu.test(url.pathname) && !url.search && !url.hash) {
5828
+ const view = document.createElement("a");
5829
+ view.className = "commerce-product-link";
5830
+ view.href = url.href;
5831
+ view.textContent = this.messages.commerceViewCart;
5832
+ actions.append(view);
5833
+ }
5834
+ }
5835
+ catch { /* An invalid destination must not become a shopper link. */ }
5836
+ const keep = document.createElement("button");
5837
+ keep.type = "button";
5838
+ keep.textContent = this.messages.commerceKeepShopping;
5839
+ keep.addEventListener("click", () => {
5840
+ this.clearCommerceCartStatus();
5841
+ this.dialogFallbackFocus()?.focus();
5842
+ });
5843
+ actions.append(keep);
5844
+ status.append(actions);
5845
+ this.commerceCartStatus = status;
5846
+ this.conversation.prepend(status);
5847
+ this.conversation.classList.add("commerce-active");
5848
+ this.setCompact(false);
5849
+ this.openPanel();
5850
+ }
5851
+ clearCommerceCartStatus() {
5852
+ this.commerceCartStatus?.remove();
5853
+ this.commerceCartStatus = null;
5854
+ this.conversation?.classList.toggle("commerce-active", this.commercePanel !== null);
5855
+ }
5679
5856
  setAdvancedSessionControlsVisible(visible) {
5680
5857
  this.advancedSessionControlsVisible = visible;
5681
5858
  this.syncAdvancedSessionControlsVisibility();
@@ -5719,6 +5896,7 @@ export class WidgetView {
5719
5896
  return this.start(mode);
5720
5897
  }
5721
5898
  close() {
5899
+ this.shoppingNotes?.close(false);
5722
5900
  if (this.panel.classList.contains("open"))
5723
5901
  this.closePanel();
5724
5902
  }
@@ -6180,7 +6358,7 @@ export class WidgetView {
6180
6358
  return;
6181
6359
  }
6182
6360
  this.captions.querySelector('[data-role="empty"]')?.remove();
6183
- const safe = text.slice(0, 16000);
6361
+ const safe = (role === "user" ? this.shoppingNotes?.captionText(text) ?? text : text).slice(0, 16000);
6184
6362
  if (role === "assistant" && safe && !restored) {
6185
6363
  this.assistantCaptionPhase = final ? "final" : "partial";
6186
6364
  }
@@ -6754,7 +6932,8 @@ export class WidgetView {
6754
6932
  showConfirmation(value) {
6755
6933
  this.dismissHandoffRequestPreparing();
6756
6934
  if (this.currentConfirmation?.actionId === value.actionId &&
6757
- this.currentConfirmation.proposalChecksum === value.proposalChecksum) {
6935
+ this.currentConfirmation.proposalChecksum === value.proposalChecksum &&
6936
+ Boolean(this.currentConfirmation.onDecision) === Boolean(value.onDecision)) {
6758
6937
  return;
6759
6938
  }
6760
6939
  if (this.currentPageAssistanceRequest) {
@@ -6784,6 +6963,7 @@ export class WidgetView {
6784
6963
  this.setAmbientActive(true);
6785
6964
  this.syncHeaderActions();
6786
6965
  this.confirmation.scrollIntoView({ block: "nearest" });
6966
+ this.shoppingNotes?.close(false);
6787
6967
  this.dialogFocus.present({
6788
6968
  surface: this.confirmation,
6789
6969
  initialFocus: () => this.require('[data-role="decline"]'),
@@ -7044,6 +7224,7 @@ export class WidgetView {
7044
7224
  this.syncPageAssistanceFooter();
7045
7225
  const overlay = this.syncPageAssistancePresentation();
7046
7226
  this.syncHeaderActions();
7227
+ this.shoppingNotes?.close(false);
7047
7228
  this.dialogFocus.present({
7048
7229
  surface: overlay,
7049
7230
  initialFocus: () => this.require('[data-role="page-assistance-decline"]'),
@@ -7662,6 +7843,8 @@ export class WidgetView {
7662
7843
  true;
7663
7844
  }
7664
7845
  showError(message, retryable = false, sessionActive = this.active) {
7846
+ if (this.stagedLaunchMode !== null || this.assistantState === "connecting")
7847
+ this.shoppingNotes?.markLaunchFailed();
7665
7848
  this.setActionStateRunning(false);
7666
7849
  if (this.voiceActive || this.audio.srcObject) {
7667
7850
  this.pauseRemotePlayback(true);
@@ -7718,6 +7901,8 @@ export class WidgetView {
7718
7901
  ]);
7719
7902
  }
7720
7903
  showEndingDetached(message) {
7904
+ this.clearCommerceCartStatus();
7905
+ this.clearCommerceCartConfirmation();
7721
7906
  const continuingEndingPresentation = this.panel.classList.contains("ending-state");
7722
7907
  if (!continuingEndingPresentation) {
7723
7908
  this.endingPresentationDismissed = false;
@@ -7735,6 +7920,7 @@ export class WidgetView {
7735
7920
  this.currentConfirmation = null;
7736
7921
  this.currentVisualRequest = null;
7737
7922
  this.currentHandoffContextRequest = null;
7923
+ this.shoppingNotes?.close(false);
7738
7924
  this.dialogFocus.clear({ restore: false });
7739
7925
  this.assistantCaptionPhase = "none";
7740
7926
  this.clearPendingCaptions();
@@ -7794,6 +7980,7 @@ export class WidgetView {
7794
7980
  this.currentConfirmation = null;
7795
7981
  this.currentVisualRequest = null;
7796
7982
  this.currentHandoffContextRequest = null;
7983
+ this.shoppingNotes?.close(false);
7797
7984
  this.dialogFocus.clear({ restore: false });
7798
7985
  this.assistantCaptionPhase = "none";
7799
7986
  this.clearPendingCaptions();
@@ -7832,6 +8019,10 @@ export class WidgetView {
7832
8019
  this.clearIntroTransition();
7833
8020
  this.introMinimized = false;
7834
8021
  this.syncIntroMinimizedState();
8022
+ if (this.shoppingNotes?.retry(question, message)) {
8023
+ this.setStatus(message);
8024
+ return;
8025
+ }
7835
8026
  const input = this.require('[data-role="intro-text-input"]');
7836
8027
  input.value = question.slice(0, INITIAL_QUESTION_MAX_LENGTH);
7837
8028
  input.setAttribute("aria-invalid", "false");
@@ -7887,6 +8078,7 @@ export class WidgetView {
7887
8078
  this.currentConfirmation = null;
7888
8079
  this.currentVisualRequest = null;
7889
8080
  this.currentHandoffContextRequest = null;
8081
+ this.shoppingNotes?.close(false);
7890
8082
  this.dialogFocus.clear({ restore: false });
7891
8083
  if (this.muted)
7892
8084
  this.setMuted(false);
@@ -8230,6 +8422,11 @@ export class WidgetView {
8230
8422
  });
8231
8423
  }
8232
8424
  destroy() {
8425
+ this.shoppingNotes?.destroy();
8426
+ this.shoppingNotes = null;
8427
+ this.clearCommerceCartConfirmation();
8428
+ this.clearCommerceCatalog();
8429
+ this.clearCommerceCartStatus();
8233
8430
  this.clearCtaOffer();
8234
8431
  if (this.destroyed)
8235
8432
  return;
@@ -8305,7 +8502,9 @@ export class WidgetView {
8305
8502
  <div class="status-card" data-role="availability" role="status" tabindex="-1"></div>
8306
8503
  <div class="status-card" data-role="elsewhere" role="status" tabindex="-1"></div>
8307
8504
  <div class="intro-entry" data-role="intro-entry" data-has-draft="false" aria-busy="false" hidden>
8505
+ <button type="button" class="shopping-notes-entry" data-role="shopping-notes-entry" hidden></button>
8308
8506
  <label class="recording-consent" data-role="recording-consent" hidden><input type="checkbox" data-role="recording-consent-input"><span><strong data-role="recording-consent-label"></strong><small data-role="recording-consent-description"></small></span></label>
8507
+ <label class="recording-consent commerce-cart-consent" data-role="commerce-cart-consent" hidden><input type="checkbox" data-role="commerce-cart-consent-input"><span><strong data-role="commerce-cart-consent-label"></strong><small data-role="commerce-cart-consent-description"></small></span></label>
8309
8508
  <div class="proactive-engagement" data-role="proactive-engagement" hidden>
8310
8509
  <div class="proactive-rail" data-role="proactive-prompts" role="group"></div>
8311
8510
  </div>
@@ -8393,6 +8592,7 @@ export class WidgetView {
8393
8592
  <div class="boundary" data-role="boundary"></div>
8394
8593
  <ul data-role="legal-scopes"></ul>
8395
8594
  <label class="recording-consent" data-role="recording-consent" hidden><input type="checkbox" data-role="recording-consent-input"><span><strong data-role="recording-consent-label"></strong><small data-role="recording-consent-description"></small></span></label>
8595
+ <label class="recording-consent commerce-cart-consent" data-role="commerce-cart-consent" hidden><input type="checkbox" data-role="commerce-cart-consent-input"><span><strong data-role="commerce-cart-consent-label"></strong><small data-role="commerce-cart-consent-description"></small></span></label>
8396
8596
  <div class="legal-links" data-role="legal-links"><a data-role="legal-privacy" target="_blank" rel="noopener noreferrer"></a><a data-role="legal-terms" target="_blank" rel="noopener noreferrer"></a></div>
8397
8597
  <button type="button" class="secondary legal-revoke" data-role="page-assistance-revoke" hidden><span class="menu-icon" data-icon aria-hidden="true"></span><span class="control-label"></span></button>
8398
8598
  </section>
@@ -8503,6 +8703,7 @@ export class WidgetView {
8503
8703
  return fragment;
8504
8704
  }
8505
8705
  bind() {
8706
+ this.require('[data-role="shopping-notes-entry"]').addEventListener("click", () => this.openShoppingNotes());
8506
8707
  this.panel.addEventListener("pointerdown", this.onPlaybackActivation, true);
8507
8708
  this.panel.addEventListener("wheel", this.onPanelWheel, { passive: false });
8508
8709
  this.captions.addEventListener("scroll", this.onCaptionsScroll, {
@@ -8871,6 +9072,7 @@ export class WidgetView {
8871
9072
  window.visualViewport?.addEventListener("scroll", this.onHighlightViewportGeometryChange, { passive: true });
8872
9073
  }
8873
9074
  applyConfig() {
9075
+ this.configureShoppingNotes();
8874
9076
  const appearance = this.config.appearance;
8875
9077
  const anchor = appearance?.position === "left" || appearance?.position === "center"
8876
9078
  ? appearance.position
@@ -9105,6 +9307,7 @@ export class WidgetView {
9105
9307
  this.messages.notResolved;
9106
9308
  this.renderLegalScopes();
9107
9309
  this.renderRecordingConsent();
9310
+ this.renderCommerceCartConsent();
9108
9311
  const privacy = this.require('[data-role="privacy"]');
9109
9312
  if (this.config.consent?.policyUrl)
9110
9313
  privacy.href = this.config.consent.policyUrl;
@@ -9191,6 +9394,28 @@ export class WidgetView {
9191
9394
  };
9192
9395
  }
9193
9396
  }
9397
+ commerceCartConsentOffered() {
9398
+ return this.config.schemaVersion === 3 && this.config.capabilities?.commerceCart === true &&
9399
+ this.config.consent?.optionalScopes.includes("commerce_cart") === true &&
9400
+ parseCommerceBootstrap(this.config.commerce, this.config.guideId, location.origin)?.cartEnabled === true;
9401
+ }
9402
+ renderCommerceCartConsent() {
9403
+ const offered = this.commerceCartConsentOffered();
9404
+ for (const row of this.shadow.querySelectorAll('[data-role="commerce-cart-consent"]')) {
9405
+ row.hidden = !offered || (this.introMinimized && row.closest('[data-role="intro-entry"]') !== null);
9406
+ row.querySelector('[data-role="commerce-cart-consent-label"]').textContent = this.messages.commerceCartConsent;
9407
+ row.querySelector('[data-role="commerce-cart-consent-description"]').textContent = this.messages.commerceCartConsentDescription;
9408
+ const input = row.querySelector('[data-role="commerce-cart-consent-input"]');
9409
+ input.checked = offered && this.commerceCartConsent;
9410
+ input.disabled = this.active || this.endRequested;
9411
+ input.onchange = () => {
9412
+ if (!this.destroyed && !this.active && !this.endRequested && this.commerceCartConsentOffered()) {
9413
+ this.commerceCartConsent = input.checked;
9414
+ }
9415
+ this.renderCommerceCartConsent();
9416
+ };
9417
+ }
9418
+ }
9194
9419
  renderLegalScopes() {
9195
9420
  const container = this.require('[data-role="legal-scopes"]');
9196
9421
  container.replaceChildren();
@@ -9202,6 +9427,7 @@ export class WidgetView {
9202
9427
  microphone: "microphoneConsent",
9203
9428
  page_context: "pageConsent",
9204
9429
  browser_control: "controlConsent",
9430
+ commerce_cart: "commerceCartConsentDescription",
9205
9431
  visual_context: "visualConsent",
9206
9432
  handoff_context: "handoffConsent",
9207
9433
  retained_transcript: "retentionConsent",
@@ -9210,6 +9436,7 @@ export class WidgetView {
9210
9436
  "microphone",
9211
9437
  "page_context",
9212
9438
  "browser_control",
9439
+ "commerce_cart",
9213
9440
  "visual_context",
9214
9441
  "handoff_context",
9215
9442
  "retained_transcript",
@@ -9238,6 +9465,8 @@ export class WidgetView {
9238
9465
  const scopes = ["ai_disclosure", "text"];
9239
9466
  if (this.recordingConsentOffered() && this.recordingConsent)
9240
9467
  scopes.push("session_recording");
9468
+ if (this.commerceCartConsentOffered() && this.commerceCartConsent)
9469
+ scopes.push("commerce_cart");
9241
9470
  if (required.has("page_context") &&
9242
9471
  this.config.capabilities?.pageContext === true) {
9243
9472
  scopes.push("page_context");
@@ -9255,6 +9484,7 @@ export class WidgetView {
9255
9484
  const shouldStageWelcome = mode === "text" && !initialQuestion && !this.welcomePresented;
9256
9485
  if (shouldStageWelcome)
9257
9486
  this.ensureWelcomeSkeleton();
9487
+ this.shoppingNotes?.prepareLaunch(initialQuestion);
9258
9488
  const admitted = initialQuestion
9259
9489
  ? this.callbacks.onStart(mode, scopes, initialQuestion)
9260
9490
  : this.callbacks.onStart(mode, scopes);
@@ -9387,6 +9617,7 @@ export class WidgetView {
9387
9617
  this.focusIntroControl(this.config.capabilities?.text === true ? "text" : "voice");
9388
9618
  }
9389
9619
  syncIntroMinimizedState() {
9620
+ this.renderCommerceCartConsent();
9390
9621
  const entry = this.require('[data-role="intro-entry"]');
9391
9622
  const frame = this.require('[data-role="intro-composer"]');
9392
9623
  const composer = this.require(".intro-composer");
@@ -9530,12 +9761,18 @@ export class WidgetView {
9530
9761
  const value = this.currentConfirmation;
9531
9762
  if (!value)
9532
9763
  return false;
9533
- if (Date.parse(value.expiresAt) <= Date.now()) {
9764
+ if (!Number.isFinite(Date.parse(value.expiresAt)) || Date.parse(value.expiresAt) <= Date.now()) {
9534
9765
  this.confirmation.classList.remove("visible");
9535
9766
  this.currentConfirmation = null;
9536
9767
  this.dialogFocus.dismiss(this.confirmation);
9537
- this.callbacks.onConfirmation(value.actionId, value.proposalChecksum, false);
9538
- this.showActionState("failed");
9768
+ if (value.onDecision) {
9769
+ this.setStatus(this.muted && this.voiceActive ? this.messages.muted : this.assistantPresentationMessage());
9770
+ value.onDecision(false);
9771
+ }
9772
+ else {
9773
+ this.callbacks.onConfirmation(value.actionId, value.proposalChecksum, false);
9774
+ this.showActionState("failed");
9775
+ }
9539
9776
  return true;
9540
9777
  }
9541
9778
  this.confirmation.classList.remove("visible");
@@ -9543,7 +9780,13 @@ export class WidgetView {
9543
9780
  this.dialogFocus.dismiss(this.confirmation);
9544
9781
  this.restoreVoicePresenceAfterPrompt();
9545
9782
  this.syncHeaderActions();
9546
- this.callbacks.onConfirmation(value.actionId, value.proposalChecksum, approved);
9783
+ if (value.onDecision) {
9784
+ this.setStatus(approved ? this.messages.commerceCartChecking :
9785
+ this.muted && this.voiceActive ? this.messages.muted : this.assistantPresentationMessage());
9786
+ value.onDecision(approved);
9787
+ }
9788
+ else
9789
+ this.callbacks.onConfirmation(value.actionId, value.proposalChecksum, approved);
9547
9790
  return true;
9548
9791
  }
9549
9792
  restoreVoicePresenceAfterPrompt() {
@@ -9793,6 +10036,7 @@ export class WidgetView {
9793
10036
  }
9794
10037
  presentContextPermissionDialog() {
9795
10038
  this.restoreContextPermissionDialogAttributes();
10039
+ this.shoppingNotes?.close(false);
9796
10040
  this.dialogFocus.present({
9797
10041
  surface: this.visualRequest,
9798
10042
  initialFocus: () => this.require('[data-role="visual-decline"]'),
@@ -9834,7 +10078,7 @@ export class WidgetView {
9834
10078
  currentSafetyIdentity(kind) {
9835
10079
  if (kind === "confirmation") {
9836
10080
  const value = this.currentConfirmation;
9837
- return value ? `${value.actionId}:${value.proposalChecksum}` : null;
10081
+ return value ? `${value.onDecision ? "commerce" : "action"}:${value.actionId}:${value.proposalChecksum}` : null;
9838
10082
  }
9839
10083
  if (this.currentHandoffContextRequest) {
9840
10084
  return `handoff:${this.currentHandoffContextRequest.requestId}:${this.currentHandoffContextRequest.requestChecksum}`;
@@ -10145,11 +10389,12 @@ export class WidgetView {
10145
10389
  this.writePanelVisibility("open");
10146
10390
  this.syncLauncherState();
10147
10391
  this.syncHeaderActions();
10148
- requestAnimationFrame(() => this.clampPanelPosition());
10392
+ requestAnimationFrame(() => { this.clampPanelPosition(); this.commercePanel?.refreshVisibility(); });
10149
10393
  if (!wasOpen && notifyOpen)
10150
10394
  this.callbacks.onOpenChange?.(true);
10151
10395
  }
10152
10396
  closePanel() {
10397
+ this.shoppingNotes?.close(false);
10153
10398
  if (!this.panel.classList.contains("open"))
10154
10399
  return;
10155
10400
  if (this.panel.classList.contains("ending-state")) {
@@ -10298,6 +10543,7 @@ export class WidgetView {
10298
10543
  if (!value)
10299
10544
  this.panel.classList.remove("compact-text-arrived");
10300
10545
  this.panel.classList.toggle("compact", this.compact);
10546
+ requestAnimationFrame(() => this.commercePanel?.refreshVisibility());
10301
10547
  this.placeCtaOffer();
10302
10548
  this.syncSurfaceEffectOwner();
10303
10549
  if (persist && this.active && this.persistentState) {
@@ -11004,6 +11250,7 @@ export class WidgetView {
11004
11250
  this.stagedLaunchMode = null;
11005
11251
  this.initialQuestionStaged = false;
11006
11252
  this.active = false;
11253
+ this.commerceCartConsent = false;
11007
11254
  this.endRequested = false;
11008
11255
  if (this.paused)
11009
11256
  this.setPaused(false);
@@ -11090,6 +11337,7 @@ export class WidgetView {
11090
11337
  }
11091
11338
  const overlay = this.require('[data-role="legal-overlay"]');
11092
11339
  overlay.hidden = false;
11340
+ this.shoppingNotes?.close(false);
11093
11341
  this.dialogFocus.present({
11094
11342
  surface: overlay,
11095
11343
  initialFocus: () => this.require('[data-role="legal-close"]'),
@@ -11386,6 +11634,8 @@ export class WidgetView {
11386
11634
  this.restorePanelPosition();
11387
11635
  }
11388
11636
  syncHeaderActions() {
11637
+ this.syncShoppingNotesEntry();
11638
+ this.renderCommerceCartConsent();
11389
11639
  this.panel.classList.toggle("active-session", this.active);
11390
11640
  this.syncSessionModeUi();
11391
11641
  const errorState = this.panel.classList.contains("error-state");
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "7.5.20";
1
+ export declare const VERSION = "7.5.21";
package/lib/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '7.5.20';
1
+ export const VERSION = '7.5.21';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oxvo/ai-live-assist",
3
3
  "description": "Secure AI Guide browser plugin for OXVO Sessions.",
4
- "version": "7.5.20",
4
+ "version": "7.5.21",
5
5
  "keywords": [
6
6
  "ai-live-assist",
7
7
  "webrtc",