@oxvo/ai-live-assist 7.5.26 → 7.5.27
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/client.d.ts +7 -0
- package/cjs/client.js +12 -0
- package/cjs/guideMeasurement.d.ts +1 -1
- package/cjs/guideMeasurement.js +1 -1
- package/cjs/liveControlChannel.d.ts +3 -1
- package/cjs/liveControlChannel.js +4 -1
- package/cjs/liveGuideWidget.d.ts +20 -2
- package/cjs/liveGuideWidget.js +39 -8
- package/cjs/merchantPreview.d.ts +5 -0
- package/cjs/merchantPreview.js +148 -0
- package/cjs/merchantPreviewAdmission.d.ts +32 -0
- package/cjs/merchantPreviewAdmission.js +184 -0
- package/cjs/merchantPreviewOrigins.d.ts +6 -0
- package/cjs/merchantPreviewOrigins.js +24 -0
- package/cjs/merchantPreviewStorage.d.ts +9 -0
- package/cjs/merchantPreviewStorage.js +56 -0
- package/cjs/merchantPreviewTypes.d.ts +57 -0
- package/cjs/merchantPreviewTypes.js +2 -0
- package/cjs/standalone.d.ts +2 -0
- package/cjs/standalone.js +3 -1
- package/cjs/ui.d.ts +1 -0
- package/cjs/ui.js +8 -0
- package/cjs/version.d.ts +1 -1
- package/cjs/version.js +1 -1
- package/lib/AiLiveAssist.d.ts +1 -1
- package/lib/client.d.ts +7 -0
- package/lib/client.js +12 -0
- package/lib/guideMeasurement.d.ts +1 -1
- package/lib/guideMeasurement.js +1 -1
- package/lib/liveControlChannel.d.ts +3 -1
- package/lib/liveControlChannel.js +4 -1
- package/lib/liveGuideWidget.d.ts +20 -2
- package/lib/liveGuideWidget.js +39 -8
- package/lib/merchantPreview.d.ts +5 -0
- package/lib/merchantPreview.js +144 -0
- package/lib/merchantPreviewAdmission.d.ts +32 -0
- package/lib/merchantPreviewAdmission.js +179 -0
- package/lib/merchantPreviewOrigins.d.ts +6 -0
- package/lib/merchantPreviewOrigins.js +18 -0
- package/lib/merchantPreviewStorage.d.ts +9 -0
- package/lib/merchantPreviewStorage.js +50 -0
- package/lib/merchantPreviewTypes.d.ts +57 -0
- package/lib/merchantPreviewTypes.js +1 -0
- package/lib/standalone.d.ts +2 -0
- package/lib/standalone.js +1 -0
- package/lib/ui.d.ts +1 -0
- package/lib/ui.js +8 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { RuntimeClientError } from './client.js';
|
|
2
|
+
import { GuideSubjectStore } from './guideSubjectStore.js';
|
|
3
|
+
import { GUIDE_SUBJECT_CREDENTIAL_PATTERN, GUIDE_UUID_PATTERN } from './guideTypes.js';
|
|
4
|
+
import { merchantPreviewNamespace, merchantPreviewStorageKeys, saveMerchantPreviewRecovery } from './merchantPreviewStorage.js';
|
|
5
|
+
export { merchantPreviewNamespace } from './merchantPreviewStorage.js';
|
|
6
|
+
const unavailable = () => new RuntimeClientError('MERCHANT_PREVIEW_UNAVAILABLE', 'This preview is no longer available. Open a new preview from OXVO.', false, null, 409);
|
|
7
|
+
export class MerchantPreviewAdmission {
|
|
8
|
+
constructor(preview, bootstrap, runtime, storage = sessionStorage, recoveryOnly = false) {
|
|
9
|
+
this.preview = preview;
|
|
10
|
+
this.bootstrap = bootstrap;
|
|
11
|
+
this.runtime = runtime;
|
|
12
|
+
this.storage = storage;
|
|
13
|
+
this.recoveryOnly = recoveryOnly;
|
|
14
|
+
this.endMessage = 'Preview ended. Return to Console to open another preview.';
|
|
15
|
+
this.admission = null;
|
|
16
|
+
this.admitting = null;
|
|
17
|
+
this.ending = null;
|
|
18
|
+
const namespace = merchantPreviewNamespace(preview.targetOrigin, preview.previewId);
|
|
19
|
+
this.store = new GuideSubjectStore(bootstrap, preview.targetOrigin, namespace, storage);
|
|
20
|
+
this.originalKey = merchantPreviewStorageKeys(preview).original;
|
|
21
|
+
this.grant = recoveryOnly ? '' : preview.previewGrant;
|
|
22
|
+
}
|
|
23
|
+
canStart() { return !this.recoveryOnly && !this.original() && Date.now() < Date.parse(this.preview.launchExpiresAt); }
|
|
24
|
+
hasPendingLaunch() { const original = this.original(); return original !== null && !original.completed; }
|
|
25
|
+
pendingLaunchId() { const original = this.original(); return original && !original.completed ? original.intent.launchRequestId : null; }
|
|
26
|
+
destroy() { this.grant = ''; }
|
|
27
|
+
async launch(input, signal) {
|
|
28
|
+
try {
|
|
29
|
+
return await this.start(input, signal);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
this.reportError(error);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
reportError(error) {
|
|
37
|
+
const code = error instanceof RuntimeClientError && /^[A-Z][A-Z0-9_]{0,63}$/.test(error.code)
|
|
38
|
+
? error.code : 'MERCHANT_PREVIEW_UNAVAILABLE';
|
|
39
|
+
try {
|
|
40
|
+
this.preview.onError?.(code);
|
|
41
|
+
}
|
|
42
|
+
catch { /* Feedback cannot interrupt original-session cleanup. */ }
|
|
43
|
+
}
|
|
44
|
+
async start(input, signal) {
|
|
45
|
+
if (signal.aborted || !this.canStart() || location.origin !== this.preview.targetOrigin ||
|
|
46
|
+
location.pathname !== this.preview.targetPath || input.path !== this.preview.targetPath ||
|
|
47
|
+
input.configRevision !== this.preview.configurationRevision)
|
|
48
|
+
throw unavailable();
|
|
49
|
+
const intent = {
|
|
50
|
+
schemaVersion: 3, protocolVersion: 2, installKey: this.bootstrap.installKey,
|
|
51
|
+
previewId: this.preview.previewId, launchRequestId: input.launchRequestId,
|
|
52
|
+
clientVersion: input.clientVersion, liveCapabilities: [...input.liveCapabilities],
|
|
53
|
+
configRevision: input.configRevision, path: input.path, tabId: input.tabId, mode: input.mode,
|
|
54
|
+
experienceMode: 'standard', consent: { ...input.consent, scopes: [...input.consent.scopes] },
|
|
55
|
+
capabilitySummary: { ...input.capabilitySummary },
|
|
56
|
+
};
|
|
57
|
+
saveMerchantPreviewRecovery(this.preview, this.bootstrap, this.storage);
|
|
58
|
+
this.writeOriginal({ v: 1, previewId: this.preview.previewId, intent, completed: false });
|
|
59
|
+
const admission = await this.admit(intent, signal);
|
|
60
|
+
if (signal.aborted || this.original()?.completed)
|
|
61
|
+
throw unavailable();
|
|
62
|
+
const result = await this.runtime.launchMerchantPreview(intent, admission.admissionGrant, signal);
|
|
63
|
+
if (result.previewId !== this.preview.previewId || result.projectId !== this.preview.projectId ||
|
|
64
|
+
result.guideId !== this.preview.guideId || result.subjectId !== admission.subjectId ||
|
|
65
|
+
result.launchRequestId !== intent.launchRequestId)
|
|
66
|
+
throw unavailable();
|
|
67
|
+
// The existing control protocol validates its exact envelope, without preview metadata.
|
|
68
|
+
const authorization = { ...result };
|
|
69
|
+
delete authorization.previewId;
|
|
70
|
+
return authorization;
|
|
71
|
+
}
|
|
72
|
+
end(signal, expectedLaunchRequestId) {
|
|
73
|
+
if (this.ending)
|
|
74
|
+
return this.ending;
|
|
75
|
+
const original = this.original();
|
|
76
|
+
if (!original || original.completed || (expectedLaunchRequestId !== undefined &&
|
|
77
|
+
original.intent.launchRequestId !== expectedLaunchRequestId))
|
|
78
|
+
return Promise.resolve();
|
|
79
|
+
const operation = this.finish(original, signal).catch(error => { this.reportError(error); throw error; })
|
|
80
|
+
.finally(() => { if (this.ending === operation)
|
|
81
|
+
this.ending = null; });
|
|
82
|
+
this.ending = operation;
|
|
83
|
+
return operation;
|
|
84
|
+
}
|
|
85
|
+
async finish(original, signal) {
|
|
86
|
+
if (this.admitting)
|
|
87
|
+
await this.admitting.catch(() => undefined);
|
|
88
|
+
let subject = this.store.readSubject();
|
|
89
|
+
if (!subject) {
|
|
90
|
+
// An ambiguous admission can be recovered only with its original intent and in-memory grant.
|
|
91
|
+
if (!this.grant)
|
|
92
|
+
throw new RuntimeClientError('MERCHANT_PREVIEW_END_UNRESOLVED', 'The previous preview could not be confirmed. Return to the original Console tab to check its status or wait for it to expire.', false, null, 409);
|
|
93
|
+
await this.admit(original.intent, signal);
|
|
94
|
+
subject = this.store.readSubject();
|
|
95
|
+
}
|
|
96
|
+
if (!subject || this.original()?.intent.launchRequestId !== original.intent.launchRequestId)
|
|
97
|
+
throw unavailable();
|
|
98
|
+
const result = await this.runtime.endMerchantPreview({ schemaVersion: 3, previewId: this.preview.previewId,
|
|
99
|
+
installKey: this.bootstrap.installKey, subjectCredential: subject.credential,
|
|
100
|
+
launchRequestId: original.intent.launchRequestId, tabId: original.intent.tabId, action: 'end' }, signal);
|
|
101
|
+
if (!result || Object.keys(result).length !== 6 || result.schemaVersion !== 3 || result.protocolVersion !== 2 ||
|
|
102
|
+
result.providerProtocol !== 'live' || result.status !== 'end_requested' || result.previewId !== this.preview.previewId ||
|
|
103
|
+
result.launchRequestId !== original.intent.launchRequestId)
|
|
104
|
+
throw unavailable();
|
|
105
|
+
this.writeOriginal({ ...original, completed: true });
|
|
106
|
+
this.store.clearLaunch(original.intent.launchRequestId);
|
|
107
|
+
this.admission = null;
|
|
108
|
+
this.grant = '';
|
|
109
|
+
}
|
|
110
|
+
async admit(intent, signal) {
|
|
111
|
+
if (this.admission)
|
|
112
|
+
return this.admission;
|
|
113
|
+
if (this.admitting)
|
|
114
|
+
return this.admitting;
|
|
115
|
+
if (!this.grant)
|
|
116
|
+
throw unavailable();
|
|
117
|
+
const subject = this.store.readSubject();
|
|
118
|
+
const operation = this.runtime.admitMerchantPreview(intent, this.grant, subject?.credential, signal).then(result => {
|
|
119
|
+
const required = ['schemaVersion', 'protocolVersion', 'providerProtocol', 'previewId', 'projectId', 'guideId', 'subjectId',
|
|
120
|
+
'subjectAuthorityRevision', 'tabId', 'launchRequestId', 'configRevision', 'configChecksum', 'admissionGrant',
|
|
121
|
+
'expiresAt', 'subjectCredentialExpiresAt'];
|
|
122
|
+
if (!result || Object.keys(result).some(key => ![...required, 'subjectCredential'].includes(key)) ||
|
|
123
|
+
required.some(key => !(key in result)) || result.schemaVersion !== 3 || result.protocolVersion !== 2 ||
|
|
124
|
+
result.providerProtocol !== 'live' || result.previewId !== this.preview.previewId || result.projectId !== this.preview.projectId ||
|
|
125
|
+
result.guideId !== this.preview.guideId || !GUIDE_UUID_PATTERN.test(result.subjectId) ||
|
|
126
|
+
result.tabId !== intent.tabId || result.launchRequestId !== intent.launchRequestId ||
|
|
127
|
+
result.configRevision !== this.preview.configurationRevision || result.configChecksum !== this.bootstrap.configChecksum ||
|
|
128
|
+
!Number.isSafeInteger(result.subjectAuthorityRevision) || result.subjectAuthorityRevision < 0 ||
|
|
129
|
+
typeof result.admissionGrant !== 'string' || result.admissionGrant.length < 1 || result.admissionGrant.length > 4096 ||
|
|
130
|
+
!Number.isFinite(Date.parse(result.expiresAt)) || Date.parse(result.expiresAt) <= Date.now() ||
|
|
131
|
+
!Number.isFinite(Date.parse(result.subjectCredentialExpiresAt)) || Date.parse(result.subjectCredentialExpiresAt) <= Date.now() ||
|
|
132
|
+
(subject && (result.subjectId !== subject.subjectId || result.subjectAuthorityRevision !== subject.subjectAuthorityRevision)))
|
|
133
|
+
throw unavailable();
|
|
134
|
+
const credential = subject?.credential ?? result.subjectCredential;
|
|
135
|
+
if (!credential || !GUIDE_SUBJECT_CREDENTIAL_PATTERN.test(credential))
|
|
136
|
+
throw unavailable();
|
|
137
|
+
this.store.saveSubject({ v: 1, origin: this.preview.targetOrigin, projectId: this.preview.projectId, guideId: this.preview.guideId,
|
|
138
|
+
subjectId: result.subjectId, subjectAuthorityRevision: result.subjectAuthorityRevision, credential, expiresAt: result.subjectCredentialExpiresAt });
|
|
139
|
+
this.store.saveLaunch({ v: 1, subjectId: result.subjectId, intent, recordingConsent: false });
|
|
140
|
+
this.admission = result;
|
|
141
|
+
return result;
|
|
142
|
+
}).finally(() => { if (this.admitting === operation)
|
|
143
|
+
this.admitting = null; });
|
|
144
|
+
this.admitting = operation;
|
|
145
|
+
return operation;
|
|
146
|
+
}
|
|
147
|
+
original() {
|
|
148
|
+
const raw = this.storage.getItem(this.originalKey);
|
|
149
|
+
if (raw === null)
|
|
150
|
+
return null;
|
|
151
|
+
if (raw.length > 16384)
|
|
152
|
+
throw unavailable();
|
|
153
|
+
let value;
|
|
154
|
+
try {
|
|
155
|
+
value = JSON.parse(raw);
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
throw unavailable();
|
|
159
|
+
}
|
|
160
|
+
const intent = value?.intent;
|
|
161
|
+
if (value?.v !== 1 || value.previewId !== this.preview.previewId || typeof value.completed !== 'boolean' ||
|
|
162
|
+
!intent || intent.schemaVersion !== 3 || intent.protocolVersion !== 2 || intent.previewId !== this.preview.previewId ||
|
|
163
|
+
intent.installKey !== this.bootstrap.installKey || intent.configRevision !== this.preview.configurationRevision ||
|
|
164
|
+
intent.path !== this.preview.targetPath || !GUIDE_UUID_PATTERN.test(intent.launchRequestId) ||
|
|
165
|
+
typeof intent.tabId !== 'string' || !/^[A-Za-z0-9_.:/-]{1,128}$/.test(intent.tabId) ||
|
|
166
|
+
!['text', 'voice'].includes(intent.mode) || intent.experienceMode !== 'standard' ||
|
|
167
|
+
'guideMeasurement' in intent || 'previewGrant' in intent || 'admissionGrant' in intent)
|
|
168
|
+
throw unavailable();
|
|
169
|
+
return value;
|
|
170
|
+
}
|
|
171
|
+
writeOriginal(value) {
|
|
172
|
+
const raw = JSON.stringify(value);
|
|
173
|
+
if (raw.length > 16384)
|
|
174
|
+
throw unavailable();
|
|
175
|
+
this.storage.setItem(this.originalKey, raw);
|
|
176
|
+
if (this.storage.getItem(this.originalKey) !== raw)
|
|
177
|
+
throw unavailable();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type MerchantPreviewRuntimePolicy = {
|
|
2
|
+
developmentConsoleOrigin?: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const isLoopbackHostname: (hostname: string) => boolean;
|
|
5
|
+
export declare function isLocalConsoleOrigin(value: string): boolean;
|
|
6
|
+
export declare function isPreviewRuntimeOrigin(url: URL, policy?: MerchantPreviewRuntimePolicy): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const isLoopbackHostname = (hostname) => hostname === 'localhost' ||
|
|
2
|
+
hostname.endsWith('.localhost') || /^127(?:\.\d{1,3}){3}$/.test(hostname) || hostname === '[::1]';
|
|
3
|
+
export function isLocalConsoleOrigin(value) {
|
|
4
|
+
try {
|
|
5
|
+
const url = new URL(value);
|
|
6
|
+
return value === url.origin && ['http:', 'https:'].includes(url.protocol) &&
|
|
7
|
+
!url.username && !url.password && isLoopbackHostname(url.hostname);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
// The dev alias is accepted only for a preview whose installed loader pinned a local Console.
|
|
14
|
+
export function isPreviewRuntimeOrigin(url, policy = {}) {
|
|
15
|
+
return url.protocol === 'https:' || (url.protocol === 'http:' && (isLoopbackHostname(url.hostname) ||
|
|
16
|
+
(url.hostname === 'oxvosessions.local' && typeof policy.developmentConsoleOrigin === 'string' &&
|
|
17
|
+
isLocalConsoleOrigin(policy.developmentConsoleOrigin))));
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MerchantPreviewBootstrap, MerchantPreviewOptions } from './merchantPreviewTypes.js';
|
|
2
|
+
export declare function merchantPreviewNamespace(origin: string, previewId: string): string;
|
|
3
|
+
export declare function merchantPreviewStorageKeys(preview: Pick<MerchantPreviewOptions, 'targetOrigin' | 'previewId'>): {
|
|
4
|
+
namespace: string;
|
|
5
|
+
original: string;
|
|
6
|
+
recovery: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function saveMerchantPreviewRecovery(preview: MerchantPreviewOptions, bootstrap: MerchantPreviewBootstrap, storage: Storage): void;
|
|
9
|
+
export declare function readMerchantPreviewRecovery(preview: MerchantPreviewOptions, storage: Storage): MerchantPreviewBootstrap | null;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { GUIDE_UUID_PATTERN } from './guideTypes.js';
|
|
2
|
+
const invalid = () => new Error('The previous preview could not be recovered. Return to the original Console tab to check its status or wait for it to expire.');
|
|
3
|
+
const PREVIEW_FIELDS = ['previewId', 'projectId', 'guideId', 'configurationVersionId', 'configurationRevision',
|
|
4
|
+
'configurationChecksum', 'targetOrigin', 'targetPath', 'launchExpiresAt', 'expiresAt', 'runtimeUrl', 'widgetVersion'];
|
|
5
|
+
const BOOTSTRAP_FIELDS = ['schemaVersion', 'projectId', 'guideId', 'installKey', 'protocol', 'available', 'configRevision',
|
|
6
|
+
'configChecksum', 'providerProtocol', 'providerModel', 'liveCapabilities', 'liveAssets', 'widgetVersion',
|
|
7
|
+
'experienceMode', 'replayRecordingEnabled', 'capabilities', 'consent', 'cache', 'merchantPreview'];
|
|
8
|
+
const APPEARANCE_FIELDS = ['brandName', 'launcherLabel', 'accent', 'position', 'panelWidth', 'glassEffect',
|
|
9
|
+
'hideLauncherWhenVisitorLimited', 'theme', 'welcomeMessage', 'compactEntryEnabled'];
|
|
10
|
+
export function merchantPreviewNamespace(origin, previewId) {
|
|
11
|
+
if (new URL(origin).origin !== origin || !GUIDE_UUID_PATTERN.test(previewId))
|
|
12
|
+
throw invalid();
|
|
13
|
+
return `merchant_preview_v1_${encodeURIComponent(origin)}_${previewId}`;
|
|
14
|
+
}
|
|
15
|
+
export function merchantPreviewStorageKeys(preview) {
|
|
16
|
+
const namespace = merchantPreviewNamespace(preview.targetOrigin, preview.previewId);
|
|
17
|
+
return { namespace, original: `__oxvo_ai_guide_preview_launch_${namespace}`, recovery: `__oxvo_ai_guide_preview_recovery_${namespace}` };
|
|
18
|
+
}
|
|
19
|
+
const pick = (value, fields) => Object.fromEntries(fields.filter(key => key in value)
|
|
20
|
+
.map(key => [key, value[key]]));
|
|
21
|
+
export function saveMerchantPreviewRecovery(preview, bootstrap, storage) {
|
|
22
|
+
const presentation = { ...pick(bootstrap, BOOTSTRAP_FIELDS),
|
|
23
|
+
...(bootstrap.appearance ? { appearance: pick(bootstrap.appearance, APPEARANCE_FIELDS) } : {}) };
|
|
24
|
+
const raw = JSON.stringify({ v: 1, preview: pick(preview, PREVIEW_FIELDS), bootstrap: presentation });
|
|
25
|
+
if (raw.length > 65536 || /"(?:previewGrant|admissionGrant|controlCredential|subjectCredential)"\s*:/.test(raw))
|
|
26
|
+
throw invalid();
|
|
27
|
+
const key = merchantPreviewStorageKeys(preview).recovery;
|
|
28
|
+
storage.setItem(key, raw);
|
|
29
|
+
if (storage.getItem(key) !== raw)
|
|
30
|
+
throw invalid();
|
|
31
|
+
}
|
|
32
|
+
export function readMerchantPreviewRecovery(preview, storage) {
|
|
33
|
+
const keys = merchantPreviewStorageKeys(preview);
|
|
34
|
+
if (storage.getItem(keys.original) === null)
|
|
35
|
+
return null;
|
|
36
|
+
const raw = storage.getItem(keys.recovery);
|
|
37
|
+
if (!raw || raw.length > 65536)
|
|
38
|
+
throw invalid();
|
|
39
|
+
let value;
|
|
40
|
+
try {
|
|
41
|
+
value = JSON.parse(raw);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
throw invalid();
|
|
45
|
+
}
|
|
46
|
+
if (value?.v !== 1 || !value.preview || !value.bootstrap ||
|
|
47
|
+
JSON.stringify(value.preview) !== JSON.stringify(pick(preview, PREVIEW_FIELDS)))
|
|
48
|
+
throw invalid();
|
|
49
|
+
return value.bootstrap;
|
|
50
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { GuideAdmissionResult, GuideBootstrapConfig, GuideLaunchRecoveryInput } from './guideTypes.js';
|
|
2
|
+
import type { LiveGuideLaunchIntent } from './liveGuideAdmission.js';
|
|
3
|
+
import type { AiGuideControllerState } from './types.js';
|
|
4
|
+
export type MerchantPreviewOptions = {
|
|
5
|
+
previewId: string;
|
|
6
|
+
projectId: number;
|
|
7
|
+
guideId: string;
|
|
8
|
+
configurationVersionId: number;
|
|
9
|
+
configurationRevision: number;
|
|
10
|
+
configurationChecksum: string;
|
|
11
|
+
targetOrigin: string;
|
|
12
|
+
targetPath: string;
|
|
13
|
+
launchExpiresAt: string;
|
|
14
|
+
expiresAt: string;
|
|
15
|
+
runtimeUrl: string;
|
|
16
|
+
widgetVersion: string;
|
|
17
|
+
previewGrant: string;
|
|
18
|
+
developmentConsoleOrigin?: string;
|
|
19
|
+
onState?(state: AiGuideControllerState): void;
|
|
20
|
+
onError?(code: string): void;
|
|
21
|
+
};
|
|
22
|
+
export type MerchantPreviewBootstrapInput = {
|
|
23
|
+
schemaVersion: 1;
|
|
24
|
+
previewId: string;
|
|
25
|
+
previewGrant: string;
|
|
26
|
+
path: string;
|
|
27
|
+
requestedLocale?: string;
|
|
28
|
+
};
|
|
29
|
+
export type MerchantPreviewBootstrap = GuideBootstrapConfig & {
|
|
30
|
+
providerProtocol: 'live';
|
|
31
|
+
merchantPreview: {
|
|
32
|
+
previewId: string;
|
|
33
|
+
configurationVersionId: number;
|
|
34
|
+
targetOrigin: string;
|
|
35
|
+
targetPath: string;
|
|
36
|
+
expiresAt: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type MerchantPreviewLaunchIntent = Omit<LiveGuideLaunchIntent, 'guideMeasurement'> & {
|
|
40
|
+
previewId: string;
|
|
41
|
+
};
|
|
42
|
+
export type MerchantPreviewAdmissionResult = GuideAdmissionResult & {
|
|
43
|
+
providerProtocol: 'live';
|
|
44
|
+
previewId: string;
|
|
45
|
+
};
|
|
46
|
+
export type MerchantPreviewEndInput = GuideLaunchRecoveryInput & {
|
|
47
|
+
previewId: string;
|
|
48
|
+
action: 'end';
|
|
49
|
+
};
|
|
50
|
+
export type MerchantPreviewEndResult = {
|
|
51
|
+
schemaVersion: 3;
|
|
52
|
+
protocolVersion: 2;
|
|
53
|
+
providerProtocol: 'live';
|
|
54
|
+
status: 'end_requested';
|
|
55
|
+
launchRequestId: string;
|
|
56
|
+
previewId: string;
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/standalone.d.ts
CHANGED
|
@@ -4,3 +4,5 @@ export { createGuideRecordingNetworkCapture, observeGuideRecording, } from "./gu
|
|
|
4
4
|
export type { GuideRecordingObserver, GuideRecordingSource, GuideRecordingLink, } from "./guideRecording.js";
|
|
5
5
|
/** Install a Guide without importing, initializing or consulting a recorder. */
|
|
6
6
|
export declare function installAiGuide(options: StandaloneGuideOptions): Promise<AiGuideController | undefined>;
|
|
7
|
+
export { installMerchantGuidePreview } from './merchantPreview.js';
|
|
8
|
+
export type { MerchantPreviewOptions } from './merchantPreviewTypes.js';
|
package/lib/standalone.js
CHANGED
package/lib/ui.d.ts
CHANGED
package/lib/ui.js
CHANGED
|
@@ -4865,6 +4865,14 @@ export class WidgetView {
|
|
|
4865
4865
|
this.shadow.append(this.build());
|
|
4866
4866
|
document.documentElement.append(this.host);
|
|
4867
4867
|
this.panel = this.require(".panel");
|
|
4868
|
+
if (options.contextNotice) {
|
|
4869
|
+
const notice = document.createElement("p");
|
|
4870
|
+
notice.dataset.role = "context-notice";
|
|
4871
|
+
notice.textContent = options.contextNotice.slice(0, 240);
|
|
4872
|
+
notice.style.cssText = "margin:0;padding:4px 0;font-size:12px;line-height:1.4;color:var(--assist-muted)";
|
|
4873
|
+
this.require(".header .identity").append(notice);
|
|
4874
|
+
this.require('[data-role="intro-entry"]').prepend(notice.cloneNode(true));
|
|
4875
|
+
}
|
|
4868
4876
|
this.body = this.require(".body");
|
|
4869
4877
|
this.status = this.require('[data-role="status"]');
|
|
4870
4878
|
this.duration = this.require('[data-role="duration"]');
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "7.5.
|
|
1
|
+
export declare const VERSION = "7.5.27";
|
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '7.5.
|
|
1
|
+
export const VERSION = '7.5.27';
|