@oxvo/ai-live-assist 7.5.29 → 7.5.31
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/cjs/AiLiveAssist.d.ts +1 -1
- package/cjs/context.d.ts +2 -0
- package/cjs/context.js +92 -1
- package/cjs/guideMeasurement.d.ts +1 -1
- package/cjs/guideMeasurement.js +1 -1
- package/cjs/liveControlChannel.d.ts +2 -1
- package/cjs/liveControlChannel.js +4 -0
- package/cjs/liveGuideWidget.js +2 -9
- package/cjs/ui.js +1 -0
- package/cjs/version.d.ts +1 -1
- package/cjs/version.js +1 -1
- package/lib/AiLiveAssist.d.ts +1 -1
- package/lib/context.d.ts +2 -0
- package/lib/context.js +92 -1
- package/lib/guideMeasurement.d.ts +1 -1
- package/lib/guideMeasurement.js +1 -1
- package/lib/liveControlChannel.d.ts +2 -1
- package/lib/liveControlChannel.js +4 -0
- package/lib/liveGuideWidget.js +2 -9
- package/lib/ui.js +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
package/cjs/AiLiveAssist.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare const normalizeAiGuideOpenInput: (input?: AiGuideOpenInput) => Re
|
|
|
34
34
|
export declare const resolveAiGuideProtocolVersion: (bootstrap: Pick<BootstrapConfig, "experienceMode" | "minimumProtocolVersion" | "protocol">) => 1 | 2;
|
|
35
35
|
export default class AiLiveAssist {
|
|
36
36
|
private readonly options;
|
|
37
|
-
readonly version = "7.5.
|
|
37
|
+
readonly version = "7.5.31";
|
|
38
38
|
private readonly host;
|
|
39
39
|
private readonly guideAdmission;
|
|
40
40
|
private readonly standaloneAdmissionPending;
|
package/cjs/context.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare class PageContextCollector {
|
|
|
43
43
|
private releasedNavigationSettlement;
|
|
44
44
|
private navigationSettlementGeneration;
|
|
45
45
|
private navigationSettlement;
|
|
46
|
+
private cancelNavigationRenderWait;
|
|
46
47
|
private recentSelection;
|
|
47
48
|
private latestSemanticSignature;
|
|
48
49
|
constructor(callbacks: ContextCallbacks, selectorRegionRules?: SelectorRegionRule[], policyVersion?: number, trustedGuideRoot?: Element | null, statefulButtonActionProof?: boolean);
|
|
@@ -95,6 +96,7 @@ export declare class PageContextCollector {
|
|
|
95
96
|
private readSafeSelection;
|
|
96
97
|
private handleNavigation;
|
|
97
98
|
private beginNavigationSettlement;
|
|
99
|
+
private waitForNavigationRender;
|
|
98
100
|
private observeCausalNavigationAfterMutation;
|
|
99
101
|
private reportCausalNavigationObservation;
|
|
100
102
|
private resetBoundTargetIds;
|
package/cjs/context.js
CHANGED
|
@@ -19,6 +19,7 @@ const SCROLL_SETTLEMENT_POSITION_TOLERANCE_PX = 1;
|
|
|
19
19
|
const SCROLL_SETTLEMENT_STABLE_MS = 250;
|
|
20
20
|
const MAX_SCROLL_LAYOUT_CORRECTIONS = 3;
|
|
21
21
|
const RELEASED_NAVIGATION_SETTLEMENT_TIMEOUT_MS = 5000;
|
|
22
|
+
const NAVIGATION_RENDER_SETTLEMENT_TIMEOUT_MS = 2000;
|
|
22
23
|
const FRAMER_GENERATED_PAGE_SELECTOR = '[data-framer-generated-page]';
|
|
23
24
|
const FRAMER_TOGGLE_ROOT_SELECTOR = '[data-framer-name="Toggle"]';
|
|
24
25
|
const FRAMER_TOGGLE_CONTROL_SELECTOR = 'div[name="Toggle Switch"][data-highlight="true"][tabindex]';
|
|
@@ -826,6 +827,7 @@ class PageContextCollector {
|
|
|
826
827
|
this.releasedNavigationSettlement = null;
|
|
827
828
|
this.navigationSettlementGeneration = 0;
|
|
828
829
|
this.navigationSettlement = null;
|
|
830
|
+
this.cancelNavigationRenderWait = null;
|
|
829
831
|
this.recentSelection = null;
|
|
830
832
|
this.latestSemanticSignature = null;
|
|
831
833
|
this.scheduleCapture = () => {
|
|
@@ -951,6 +953,10 @@ class PageContextCollector {
|
|
|
951
953
|
this.reportCausalNavigationObservation();
|
|
952
954
|
return;
|
|
953
955
|
}
|
|
956
|
+
// A queued history notification for this same route must not supersede
|
|
957
|
+
// its causal action while we await the page's transition.
|
|
958
|
+
if (this.navigationSettlement?.url === currentUrl)
|
|
959
|
+
return;
|
|
954
960
|
this.pageId = id('page');
|
|
955
961
|
this.revision += 1;
|
|
956
962
|
this.targets.clear();
|
|
@@ -970,7 +976,13 @@ class PageContextCollector {
|
|
|
970
976
|
}
|
|
971
977
|
const settlement = this.beginNavigationSettlement(this.pageId, this.revision, currentUrl);
|
|
972
978
|
void Promise.resolve()
|
|
973
|
-
.then(() =>
|
|
979
|
+
.then(async () => {
|
|
980
|
+
if (typeof document.getAnimations === 'function')
|
|
981
|
+
await this.waitForNavigationRender(settlement);
|
|
982
|
+
if (!this.running || this.navigationSettlement !== settlement)
|
|
983
|
+
return false;
|
|
984
|
+
return this.callbacks.onNavigation(settlement.pageId, settlement.revision, settlement.url);
|
|
985
|
+
})
|
|
974
986
|
.then((navigationAcknowledged) => {
|
|
975
987
|
if (navigationAcknowledged === false ||
|
|
976
988
|
!this.running ||
|
|
@@ -1090,6 +1102,7 @@ class PageContextCollector {
|
|
|
1090
1102
|
this.deferredNavigation = null;
|
|
1091
1103
|
this.releasedNavigation = null;
|
|
1092
1104
|
this.finishReleasedNavigationSettlement('rejected');
|
|
1105
|
+
this.cancelNavigationRenderWait?.();
|
|
1093
1106
|
this.navigationSettlementGeneration += 1;
|
|
1094
1107
|
this.navigationSettlement = null;
|
|
1095
1108
|
this.recentSelection = null;
|
|
@@ -1890,6 +1903,12 @@ class PageContextCollector {
|
|
|
1890
1903
|
const settlement = navigation && this.running
|
|
1891
1904
|
? this.beginNavigationSettlement(navigation.pageId, Math.max(navigation.revision, this.revision), navigation.url)
|
|
1892
1905
|
: null;
|
|
1906
|
+
if (settlement) {
|
|
1907
|
+
if (typeof document.getAnimations === 'function')
|
|
1908
|
+
await this.waitForNavigationRender(settlement);
|
|
1909
|
+
if (!this.running || this.navigationSettlement !== settlement)
|
|
1910
|
+
return null;
|
|
1911
|
+
}
|
|
1893
1912
|
if (navigation && this.running) {
|
|
1894
1913
|
try {
|
|
1895
1914
|
navigationAcknowledged =
|
|
@@ -2511,6 +2530,7 @@ class PageContextCollector {
|
|
|
2511
2530
|
};
|
|
2512
2531
|
}
|
|
2513
2532
|
beginNavigationSettlement(pageId, revision, url) {
|
|
2533
|
+
this.cancelNavigationRenderWait?.();
|
|
2514
2534
|
const settlement = {
|
|
2515
2535
|
generation: ++this.navigationSettlementGeneration,
|
|
2516
2536
|
pageId,
|
|
@@ -2524,6 +2544,77 @@ class PageContextCollector {
|
|
|
2524
2544
|
this.clearMutationCapture();
|
|
2525
2545
|
return settlement;
|
|
2526
2546
|
}
|
|
2547
|
+
waitForNavigationRender(settlement) {
|
|
2548
|
+
if (!this.running || this.navigationSettlement !== settlement ||
|
|
2549
|
+
typeof document.getAnimations !== 'function')
|
|
2550
|
+
return Promise.resolve();
|
|
2551
|
+
return new Promise(resolve => {
|
|
2552
|
+
let frame = null;
|
|
2553
|
+
let finished = false;
|
|
2554
|
+
const watched = new Map();
|
|
2555
|
+
const clearAnimations = () => {
|
|
2556
|
+
for (const [animation, listener] of watched) {
|
|
2557
|
+
animation.removeEventListener('finish', listener);
|
|
2558
|
+
animation.removeEventListener('cancel', listener);
|
|
2559
|
+
}
|
|
2560
|
+
watched.clear();
|
|
2561
|
+
};
|
|
2562
|
+
const finish = () => {
|
|
2563
|
+
if (finished)
|
|
2564
|
+
return;
|
|
2565
|
+
finished = true;
|
|
2566
|
+
clearTimeout(deadline);
|
|
2567
|
+
if (frame !== null)
|
|
2568
|
+
window.cancelAnimationFrame(frame);
|
|
2569
|
+
clearAnimations();
|
|
2570
|
+
if (this.cancelNavigationRenderWait === finish)
|
|
2571
|
+
this.cancelNavigationRenderWait = null;
|
|
2572
|
+
resolve();
|
|
2573
|
+
};
|
|
2574
|
+
const check = () => {
|
|
2575
|
+
frame = null;
|
|
2576
|
+
if (finished)
|
|
2577
|
+
return;
|
|
2578
|
+
if (!this.running || this.navigationSettlement !== settlement) {
|
|
2579
|
+
finish();
|
|
2580
|
+
return;
|
|
2581
|
+
}
|
|
2582
|
+
clearAnimations();
|
|
2583
|
+
const animations = document.getAnimations().filter(animation => {
|
|
2584
|
+
const effect = animation.effect;
|
|
2585
|
+
const target = effect && 'target' in effect && effect.target instanceof Element ? effect.target : null;
|
|
2586
|
+
const root = target?.getRootNode();
|
|
2587
|
+
const guideAnimation = target && (this.mutationNodeIsInsideTrustedGuide(target) ||
|
|
2588
|
+
root instanceof ShadowRoot && root.host === this.trustedGuideRoot);
|
|
2589
|
+
return (animation.playState === 'running' || animation.pending) &&
|
|
2590
|
+
effect && Number.isFinite(Number(effect.getComputedTiming().endTime)) &&
|
|
2591
|
+
!guideAnimation;
|
|
2592
|
+
});
|
|
2593
|
+
if (animations.length === 0) {
|
|
2594
|
+
finish();
|
|
2595
|
+
return;
|
|
2596
|
+
}
|
|
2597
|
+
for (const animation of animations) {
|
|
2598
|
+
const listener = () => { clearAnimations(); schedule(); };
|
|
2599
|
+
watched.set(animation, listener);
|
|
2600
|
+
animation.addEventListener('finish', listener);
|
|
2601
|
+
animation.addEventListener('cancel', listener);
|
|
2602
|
+
}
|
|
2603
|
+
};
|
|
2604
|
+
const schedule = () => {
|
|
2605
|
+
if (finished || frame !== null)
|
|
2606
|
+
return;
|
|
2607
|
+
// Let the router commit and paint before reading active transitions.
|
|
2608
|
+
// Await actual completion events, never poll or sleep a fixed duration.
|
|
2609
|
+
frame = window.requestAnimationFrame(() => {
|
|
2610
|
+
frame = window.requestAnimationFrame(check);
|
|
2611
|
+
});
|
|
2612
|
+
};
|
|
2613
|
+
const deadline = setTimeout(finish, NAVIGATION_RENDER_SETTLEMENT_TIMEOUT_MS);
|
|
2614
|
+
this.cancelNavigationRenderWait = finish;
|
|
2615
|
+
schedule();
|
|
2616
|
+
});
|
|
2617
|
+
}
|
|
2527
2618
|
observeCausalNavigationAfterMutation(actionId, destinationPath, beforeActionUrl) {
|
|
2528
2619
|
const currentUrl = safePageUrl();
|
|
2529
2620
|
if (currentUrl === beforeActionUrl ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GuideMeasurementBridge, GuideMeasurementIntent } from './guideTypes.js';
|
|
2
|
-
export declare const GUIDE_MEASUREMENT_CLIENT_VERSION = "7.5.
|
|
2
|
+
export declare const GUIDE_MEASUREMENT_CLIENT_VERSION = "7.5.31";
|
|
3
3
|
export declare function isGuideMeasurementIntent(value: unknown): value is GuideMeasurementIntent;
|
|
4
4
|
/** The managed analytics owner supplies possession; this check grants no authority. */
|
|
5
5
|
export declare function currentGuideMeasurementBridge(value: unknown): value is GuideMeasurementBridge;
|
package/cjs/guideMeasurement.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.GUIDE_MEASUREMENT_CLIENT_VERSION = void 0;
|
|
|
4
4
|
exports.isGuideMeasurementIntent = isGuideMeasurementIntent;
|
|
5
5
|
exports.currentGuideMeasurementBridge = currentGuideMeasurementBridge;
|
|
6
6
|
exports.prepareGuideMeasurementBridge = prepareGuideMeasurementBridge;
|
|
7
|
-
exports.GUIDE_MEASUREMENT_CLIENT_VERSION = '7.5.
|
|
7
|
+
exports.GUIDE_MEASUREMENT_CLIENT_VERSION = '7.5.31';
|
|
8
8
|
function isGuideMeasurementIntent(value) {
|
|
9
9
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
10
10
|
return false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type MerchantPreviewRuntimePolicy } from './merchantPreviewOrigins.js';
|
|
2
2
|
import { type LiveDuplexMediaOptions, type LiveDuplexMediaDependencies } from './liveDuplexMedia.js';
|
|
3
3
|
import { type CommerceBootstrap, type CommerceContext, type CommerceCartSelection, type CommerceProduct, type CommerceContextClear, type LiveCommerceCatalog, type LiveCommerceDisplayed } from './commerce/contracts.js';
|
|
4
|
-
export declare const LIVE_CONTROL_CLIENT_VERSION = "7.5.
|
|
4
|
+
export declare const LIVE_CONTROL_CLIENT_VERSION = "7.5.31";
|
|
5
5
|
export declare const LIVE_CONTROL_CLIENT_CAPABILITIES: readonly ["live_duplex_v1", "live_local_wake_v1", "live_fragment_captions_v1"];
|
|
6
6
|
declare const phases: readonly ["voice_off", "local_listening", "wake_buffering", "starting", "active", "tentative_idle", "closing", "uncertain", "muted", "suspended", "budget_blocked", "ended"];
|
|
7
7
|
export type LiveControlState = {
|
|
@@ -71,6 +71,7 @@ export interface LiveControlChannelOptions {
|
|
|
71
71
|
currentContext(): CommerceContext | null;
|
|
72
72
|
cartVersion?: 1;
|
|
73
73
|
};
|
|
74
|
+
onCommerceContextRequired?(): void;
|
|
74
75
|
onCommerceCatalog?(value: LiveCommerceCatalog): void;
|
|
75
76
|
onCommerceCartEvent?(type: string, payload: unknown): void;
|
|
76
77
|
}
|
|
@@ -367,6 +367,10 @@ class LiveControlChannel {
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
this.commandEpoch++;
|
|
370
|
+
// Every nonterminal cut clears the server's context, including automatic
|
|
371
|
+
// media failures. Fresh browser hints must wait behind this same barrier.
|
|
372
|
+
if (type !== 'end' && this.commerceNegotiated)
|
|
373
|
+
this.options.onCommerceContextRequired?.();
|
|
370
374
|
}
|
|
371
375
|
}
|
|
372
376
|
write(type, payload, hello = false, barrier = null, requestedId) {
|
package/cjs/liveGuideWidget.js
CHANGED
|
@@ -257,6 +257,7 @@ class LiveGuideWidget {
|
|
|
257
257
|
},
|
|
258
258
|
...(this.commerce ? { commerce: { bootstrap: this.commerce, currentContext: () => this.commerceContext?.current ?? null,
|
|
259
259
|
...(this.commerceCart ? { cartVersion: 1 } : {}) },
|
|
260
|
+
onCommerceContextRequired: () => this.commerceContext?.refresh({ force: true }),
|
|
260
261
|
onCommerceCatalog: (value) => this.showCommerceCatalog(value),
|
|
261
262
|
onCommerceCartEvent: (type, payload) => this.commerceCart?.onEvent(type, payload) } : {}),
|
|
262
263
|
onTranscript: value => this.onTranscript(value),
|
|
@@ -487,21 +488,13 @@ class LiveGuideWidget {
|
|
|
487
488
|
return false;
|
|
488
489
|
}
|
|
489
490
|
}
|
|
490
|
-
stop() {
|
|
491
|
-
this.commerceCart?.cut();
|
|
492
|
-
this.inputEpoch++;
|
|
493
|
-
this.channel?.stop();
|
|
494
|
-
this.wakeRequested = false;
|
|
495
|
-
this.view.interruptPlayback();
|
|
496
|
-
this.commerceContext?.refresh({ force: true });
|
|
497
|
-
}
|
|
491
|
+
stop() { this.commerceCart?.cut(); this.inputEpoch++; this.channel?.stop(); this.wakeRequested = false; this.view.interruptPlayback(); }
|
|
498
492
|
privacy(reason) {
|
|
499
493
|
this.commerceCart?.cut();
|
|
500
494
|
this.inputEpoch++;
|
|
501
495
|
this.capturePrepared = false;
|
|
502
496
|
this.wakeRequested = false;
|
|
503
497
|
this.channel?.fence(reason);
|
|
504
|
-
this.commerceContext?.refresh({ force: true });
|
|
505
498
|
}
|
|
506
499
|
toText() {
|
|
507
500
|
this.privacy('mode_change');
|
package/cjs/ui.js
CHANGED
|
@@ -4863,6 +4863,7 @@ class WidgetView {
|
|
|
4863
4863
|
sheet.textContent = style + ctaOffer_js_1.CTA_OFFER_STYLES + productPanel_js_1.COMMERCE_PRODUCT_PANEL_STYLES + shoppingNotesView_js_1.SHOPPING_NOTES_STYLES + `
|
|
4864
4864
|
.panel:not(.compact) .conversation.commerce-active { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
|
|
4865
4865
|
.commerce-slot { flex: 0 1 auto; min-height: 0; max-height: min(55dvh, 420px); overflow: auto; overscroll-behavior: contain; }
|
|
4866
|
+
.commerce-panel.commerce-slot > .commerce-panel-content { max-height: none; overflow: visible; }
|
|
4866
4867
|
.panel:not(.compact) .conversation.commerce-active .captions { flex: 1 1 80px; height: auto; min-height: 64px; }
|
|
4867
4868
|
`;
|
|
4868
4869
|
this.shadow.append(sheet);
|
package/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "7.5.
|
|
1
|
+
export declare const VERSION = "7.5.31";
|
package/cjs/version.js
CHANGED
package/lib/AiLiveAssist.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare const normalizeAiGuideOpenInput: (input?: AiGuideOpenInput) => Re
|
|
|
34
34
|
export declare const resolveAiGuideProtocolVersion: (bootstrap: Pick<BootstrapConfig, "experienceMode" | "minimumProtocolVersion" | "protocol">) => 1 | 2;
|
|
35
35
|
export default class AiLiveAssist {
|
|
36
36
|
private readonly options;
|
|
37
|
-
readonly version = "7.5.
|
|
37
|
+
readonly version = "7.5.31";
|
|
38
38
|
private readonly host;
|
|
39
39
|
private readonly guideAdmission;
|
|
40
40
|
private readonly standaloneAdmissionPending;
|
package/lib/context.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare class PageContextCollector {
|
|
|
43
43
|
private releasedNavigationSettlement;
|
|
44
44
|
private navigationSettlementGeneration;
|
|
45
45
|
private navigationSettlement;
|
|
46
|
+
private cancelNavigationRenderWait;
|
|
46
47
|
private recentSelection;
|
|
47
48
|
private latestSemanticSignature;
|
|
48
49
|
constructor(callbacks: ContextCallbacks, selectorRegionRules?: SelectorRegionRule[], policyVersion?: number, trustedGuideRoot?: Element | null, statefulButtonActionProof?: boolean);
|
|
@@ -95,6 +96,7 @@ export declare class PageContextCollector {
|
|
|
95
96
|
private readSafeSelection;
|
|
96
97
|
private handleNavigation;
|
|
97
98
|
private beginNavigationSettlement;
|
|
99
|
+
private waitForNavigationRender;
|
|
98
100
|
private observeCausalNavigationAfterMutation;
|
|
99
101
|
private reportCausalNavigationObservation;
|
|
100
102
|
private resetBoundTargetIds;
|
package/lib/context.js
CHANGED
|
@@ -16,6 +16,7 @@ const SCROLL_SETTLEMENT_POSITION_TOLERANCE_PX = 1;
|
|
|
16
16
|
const SCROLL_SETTLEMENT_STABLE_MS = 250;
|
|
17
17
|
const MAX_SCROLL_LAYOUT_CORRECTIONS = 3;
|
|
18
18
|
const RELEASED_NAVIGATION_SETTLEMENT_TIMEOUT_MS = 5000;
|
|
19
|
+
const NAVIGATION_RENDER_SETTLEMENT_TIMEOUT_MS = 2000;
|
|
19
20
|
const FRAMER_GENERATED_PAGE_SELECTOR = '[data-framer-generated-page]';
|
|
20
21
|
const FRAMER_TOGGLE_ROOT_SELECTOR = '[data-framer-name="Toggle"]';
|
|
21
22
|
const FRAMER_TOGGLE_CONTROL_SELECTOR = 'div[name="Toggle Switch"][data-highlight="true"][tabindex]';
|
|
@@ -822,6 +823,7 @@ export class PageContextCollector {
|
|
|
822
823
|
this.releasedNavigationSettlement = null;
|
|
823
824
|
this.navigationSettlementGeneration = 0;
|
|
824
825
|
this.navigationSettlement = null;
|
|
826
|
+
this.cancelNavigationRenderWait = null;
|
|
825
827
|
this.recentSelection = null;
|
|
826
828
|
this.latestSemanticSignature = null;
|
|
827
829
|
this.scheduleCapture = () => {
|
|
@@ -947,6 +949,10 @@ export class PageContextCollector {
|
|
|
947
949
|
this.reportCausalNavigationObservation();
|
|
948
950
|
return;
|
|
949
951
|
}
|
|
952
|
+
// A queued history notification for this same route must not supersede
|
|
953
|
+
// its causal action while we await the page's transition.
|
|
954
|
+
if (this.navigationSettlement?.url === currentUrl)
|
|
955
|
+
return;
|
|
950
956
|
this.pageId = id('page');
|
|
951
957
|
this.revision += 1;
|
|
952
958
|
this.targets.clear();
|
|
@@ -966,7 +972,13 @@ export class PageContextCollector {
|
|
|
966
972
|
}
|
|
967
973
|
const settlement = this.beginNavigationSettlement(this.pageId, this.revision, currentUrl);
|
|
968
974
|
void Promise.resolve()
|
|
969
|
-
.then(() =>
|
|
975
|
+
.then(async () => {
|
|
976
|
+
if (typeof document.getAnimations === 'function')
|
|
977
|
+
await this.waitForNavigationRender(settlement);
|
|
978
|
+
if (!this.running || this.navigationSettlement !== settlement)
|
|
979
|
+
return false;
|
|
980
|
+
return this.callbacks.onNavigation(settlement.pageId, settlement.revision, settlement.url);
|
|
981
|
+
})
|
|
970
982
|
.then((navigationAcknowledged) => {
|
|
971
983
|
if (navigationAcknowledged === false ||
|
|
972
984
|
!this.running ||
|
|
@@ -1086,6 +1098,7 @@ export class PageContextCollector {
|
|
|
1086
1098
|
this.deferredNavigation = null;
|
|
1087
1099
|
this.releasedNavigation = null;
|
|
1088
1100
|
this.finishReleasedNavigationSettlement('rejected');
|
|
1101
|
+
this.cancelNavigationRenderWait?.();
|
|
1089
1102
|
this.navigationSettlementGeneration += 1;
|
|
1090
1103
|
this.navigationSettlement = null;
|
|
1091
1104
|
this.recentSelection = null;
|
|
@@ -1886,6 +1899,12 @@ export class PageContextCollector {
|
|
|
1886
1899
|
const settlement = navigation && this.running
|
|
1887
1900
|
? this.beginNavigationSettlement(navigation.pageId, Math.max(navigation.revision, this.revision), navigation.url)
|
|
1888
1901
|
: null;
|
|
1902
|
+
if (settlement) {
|
|
1903
|
+
if (typeof document.getAnimations === 'function')
|
|
1904
|
+
await this.waitForNavigationRender(settlement);
|
|
1905
|
+
if (!this.running || this.navigationSettlement !== settlement)
|
|
1906
|
+
return null;
|
|
1907
|
+
}
|
|
1889
1908
|
if (navigation && this.running) {
|
|
1890
1909
|
try {
|
|
1891
1910
|
navigationAcknowledged =
|
|
@@ -2507,6 +2526,7 @@ export class PageContextCollector {
|
|
|
2507
2526
|
};
|
|
2508
2527
|
}
|
|
2509
2528
|
beginNavigationSettlement(pageId, revision, url) {
|
|
2529
|
+
this.cancelNavigationRenderWait?.();
|
|
2510
2530
|
const settlement = {
|
|
2511
2531
|
generation: ++this.navigationSettlementGeneration,
|
|
2512
2532
|
pageId,
|
|
@@ -2520,6 +2540,77 @@ export class PageContextCollector {
|
|
|
2520
2540
|
this.clearMutationCapture();
|
|
2521
2541
|
return settlement;
|
|
2522
2542
|
}
|
|
2543
|
+
waitForNavigationRender(settlement) {
|
|
2544
|
+
if (!this.running || this.navigationSettlement !== settlement ||
|
|
2545
|
+
typeof document.getAnimations !== 'function')
|
|
2546
|
+
return Promise.resolve();
|
|
2547
|
+
return new Promise(resolve => {
|
|
2548
|
+
let frame = null;
|
|
2549
|
+
let finished = false;
|
|
2550
|
+
const watched = new Map();
|
|
2551
|
+
const clearAnimations = () => {
|
|
2552
|
+
for (const [animation, listener] of watched) {
|
|
2553
|
+
animation.removeEventListener('finish', listener);
|
|
2554
|
+
animation.removeEventListener('cancel', listener);
|
|
2555
|
+
}
|
|
2556
|
+
watched.clear();
|
|
2557
|
+
};
|
|
2558
|
+
const finish = () => {
|
|
2559
|
+
if (finished)
|
|
2560
|
+
return;
|
|
2561
|
+
finished = true;
|
|
2562
|
+
clearTimeout(deadline);
|
|
2563
|
+
if (frame !== null)
|
|
2564
|
+
window.cancelAnimationFrame(frame);
|
|
2565
|
+
clearAnimations();
|
|
2566
|
+
if (this.cancelNavigationRenderWait === finish)
|
|
2567
|
+
this.cancelNavigationRenderWait = null;
|
|
2568
|
+
resolve();
|
|
2569
|
+
};
|
|
2570
|
+
const check = () => {
|
|
2571
|
+
frame = null;
|
|
2572
|
+
if (finished)
|
|
2573
|
+
return;
|
|
2574
|
+
if (!this.running || this.navigationSettlement !== settlement) {
|
|
2575
|
+
finish();
|
|
2576
|
+
return;
|
|
2577
|
+
}
|
|
2578
|
+
clearAnimations();
|
|
2579
|
+
const animations = document.getAnimations().filter(animation => {
|
|
2580
|
+
const effect = animation.effect;
|
|
2581
|
+
const target = effect && 'target' in effect && effect.target instanceof Element ? effect.target : null;
|
|
2582
|
+
const root = target?.getRootNode();
|
|
2583
|
+
const guideAnimation = target && (this.mutationNodeIsInsideTrustedGuide(target) ||
|
|
2584
|
+
root instanceof ShadowRoot && root.host === this.trustedGuideRoot);
|
|
2585
|
+
return (animation.playState === 'running' || animation.pending) &&
|
|
2586
|
+
effect && Number.isFinite(Number(effect.getComputedTiming().endTime)) &&
|
|
2587
|
+
!guideAnimation;
|
|
2588
|
+
});
|
|
2589
|
+
if (animations.length === 0) {
|
|
2590
|
+
finish();
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
for (const animation of animations) {
|
|
2594
|
+
const listener = () => { clearAnimations(); schedule(); };
|
|
2595
|
+
watched.set(animation, listener);
|
|
2596
|
+
animation.addEventListener('finish', listener);
|
|
2597
|
+
animation.addEventListener('cancel', listener);
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
const schedule = () => {
|
|
2601
|
+
if (finished || frame !== null)
|
|
2602
|
+
return;
|
|
2603
|
+
// Let the router commit and paint before reading active transitions.
|
|
2604
|
+
// Await actual completion events, never poll or sleep a fixed duration.
|
|
2605
|
+
frame = window.requestAnimationFrame(() => {
|
|
2606
|
+
frame = window.requestAnimationFrame(check);
|
|
2607
|
+
});
|
|
2608
|
+
};
|
|
2609
|
+
const deadline = setTimeout(finish, NAVIGATION_RENDER_SETTLEMENT_TIMEOUT_MS);
|
|
2610
|
+
this.cancelNavigationRenderWait = finish;
|
|
2611
|
+
schedule();
|
|
2612
|
+
});
|
|
2613
|
+
}
|
|
2523
2614
|
observeCausalNavigationAfterMutation(actionId, destinationPath, beforeActionUrl) {
|
|
2524
2615
|
const currentUrl = safePageUrl();
|
|
2525
2616
|
if (currentUrl === beforeActionUrl ||
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { GuideMeasurementBridge, GuideMeasurementIntent } from './guideTypes.js';
|
|
2
|
-
export declare const GUIDE_MEASUREMENT_CLIENT_VERSION = "7.5.
|
|
2
|
+
export declare const GUIDE_MEASUREMENT_CLIENT_VERSION = "7.5.31";
|
|
3
3
|
export declare function isGuideMeasurementIntent(value: unknown): value is GuideMeasurementIntent;
|
|
4
4
|
/** The managed analytics owner supplies possession; this check grants no authority. */
|
|
5
5
|
export declare function currentGuideMeasurementBridge(value: unknown): value is GuideMeasurementBridge;
|
package/lib/guideMeasurement.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type MerchantPreviewRuntimePolicy } from './merchantPreviewOrigins.js';
|
|
2
2
|
import { type LiveDuplexMediaOptions, type LiveDuplexMediaDependencies } from './liveDuplexMedia.js';
|
|
3
3
|
import { type CommerceBootstrap, type CommerceContext, type CommerceCartSelection, type CommerceProduct, type CommerceContextClear, type LiveCommerceCatalog, type LiveCommerceDisplayed } from './commerce/contracts.js';
|
|
4
|
-
export declare const LIVE_CONTROL_CLIENT_VERSION = "7.5.
|
|
4
|
+
export declare const LIVE_CONTROL_CLIENT_VERSION = "7.5.31";
|
|
5
5
|
export declare const LIVE_CONTROL_CLIENT_CAPABILITIES: readonly ["live_duplex_v1", "live_local_wake_v1", "live_fragment_captions_v1"];
|
|
6
6
|
declare const phases: readonly ["voice_off", "local_listening", "wake_buffering", "starting", "active", "tentative_idle", "closing", "uncertain", "muted", "suspended", "budget_blocked", "ended"];
|
|
7
7
|
export type LiveControlState = {
|
|
@@ -71,6 +71,7 @@ export interface LiveControlChannelOptions {
|
|
|
71
71
|
currentContext(): CommerceContext | null;
|
|
72
72
|
cartVersion?: 1;
|
|
73
73
|
};
|
|
74
|
+
onCommerceContextRequired?(): void;
|
|
74
75
|
onCommerceCatalog?(value: LiveCommerceCatalog): void;
|
|
75
76
|
onCommerceCartEvent?(type: string, payload: unknown): void;
|
|
76
77
|
}
|
|
@@ -364,6 +364,10 @@ export class LiveControlChannel {
|
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
this.commandEpoch++;
|
|
367
|
+
// Every nonterminal cut clears the server's context, including automatic
|
|
368
|
+
// media failures. Fresh browser hints must wait behind this same barrier.
|
|
369
|
+
if (type !== 'end' && this.commerceNegotiated)
|
|
370
|
+
this.options.onCommerceContextRequired?.();
|
|
367
371
|
}
|
|
368
372
|
}
|
|
369
373
|
write(type, payload, hello = false, barrier = null, requestedId) {
|
package/lib/liveGuideWidget.js
CHANGED
|
@@ -254,6 +254,7 @@ export class LiveGuideWidget {
|
|
|
254
254
|
},
|
|
255
255
|
...(this.commerce ? { commerce: { bootstrap: this.commerce, currentContext: () => this.commerceContext?.current ?? null,
|
|
256
256
|
...(this.commerceCart ? { cartVersion: 1 } : {}) },
|
|
257
|
+
onCommerceContextRequired: () => this.commerceContext?.refresh({ force: true }),
|
|
257
258
|
onCommerceCatalog: (value) => this.showCommerceCatalog(value),
|
|
258
259
|
onCommerceCartEvent: (type, payload) => this.commerceCart?.onEvent(type, payload) } : {}),
|
|
259
260
|
onTranscript: value => this.onTranscript(value),
|
|
@@ -484,21 +485,13 @@ export class LiveGuideWidget {
|
|
|
484
485
|
return false;
|
|
485
486
|
}
|
|
486
487
|
}
|
|
487
|
-
stop() {
|
|
488
|
-
this.commerceCart?.cut();
|
|
489
|
-
this.inputEpoch++;
|
|
490
|
-
this.channel?.stop();
|
|
491
|
-
this.wakeRequested = false;
|
|
492
|
-
this.view.interruptPlayback();
|
|
493
|
-
this.commerceContext?.refresh({ force: true });
|
|
494
|
-
}
|
|
488
|
+
stop() { this.commerceCart?.cut(); this.inputEpoch++; this.channel?.stop(); this.wakeRequested = false; this.view.interruptPlayback(); }
|
|
495
489
|
privacy(reason) {
|
|
496
490
|
this.commerceCart?.cut();
|
|
497
491
|
this.inputEpoch++;
|
|
498
492
|
this.capturePrepared = false;
|
|
499
493
|
this.wakeRequested = false;
|
|
500
494
|
this.channel?.fence(reason);
|
|
501
|
-
this.commerceContext?.refresh({ force: true });
|
|
502
495
|
}
|
|
503
496
|
toText() {
|
|
504
497
|
this.privacy('mode_change');
|
package/lib/ui.js
CHANGED
|
@@ -4860,6 +4860,7 @@ export class WidgetView {
|
|
|
4860
4860
|
sheet.textContent = style + CTA_OFFER_STYLES + COMMERCE_PRODUCT_PANEL_STYLES + SHOPPING_NOTES_STYLES + `
|
|
4861
4861
|
.panel:not(.compact) .conversation.commerce-active { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
|
|
4862
4862
|
.commerce-slot { flex: 0 1 auto; min-height: 0; max-height: min(55dvh, 420px); overflow: auto; overscroll-behavior: contain; }
|
|
4863
|
+
.commerce-panel.commerce-slot > .commerce-panel-content { max-height: none; overflow: visible; }
|
|
4863
4864
|
.panel:not(.compact) .conversation.commerce-active .captions { flex: 1 1 80px; height: auto; min-height: 64px; }
|
|
4864
4865
|
`;
|
|
4865
4866
|
this.shadow.append(sheet);
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "7.5.
|
|
1
|
+
export declare const VERSION = "7.5.31";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '7.5.
|
|
1
|
+
export const VERSION = '7.5.31';
|