@promptbook/components 0.112.0-48 → 0.112.0-49
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/esm/index.es.js +310 -44
- package/esm/index.es.js.map +1 -1
- package/esm/src/avatars/avatarAnimationScheduler.d.ts +16 -0
- package/esm/src/avatars/avatarPointerTracking.d.ts +16 -0
- package/esm/src/avatars/avatarVisibilityTracking.d.ts +17 -0
- package/esm/src/avatars/renderAvatarVisual.d.ts +29 -1
- package/esm/src/book-components/Chat/Chat/ChatProps.d.ts +3 -3
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +310 -44
- package/umd/index.umd.js.map +1 -1
- package/umd/src/avatars/avatarAnimationScheduler.d.ts +16 -0
- package/umd/src/avatars/avatarPointerTracking.d.ts +16 -0
- package/umd/src/avatars/avatarVisibilityTracking.d.ts +17 -0
- package/umd/src/avatars/renderAvatarVisual.d.ts +29 -1
- package/umd/src/book-components/Chat/Chat/ChatProps.d.ts +3 -3
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -40,7 +40,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
40
40
|
* @generated
|
|
41
41
|
* @see https://github.com/webgptorg/promptbook
|
|
42
42
|
*/
|
|
43
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
43
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-49';
|
|
44
44
|
/**
|
|
45
45
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
46
46
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -1519,10 +1519,22 @@ function createAvatarRandomFactory(avatarDefinition) {
|
|
|
1519
1519
|
*/
|
|
1520
1520
|
function prepareAvatarCanvas(canvas, context, size, devicePixelRatio) {
|
|
1521
1521
|
const normalizedDevicePixelRatio = Math.max(1, Math.round(devicePixelRatio * 100) / 100);
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1522
|
+
const nextCanvasWidth = Math.round(size * normalizedDevicePixelRatio);
|
|
1523
|
+
const nextCanvasHeight = Math.round(size * normalizedDevicePixelRatio);
|
|
1524
|
+
const nextCanvasStyleWidth = `${size}px`;
|
|
1525
|
+
const nextCanvasStyleHeight = `${size}px`;
|
|
1526
|
+
if (canvas.width !== nextCanvasWidth) {
|
|
1527
|
+
canvas.width = nextCanvasWidth;
|
|
1528
|
+
}
|
|
1529
|
+
if (canvas.height !== nextCanvasHeight) {
|
|
1530
|
+
canvas.height = nextCanvasHeight;
|
|
1531
|
+
}
|
|
1532
|
+
if (canvas.style.width !== nextCanvasStyleWidth) {
|
|
1533
|
+
canvas.style.width = nextCanvasStyleWidth;
|
|
1534
|
+
}
|
|
1535
|
+
if (canvas.style.height !== nextCanvasStyleHeight) {
|
|
1536
|
+
canvas.style.height = nextCanvasStyleHeight;
|
|
1537
|
+
}
|
|
1526
1538
|
context.setTransform(normalizedDevicePixelRatio, 0, 0, normalizedDevicePixelRatio, 0, 0);
|
|
1527
1539
|
context.clearRect(0, 0, size, size);
|
|
1528
1540
|
}
|
|
@@ -26079,6 +26091,138 @@ function interpolateExponentially(currentValue, targetValue, deltaMs, smoothingW
|
|
|
26079
26091
|
return currentValue + (targetValue - currentValue) * blend;
|
|
26080
26092
|
}
|
|
26081
26093
|
|
|
26094
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26095
|
+
/**
|
|
26096
|
+
* Next registration id used by the shared avatar animation scheduler.
|
|
26097
|
+
*
|
|
26098
|
+
* @private utility of the avatar rendering system
|
|
26099
|
+
*/
|
|
26100
|
+
let nextAvatarAnimationListenerId = 1;
|
|
26101
|
+
/**
|
|
26102
|
+
* Active avatar animation callbacks keyed by their registration id.
|
|
26103
|
+
*
|
|
26104
|
+
* @private utility of the avatar rendering system
|
|
26105
|
+
*/
|
|
26106
|
+
const avatarAnimationListeners = new Map();
|
|
26107
|
+
/**
|
|
26108
|
+
* Active shared animation-frame handle.
|
|
26109
|
+
*
|
|
26110
|
+
* @private utility of the avatar rendering system
|
|
26111
|
+
*/
|
|
26112
|
+
let avatarAnimationFrameId = null;
|
|
26113
|
+
/**
|
|
26114
|
+
* Registers one avatar animation callback in the shared animation loop.
|
|
26115
|
+
*
|
|
26116
|
+
* @param avatarAnimationListener Frame callback invoked on every animation frame.
|
|
26117
|
+
* @returns Cleanup function that unregisters the callback.
|
|
26118
|
+
*
|
|
26119
|
+
* @private utility of the avatar rendering system
|
|
26120
|
+
*/
|
|
26121
|
+
function retainAvatarAnimationListener(avatarAnimationListener) {
|
|
26122
|
+
if (typeof window === 'undefined') {
|
|
26123
|
+
return () => undefined;
|
|
26124
|
+
}
|
|
26125
|
+
const listenerId = nextAvatarAnimationListenerId++;
|
|
26126
|
+
avatarAnimationListeners.set(listenerId, avatarAnimationListener);
|
|
26127
|
+
ensureAvatarAnimationLoop();
|
|
26128
|
+
return () => {
|
|
26129
|
+
avatarAnimationListeners.delete(listenerId);
|
|
26130
|
+
if (avatarAnimationListeners.size === 0 && avatarAnimationFrameId !== null) {
|
|
26131
|
+
window.cancelAnimationFrame(avatarAnimationFrameId);
|
|
26132
|
+
avatarAnimationFrameId = null;
|
|
26133
|
+
}
|
|
26134
|
+
};
|
|
26135
|
+
}
|
|
26136
|
+
/**
|
|
26137
|
+
* Ensures the shared animation loop is running while at least one avatar listener is active.
|
|
26138
|
+
*
|
|
26139
|
+
* @private utility of the avatar rendering system
|
|
26140
|
+
*/
|
|
26141
|
+
function ensureAvatarAnimationLoop() {
|
|
26142
|
+
if (avatarAnimationFrameId !== null || avatarAnimationListeners.size === 0 || typeof window === 'undefined') {
|
|
26143
|
+
return;
|
|
26144
|
+
}
|
|
26145
|
+
const runFrame = (now) => {
|
|
26146
|
+
avatarAnimationFrameId = null;
|
|
26147
|
+
for (const avatarAnimationListener of [...avatarAnimationListeners.values()]) {
|
|
26148
|
+
avatarAnimationListener(now);
|
|
26149
|
+
}
|
|
26150
|
+
ensureAvatarAnimationLoop();
|
|
26151
|
+
};
|
|
26152
|
+
avatarAnimationFrameId = window.requestAnimationFrame(runFrame);
|
|
26153
|
+
}
|
|
26154
|
+
|
|
26155
|
+
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26156
|
+
/**
|
|
26157
|
+
* Shared `IntersectionObserver` callbacks grouped by observed element.
|
|
26158
|
+
*
|
|
26159
|
+
* @private utility of the avatar rendering system
|
|
26160
|
+
*/
|
|
26161
|
+
const avatarVisibilityListeners = new Map();
|
|
26162
|
+
/**
|
|
26163
|
+
* Lazily created shared `IntersectionObserver` used by avatar canvases.
|
|
26164
|
+
*
|
|
26165
|
+
* @private utility of the avatar rendering system
|
|
26166
|
+
*/
|
|
26167
|
+
let avatarVisibilityObserver = null;
|
|
26168
|
+
/**
|
|
26169
|
+
* Observes one avatar element and notifies the caller when it enters or leaves the viewport.
|
|
26170
|
+
*
|
|
26171
|
+
* @param element Observed avatar element.
|
|
26172
|
+
* @param avatarVisibilityListener Listener notified with the current visibility state.
|
|
26173
|
+
* @returns Cleanup function that stops observing the element.
|
|
26174
|
+
*
|
|
26175
|
+
* @private utility of the avatar rendering system
|
|
26176
|
+
*/
|
|
26177
|
+
function observeAvatarVisibility(element, avatarVisibilityListener) {
|
|
26178
|
+
if (typeof window === 'undefined' || typeof IntersectionObserver === 'undefined') {
|
|
26179
|
+
avatarVisibilityListener(true);
|
|
26180
|
+
return () => undefined;
|
|
26181
|
+
}
|
|
26182
|
+
const observer = getAvatarVisibilityObserver();
|
|
26183
|
+
const elementListeners = avatarVisibilityListeners.get(element) || new Set();
|
|
26184
|
+
elementListeners.add(avatarVisibilityListener);
|
|
26185
|
+
avatarVisibilityListeners.set(element, elementListeners);
|
|
26186
|
+
observer.observe(element);
|
|
26187
|
+
return () => {
|
|
26188
|
+
const currentElementListeners = avatarVisibilityListeners.get(element);
|
|
26189
|
+
if (!currentElementListeners) {
|
|
26190
|
+
return;
|
|
26191
|
+
}
|
|
26192
|
+
currentElementListeners.delete(avatarVisibilityListener);
|
|
26193
|
+
if (currentElementListeners.size > 0) {
|
|
26194
|
+
return;
|
|
26195
|
+
}
|
|
26196
|
+
avatarVisibilityListeners.delete(element);
|
|
26197
|
+
observer.unobserve(element);
|
|
26198
|
+
};
|
|
26199
|
+
}
|
|
26200
|
+
/**
|
|
26201
|
+
* Creates the shared `IntersectionObserver` used by all avatar canvases.
|
|
26202
|
+
*
|
|
26203
|
+
* @returns Shared observer instance.
|
|
26204
|
+
*
|
|
26205
|
+
* @private utility of the avatar rendering system
|
|
26206
|
+
*/
|
|
26207
|
+
function getAvatarVisibilityObserver() {
|
|
26208
|
+
if (avatarVisibilityObserver) {
|
|
26209
|
+
return avatarVisibilityObserver;
|
|
26210
|
+
}
|
|
26211
|
+
avatarVisibilityObserver = new IntersectionObserver((entries) => {
|
|
26212
|
+
for (const entry of entries) {
|
|
26213
|
+
const elementListeners = avatarVisibilityListeners.get(entry.target);
|
|
26214
|
+
if (!elementListeners) {
|
|
26215
|
+
continue;
|
|
26216
|
+
}
|
|
26217
|
+
const isVisible = entry.isIntersecting && entry.intersectionRatio > 0;
|
|
26218
|
+
for (const avatarVisibilityListener of elementListeners) {
|
|
26219
|
+
avatarVisibilityListener(isVisible);
|
|
26220
|
+
}
|
|
26221
|
+
}
|
|
26222
|
+
});
|
|
26223
|
+
return avatarVisibilityObserver;
|
|
26224
|
+
}
|
|
26225
|
+
|
|
26082
26226
|
// Note: [💞] Ignore a discrepancy between file name and entity name
|
|
26083
26227
|
/**
|
|
26084
26228
|
* Active avatar instances currently consuming the shared pointer tracker.
|
|
@@ -26092,6 +26236,18 @@ let avatarPointerTrackingConsumerCount = 0;
|
|
|
26092
26236
|
* @private utility of the avatar rendering system
|
|
26093
26237
|
*/
|
|
26094
26238
|
let currentAvatarPointerSnapshot = null;
|
|
26239
|
+
/**
|
|
26240
|
+
* Monotonic version incremented whenever the shared pointer snapshot changes.
|
|
26241
|
+
*
|
|
26242
|
+
* @private utility of the avatar rendering system
|
|
26243
|
+
*/
|
|
26244
|
+
let currentAvatarPointerSnapshotVersion = 0;
|
|
26245
|
+
/**
|
|
26246
|
+
* Monotonic version incremented whenever scrolling or resizing may invalidate cached avatar bounds.
|
|
26247
|
+
*
|
|
26248
|
+
* @private utility of the avatar rendering system
|
|
26249
|
+
*/
|
|
26250
|
+
let currentAvatarViewportLayoutVersion = 0;
|
|
26095
26251
|
/**
|
|
26096
26252
|
* Cleanup function for the lazily attached global listeners.
|
|
26097
26253
|
*
|
|
@@ -26129,6 +26285,26 @@ function retainAvatarPointerTracking() {
|
|
|
26129
26285
|
function getAvatarPointerSnapshot() {
|
|
26130
26286
|
return currentAvatarPointerSnapshot;
|
|
26131
26287
|
}
|
|
26288
|
+
/**
|
|
26289
|
+
* Returns the current pointer snapshot version.
|
|
26290
|
+
*
|
|
26291
|
+
* @returns Monotonic pointer snapshot version.
|
|
26292
|
+
*
|
|
26293
|
+
* @private utility of the avatar rendering system
|
|
26294
|
+
*/
|
|
26295
|
+
function getAvatarPointerSnapshotVersion() {
|
|
26296
|
+
return currentAvatarPointerSnapshotVersion;
|
|
26297
|
+
}
|
|
26298
|
+
/**
|
|
26299
|
+
* Returns the current viewport-layout version used to invalidate cached avatar bounds.
|
|
26300
|
+
*
|
|
26301
|
+
* @returns Monotonic viewport-layout version.
|
|
26302
|
+
*
|
|
26303
|
+
* @private utility of the avatar rendering system
|
|
26304
|
+
*/
|
|
26305
|
+
function getAvatarViewportLayoutVersion() {
|
|
26306
|
+
return currentAvatarViewportLayoutVersion;
|
|
26307
|
+
}
|
|
26132
26308
|
/**
|
|
26133
26309
|
* Attaches the global pointer/touch listeners used by all live avatar canvases.
|
|
26134
26310
|
*
|
|
@@ -26141,7 +26317,11 @@ function attachAvatarPointerTrackingListeners() {
|
|
|
26141
26317
|
return () => undefined;
|
|
26142
26318
|
}
|
|
26143
26319
|
const clearPointerSnapshot = () => {
|
|
26320
|
+
if (currentAvatarPointerSnapshot === null) {
|
|
26321
|
+
return;
|
|
26322
|
+
}
|
|
26144
26323
|
currentAvatarPointerSnapshot = null;
|
|
26324
|
+
currentAvatarPointerSnapshotVersion++;
|
|
26145
26325
|
};
|
|
26146
26326
|
const updatePointerSnapshot = (clientX, clientY, pointerType) => {
|
|
26147
26327
|
currentAvatarPointerSnapshot = {
|
|
@@ -26150,6 +26330,10 @@ function attachAvatarPointerTrackingListeners() {
|
|
|
26150
26330
|
isPointerActive: true,
|
|
26151
26331
|
pointerType,
|
|
26152
26332
|
};
|
|
26333
|
+
currentAvatarPointerSnapshotVersion++;
|
|
26334
|
+
};
|
|
26335
|
+
const invalidateViewportLayout = () => {
|
|
26336
|
+
currentAvatarViewportLayoutVersion++;
|
|
26153
26337
|
};
|
|
26154
26338
|
const handlePointerMove = (event) => {
|
|
26155
26339
|
updatePointerSnapshot(event.clientX, event.clientY, normalizeAvatarPointerType(event.pointerType));
|
|
@@ -26185,6 +26369,8 @@ function attachAvatarPointerTrackingListeners() {
|
|
|
26185
26369
|
window.addEventListener('touchmove', handleTouchEvent, { passive: true });
|
|
26186
26370
|
window.addEventListener('touchend', clearPointerSnapshot, { passive: true });
|
|
26187
26371
|
window.addEventListener('touchcancel', clearPointerSnapshot, { passive: true });
|
|
26372
|
+
window.addEventListener('scroll', invalidateViewportLayout, { passive: true, capture: true });
|
|
26373
|
+
window.addEventListener('resize', invalidateViewportLayout, { passive: true });
|
|
26188
26374
|
return () => {
|
|
26189
26375
|
window.removeEventListener('pointermove', handlePointerMove);
|
|
26190
26376
|
window.removeEventListener('pointerdown', handlePointerDown);
|
|
@@ -26196,6 +26382,8 @@ function attachAvatarPointerTrackingListeners() {
|
|
|
26196
26382
|
window.removeEventListener('touchmove', handleTouchEvent);
|
|
26197
26383
|
window.removeEventListener('touchend', clearPointerSnapshot);
|
|
26198
26384
|
window.removeEventListener('touchcancel', clearPointerSnapshot);
|
|
26385
|
+
window.removeEventListener('scroll', invalidateViewportLayout, true);
|
|
26386
|
+
window.removeEventListener('resize', invalidateViewportLayout);
|
|
26199
26387
|
};
|
|
26200
26388
|
}
|
|
26201
26389
|
/**
|
|
@@ -28466,32 +28654,55 @@ function getAvatarVisualById(visualId) {
|
|
|
28466
28654
|
return avatarVisual;
|
|
28467
28655
|
}
|
|
28468
28656
|
|
|
28657
|
+
/**
|
|
28658
|
+
* Resolves the stable avatar render inputs reused across multiple frames.
|
|
28659
|
+
*
|
|
28660
|
+
* @param options Avatar identity and visual selection.
|
|
28661
|
+
* @returns Stable render data ready to be used by `renderAvatarVisual`.
|
|
28662
|
+
*
|
|
28663
|
+
* @private shared helper for canvas avatar rendering
|
|
28664
|
+
*/
|
|
28665
|
+
function resolveAvatarRenderDefinition(options) {
|
|
28666
|
+
const avatarDefinition = normalizeAvatarDefinition(options.avatarDefinition);
|
|
28667
|
+
const surface = options.surface || 'framed';
|
|
28668
|
+
return {
|
|
28669
|
+
avatarDefinition,
|
|
28670
|
+
avatarVisual: getAvatarVisualById(options.visualId),
|
|
28671
|
+
surface,
|
|
28672
|
+
palette: createAvatarPalette(avatarDefinition, surface),
|
|
28673
|
+
createRandom: createAvatarRandomFactory(avatarDefinition),
|
|
28674
|
+
};
|
|
28675
|
+
}
|
|
28469
28676
|
/**
|
|
28470
28677
|
* Renders one deterministic avatar frame into the provided canvas.
|
|
28471
28678
|
*
|
|
28472
28679
|
* @param options Rendering options.
|
|
28680
|
+
* @param resolvedAvatarRenderDefinition Optional stable render data reused between frames.
|
|
28473
28681
|
*
|
|
28474
28682
|
* @private shared helper for canvas avatar rendering
|
|
28475
28683
|
*/
|
|
28476
|
-
function renderAvatarVisual(options) {
|
|
28477
|
-
const
|
|
28478
|
-
|
|
28479
|
-
|
|
28684
|
+
function renderAvatarVisual(options, resolvedAvatarRenderDefinition) {
|
|
28685
|
+
const resolvedRenderDefinition = resolvedAvatarRenderDefinition ||
|
|
28686
|
+
resolveAvatarRenderDefinition({
|
|
28687
|
+
avatarDefinition: options.avatarDefinition,
|
|
28688
|
+
visualId: options.visualId,
|
|
28689
|
+
surface: options.surface,
|
|
28690
|
+
});
|
|
28480
28691
|
const context = options.canvas.getContext('2d');
|
|
28481
28692
|
if (!context) {
|
|
28482
28693
|
throw new Error('2D canvas rendering context is unavailable.');
|
|
28483
28694
|
}
|
|
28484
28695
|
prepareAvatarCanvas(options.canvas, context, options.size, options.devicePixelRatio || 1);
|
|
28485
|
-
avatarVisual.render({
|
|
28696
|
+
resolvedRenderDefinition.avatarVisual.render({
|
|
28486
28697
|
canvas: options.canvas,
|
|
28487
28698
|
context,
|
|
28488
28699
|
size: options.size,
|
|
28489
28700
|
devicePixelRatio: options.devicePixelRatio || 1,
|
|
28490
28701
|
timeMs: options.timeMs,
|
|
28491
|
-
avatarDefinition:
|
|
28492
|
-
palette:
|
|
28493
|
-
createRandom:
|
|
28494
|
-
surface,
|
|
28702
|
+
avatarDefinition: resolvedRenderDefinition.avatarDefinition,
|
|
28703
|
+
palette: resolvedRenderDefinition.palette,
|
|
28704
|
+
createRandom: resolvedRenderDefinition.createRandom,
|
|
28705
|
+
surface: resolvedRenderDefinition.surface,
|
|
28495
28706
|
interaction: options.interaction || createIdleAvatarInteractionState(),
|
|
28496
28707
|
});
|
|
28497
28708
|
}
|
|
@@ -28502,6 +28713,14 @@ function renderAvatarVisual(options) {
|
|
|
28502
28713
|
* @private helper of `<Avatar/>`
|
|
28503
28714
|
*/
|
|
28504
28715
|
const AVATAR_CANVAS_RADIUS_RATIO = 0.18;
|
|
28716
|
+
/**
|
|
28717
|
+
* Maximum time between layout-bound refreshes while pointer tracking is active.
|
|
28718
|
+
*
|
|
28719
|
+
* This keeps pointer-aware visuals aligned with chat/layout shifts without forcing a layout read every frame.
|
|
28720
|
+
*
|
|
28721
|
+
* @private helper of `<Avatar/>`
|
|
28722
|
+
*/
|
|
28723
|
+
const ACTIVE_POINTER_BOUNDS_REFRESH_MS = 120;
|
|
28505
28724
|
/**
|
|
28506
28725
|
* Canvas-based deterministic avatar component.
|
|
28507
28726
|
*
|
|
@@ -28512,21 +28731,58 @@ function Avatar(props) {
|
|
|
28512
28731
|
const canvasRef = useRef(null);
|
|
28513
28732
|
const animationStartRef = useRef(null);
|
|
28514
28733
|
const interactionRuntimeStateRef = useRef(createAvatarInteractionRuntimeState());
|
|
28734
|
+
const avatarBoundsRef = useRef(null);
|
|
28735
|
+
const lastResolvedPointerVersionRef = useRef(-1);
|
|
28736
|
+
const lastResolvedViewportLayoutVersionRef = useRef(-1);
|
|
28737
|
+
const lastAvatarBoundsRefreshAtRef = useRef(0);
|
|
28515
28738
|
const avatarColorsKey = avatarDefinition.colors.join('|');
|
|
28516
|
-
const
|
|
28517
|
-
|
|
28518
|
-
|
|
28739
|
+
const resolvedAvatarRenderDefinition = useMemo(() => resolveAvatarRenderDefinition({
|
|
28740
|
+
avatarDefinition,
|
|
28741
|
+
visualId,
|
|
28742
|
+
surface,
|
|
28743
|
+
}), [avatarDefinition.agentHash, avatarDefinition.agentName, avatarColorsKey, surface, visualId]);
|
|
28744
|
+
const avatarDefinitionKey = useMemo(() => createAvatarDefinitionKey(resolvedAvatarRenderDefinition.avatarDefinition), [
|
|
28745
|
+
resolvedAvatarRenderDefinition.avatarDefinition.agentHash,
|
|
28746
|
+
resolvedAvatarRenderDefinition.avatarDefinition.agentName,
|
|
28747
|
+
resolvedAvatarRenderDefinition.avatarDefinition.colors.join('|'),
|
|
28748
|
+
]);
|
|
28749
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
28750
|
+
useEffect(() => {
|
|
28751
|
+
const canvas = canvasRef.current;
|
|
28752
|
+
if (!canvas) {
|
|
28753
|
+
throw new Error('Avatar canvas is not mounted.');
|
|
28754
|
+
}
|
|
28755
|
+
return observeAvatarVisibility(canvas, setIsVisible);
|
|
28756
|
+
}, []);
|
|
28519
28757
|
useEffect(() => {
|
|
28520
28758
|
interactionRuntimeStateRef.current = createAvatarInteractionRuntimeState();
|
|
28521
|
-
|
|
28759
|
+
avatarBoundsRef.current = null;
|
|
28760
|
+
lastResolvedPointerVersionRef.current = -1;
|
|
28761
|
+
lastResolvedViewportLayoutVersionRef.current = -1;
|
|
28762
|
+
lastAvatarBoundsRefreshAtRef.current = 0;
|
|
28763
|
+
}, [avatarDefinitionKey, isVisible, visualId]);
|
|
28764
|
+
useEffect(() => {
|
|
28765
|
+
const canvas = canvasRef.current;
|
|
28766
|
+
if (!canvas || typeof ResizeObserver === 'undefined') {
|
|
28767
|
+
return;
|
|
28768
|
+
}
|
|
28769
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
28770
|
+
avatarBoundsRef.current = null;
|
|
28771
|
+
});
|
|
28772
|
+
resizeObserver.observe(canvas);
|
|
28773
|
+
return () => {
|
|
28774
|
+
resizeObserver.disconnect();
|
|
28775
|
+
};
|
|
28776
|
+
}, []);
|
|
28522
28777
|
useEffect(() => {
|
|
28523
28778
|
const canvas = canvasRef.current;
|
|
28524
28779
|
if (!canvas) {
|
|
28525
28780
|
throw new Error('Avatar canvas is not mounted.');
|
|
28526
28781
|
}
|
|
28782
|
+
const avatarVisual = resolvedAvatarRenderDefinition.avatarVisual;
|
|
28527
28783
|
const isDynamicAvatar = avatarVisual.isAnimated || avatarVisual.supportsPointerTracking === true;
|
|
28528
|
-
const
|
|
28529
|
-
|
|
28784
|
+
const shouldTrackPointer = avatarVisual.supportsPointerTracking === true && isVisible;
|
|
28785
|
+
const releasePointerTracking = shouldTrackPointer ? retainAvatarPointerTracking() : null;
|
|
28530
28786
|
if (animationStartRef.current === null) {
|
|
28531
28787
|
animationStartRef.current = performance.now();
|
|
28532
28788
|
}
|
|
@@ -28534,7 +28790,18 @@ function Avatar(props) {
|
|
|
28534
28790
|
const pointerSnapshot = avatarVisual.supportsPointerTracking ? getAvatarPointerSnapshot() : null;
|
|
28535
28791
|
let interactionState = createIdleAvatarInteractionState();
|
|
28536
28792
|
if (avatarVisual.supportsPointerTracking && pointerSnapshot) {
|
|
28537
|
-
|
|
28793
|
+
const pointerSnapshotVersion = getAvatarPointerSnapshotVersion();
|
|
28794
|
+
const viewportLayoutVersion = getAvatarViewportLayoutVersion();
|
|
28795
|
+
if (avatarBoundsRef.current === null ||
|
|
28796
|
+
lastResolvedPointerVersionRef.current !== pointerSnapshotVersion ||
|
|
28797
|
+
lastResolvedViewportLayoutVersionRef.current !== viewportLayoutVersion ||
|
|
28798
|
+
now - lastAvatarBoundsRefreshAtRef.current >= ACTIVE_POINTER_BOUNDS_REFRESH_MS) {
|
|
28799
|
+
avatarBoundsRef.current = canvas.getBoundingClientRect();
|
|
28800
|
+
lastResolvedPointerVersionRef.current = pointerSnapshotVersion;
|
|
28801
|
+
lastResolvedViewportLayoutVersionRef.current = viewportLayoutVersion;
|
|
28802
|
+
lastAvatarBoundsRefreshAtRef.current = now;
|
|
28803
|
+
}
|
|
28804
|
+
interactionRuntimeStateRef.current = stepAvatarInteractionRuntimeState(interactionRuntimeStateRef.current, resolveAvatarPointerTarget(avatarBoundsRef.current, pointerSnapshot), now);
|
|
28538
28805
|
interactionState = interactionRuntimeStateRef.current;
|
|
28539
28806
|
}
|
|
28540
28807
|
else if (avatarVisual.supportsPointerTracking) {
|
|
@@ -28543,35 +28810,35 @@ function Avatar(props) {
|
|
|
28543
28810
|
}
|
|
28544
28811
|
renderAvatarVisual({
|
|
28545
28812
|
canvas,
|
|
28546
|
-
avatarDefinition:
|
|
28813
|
+
avatarDefinition: resolvedAvatarRenderDefinition.avatarDefinition,
|
|
28547
28814
|
visualId,
|
|
28548
28815
|
surface,
|
|
28549
28816
|
size,
|
|
28550
28817
|
timeMs: now - animationStartRef.current,
|
|
28551
28818
|
devicePixelRatio: window.devicePixelRatio || 1,
|
|
28552
28819
|
interaction: interactionState,
|
|
28553
|
-
});
|
|
28554
|
-
if (isDynamicAvatar) {
|
|
28555
|
-
animationFrameId = window.requestAnimationFrame(renderFrame);
|
|
28556
|
-
}
|
|
28820
|
+
}, resolvedAvatarRenderDefinition);
|
|
28557
28821
|
};
|
|
28558
28822
|
renderFrame(performance.now());
|
|
28823
|
+
if (!isDynamicAvatar || !isVisible) {
|
|
28824
|
+
return () => {
|
|
28825
|
+
releasePointerTracking === null || releasePointerTracking === void 0 ? void 0 : releasePointerTracking();
|
|
28826
|
+
};
|
|
28827
|
+
}
|
|
28828
|
+
const releaseAnimationListener = retainAvatarAnimationListener(renderFrame);
|
|
28559
28829
|
return () => {
|
|
28560
|
-
|
|
28561
|
-
window.cancelAnimationFrame(animationFrameId);
|
|
28562
|
-
}
|
|
28830
|
+
releaseAnimationListener();
|
|
28563
28831
|
releasePointerTracking === null || releasePointerTracking === void 0 ? void 0 : releasePointerTracking();
|
|
28564
28832
|
};
|
|
28565
28833
|
}, [
|
|
28566
28834
|
avatarDefinitionKey,
|
|
28567
|
-
|
|
28568
|
-
|
|
28569
|
-
normalizedAvatarDefinition,
|
|
28835
|
+
isVisible,
|
|
28836
|
+
resolvedAvatarRenderDefinition,
|
|
28570
28837
|
size,
|
|
28571
28838
|
surface,
|
|
28572
28839
|
visualId,
|
|
28573
28840
|
]);
|
|
28574
|
-
return (jsx("canvas", { ref: canvasRef, title: title || `${
|
|
28841
|
+
return (jsx("canvas", { ref: canvasRef, title: title || `${resolvedAvatarRenderDefinition.avatarDefinition.agentName} avatar`, className: className, style: {
|
|
28575
28842
|
width: size,
|
|
28576
28843
|
height: size,
|
|
28577
28844
|
display: 'block',
|
|
@@ -49543,12 +49810,6 @@ function TeamToolCallModalContent(options) {
|
|
|
49543
49810
|
});
|
|
49544
49811
|
}
|
|
49545
49812
|
}
|
|
49546
|
-
const staticConversationDelayConfig = {
|
|
49547
|
-
...FAST_FLOW,
|
|
49548
|
-
beforeFirstMessage: 0,
|
|
49549
|
-
// Show the full internal exchange immediately so the modal never opens as a blank panel.
|
|
49550
|
-
showIntermediateMessages: messages.length,
|
|
49551
|
-
};
|
|
49552
49813
|
const agentName = ((_c = (_b = teamResult.conversation) === null || _b === void 0 ? void 0 : _b.find((entry) => entry.sender === 'AGENT' || entry.role === 'AGENT')) === null || _c === void 0 ? void 0 : _c.name) || 'Agent';
|
|
49553
49814
|
const teammateConversationName = ((_e = (_d = teamResult.conversation) === null || _d === void 0 ? void 0 : _d.find((entry) => entry.sender === 'TEAMMATE' || entry.role === 'TEAMMATE')) === null || _e === void 0 ? void 0 : _e.name) || '';
|
|
49554
49815
|
const teammateProfile = teammateUrl ? teamProfiles[teammateUrl] : undefined;
|
|
@@ -49585,7 +49846,12 @@ function TeamToolCallModalContent(options) {
|
|
|
49585
49846
|
avatarSrc: resolvedTeammateAvatar || undefined,
|
|
49586
49847
|
},
|
|
49587
49848
|
];
|
|
49588
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: classNames(styles$5.searchModalHeader, styles$5.teamModalHeader), children: jsxs("div", { className: styles$5.teamHeaderParticipants, children: [jsx(TeamHeaderProfile, { label: resolvedAgentLabel, avatarSrc: resolvedAgentAvatar, avatarDefinition: resolvedAgentAvatarDefinition, avatarVisualId: resolvedAgentAvatarVisualId, fallbackColor: resolvedAgentHeaderColor }), jsx("span", { className: styles$5.teamHeaderDivider, children: "talking with" }), jsx(TeamHeaderProfile, { label: resolvedTeammateLabel, avatarSrc: resolvedTeammateAvatar, fallbackColor: "#0ea5e9", href: teammateLink })] }) }), jsxs("div", { className: styles$5.searchModalContent, children: [messages.length > 0 ? (jsx("div", { className: styles$5.teamChatContainer, children: jsx(MockedChat, { title: `Chat between ${resolvedAgentLabel} and ${resolvedTeammateLabel}`, messages: messages, participants: participants, isResettable: false, isPausable: false, isSaveButtonEnabled: false, isCopyButtonEnabled: false,
|
|
49849
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: classNames(styles$5.searchModalHeader, styles$5.teamModalHeader), children: jsxs("div", { className: styles$5.teamHeaderParticipants, children: [jsx(TeamHeaderProfile, { label: resolvedAgentLabel, avatarSrc: resolvedAgentAvatar, avatarDefinition: resolvedAgentAvatarDefinition, avatarVisualId: resolvedAgentAvatarVisualId, fallbackColor: resolvedAgentHeaderColor }), jsx("span", { className: styles$5.teamHeaderDivider, children: "talking with" }), jsx(TeamHeaderProfile, { label: resolvedTeammateLabel, avatarSrc: resolvedTeammateAvatar, fallbackColor: "#0ea5e9", href: teammateLink })] }) }), jsxs("div", { className: styles$5.searchModalContent, children: [messages.length > 0 ? (jsx("div", { className: styles$5.teamChatContainer, children: jsx(MockedChat, { title: `Chat between ${resolvedAgentLabel} and ${resolvedTeammateLabel}`, messages: messages, participants: participants, isResettable: false, isPausable: false, isSaveButtonEnabled: false, isCopyButtonEnabled: false, layout: "STANDALONE", delayConfig: {
|
|
49850
|
+
// Note+TODO: For some strange reason, <MockedChat/> is not running and stays static on the initial frame, so doing this hack to force it to show the entire chat at once. Need to investigate why the animation is not running as expected and then just use `delayConfig={FAST_FLOW}`
|
|
49851
|
+
...FAST_FLOW,
|
|
49852
|
+
beforeFirstMessage: 0,
|
|
49853
|
+
showIntermediateMessages: messages.length,
|
|
49854
|
+
}, visualMode: "BUBBLE_MODE" }) })) : (jsx("div", { className: styles$5.noResults, children: "No teammate conversation available." })), (hasTeamToolCalls || hasTeamCitations) && (jsxs("div", { className: styles$5.teamToolCallSection, children: [hasTeamToolCalls && (jsxs("div", { className: styles$5.teamToolCallGroup, children: [jsx("div", { className: styles$5.teamToolCallHeading, children: "Actions" }), jsx("div", { className: styles$5.teamToolCallChips, children: teamToolCalls.map((toolCallEntry, index) => {
|
|
49589
49855
|
const chipletInfo = getToolCallChipletInfo(toolCallEntry.toolCall, undefined, toolTitles);
|
|
49590
49856
|
const chipletText = buildToolCallChipText(chipletInfo);
|
|
49591
49857
|
return (jsxs("button", { className: styles$5.completedToolCall, onClick: () => {
|
|
@@ -50524,7 +50790,7 @@ function hasChatActions(postprocessedMessages, { onReset, newChatButtonHref, onU
|
|
|
50524
50790
|
* @public exported from `@promptbook/components`
|
|
50525
50791
|
*/
|
|
50526
50792
|
function Chat(props) {
|
|
50527
|
-
const { title = 'Chat', messages, onChange, onMessage, onActionButton, onQuickMessageButton, onReplyToMessage, onCancelReply, onReset, resetRequiresConfirmation = true, newChatButtonHref, onFeedback, feedbackMode = 'stars', feedbackTranslations, timingTranslations, onFileUpload, chatLocale, speechRecognition, placeholderMessageContent, defaultMessage, enterBehavior, resolveEnterBehavior, children, className, style, isAiTextHumanizedAndPromptbookified = true, isVoiceCalling = false, isFocusedOnLoad, participants = [], canReplyToMessage, replyingToMessage, extraActions, actionsContainer, saveFormats, isSaveButtonEnabled = true, isCopyButtonEnabled = true, buttonColor: buttonColorRaw, onUseTemplate, onCreateAgent, toolTitles, teammates, teamAgentProfiles,
|
|
50793
|
+
const { title = 'Chat', messages, onChange, onMessage, onActionButton, onQuickMessageButton, onReplyToMessage, onCancelReply, onReset, resetRequiresConfirmation = true, newChatButtonHref, onFeedback, feedbackMode = 'stars', feedbackTranslations, timingTranslations, onFileUpload, chatLocale, speechRecognition, placeholderMessageContent, defaultMessage, enterBehavior, resolveEnterBehavior, children, className, style, isAiTextHumanizedAndPromptbookified = true, isVoiceCalling = false, isFocusedOnLoad, participants = [], canReplyToMessage, replyingToMessage, extraActions, actionsContainer, saveFormats, isSaveButtonEnabled = true, isCopyButtonEnabled = true, buttonColor: buttonColorRaw, onUseTemplate, onCreateAgent, toolTitles, teammates, teamAgentProfiles, layout, visualMode = 'ARTICLE_MODE', effectConfigs, soundSystem, speechRecognitionLanguage, isSpeechPlaybackEnabled = true, elevenLabsVoiceId, chatUiTranslations, } = props;
|
|
50528
50794
|
const buttonColor = useMemo(() => Color.from(buttonColorRaw || '#0066cc'), [buttonColorRaw]);
|
|
50529
50795
|
const agentParticipant = useMemo(() => participants.find((participant) => participant.name === 'AGENT'), [participants]);
|
|
50530
50796
|
const postprocessedMessages = useChatPostprocessedMessages({
|
|
@@ -50565,11 +50831,11 @@ function Chat(props) {
|
|
|
50565
50831
|
extraActions,
|
|
50566
50832
|
isSaveButtonEnabled,
|
|
50567
50833
|
});
|
|
50568
|
-
const isConstrainedArticleMode = visualMode === 'ARTICLE_MODE' &&
|
|
50834
|
+
const isConstrainedArticleMode = visualMode === 'ARTICLE_MODE' && layout === 'FULL_PAGE';
|
|
50569
50835
|
useChatCompleteNotification(messages, soundSystem);
|
|
50570
50836
|
return (jsxs(Fragment, { children: [feedbackStatus && (jsx("div", { className: classNames(styles$5.feedbackStatus, feedbackStatus.variant === 'success'
|
|
50571
50837
|
? styles$5.feedbackStatusSuccess
|
|
50572
|
-
: styles$5.feedbackStatusError), "aria-live": "polite", role: "status", children: feedbackStatus.message })), effectConfigs && effectConfigs.length > 0 && (jsx(ChatEffectsSystem, { messages: postprocessedMessages, effectConfigs: effectConfigs, soundSystem: soundSystem })), jsx("div", { className: classNames(className, styles$5.Chat,
|
|
50838
|
+
: styles$5.feedbackStatusError), "aria-live": "polite", role: "status", children: feedbackStatus.message })), effectConfigs && effectConfigs.length > 0 && (jsx(ChatEffectsSystem, { messages: postprocessedMessages, effectConfigs: effectConfigs, soundSystem: soundSystem })), jsx("div", { className: classNames(className, styles$5.Chat, layout === 'STANDALONE' && styles$5.standaloneVisual, layout === 'FULL_PAGE' && styles$5.fullPageVisual, isConstrainedArticleMode && styles$5.constrainedArticleVisual, getChatCssClassName('Chat'), chatCssClassNames.chat), style, children: jsxs("div", { className: classNames(className, styles$5.chatMainFlow, getChatCssClassName('chatMainFlow'), chatCssClassNames.chatMainFlow), children: [children && jsx("div", { className: classNames(styles$5.chatChildren), children: children }), shouldShowScrollToBottom && (jsx("div", { className: styles$5.scrollToBottomContainer, children: jsxs("div", { className: styles$5.scrollToBottomWrapper, children: [jsx(SolidArrowButton, { "data-button-type": "custom", direction: "down", iconSize: 33, className: classNames(styles$5.scrollToBottom, scrollToBottomCssClassName), onClick: handleButtonClick(() => scrollToBottom()), "aria-label": ariaLabel, title: ariaLabel }), badgeLabel && (jsx("span", { className: styles$5.scrollToBottomBadge, "aria-live": "polite", role: "status", children: badgeLabel }))] }) })), isVoiceCalling && (jsx("div", { className: styles$5.voiceCallIndicatorBar, children: jsxs("div", { className: styles$5.voiceCallIndicator, children: [jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: jsx("path", { d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" }) }), jsx("span", { children: "Voice call active" }), jsx("div", { className: styles$5.voiceCallPulse })] }) })), jsx(ChatActionsBar, { actionsRef: actionsRef, actionsContainer: actionsContainer, messages: postprocessedMessages, participants: participants, title: title, onReset: onReset, resetRequiresConfirmation: resetRequiresConfirmation, newChatButtonHref: newChatButtonHref, onUseTemplate: onUseTemplate, extraActions: extraActions, saveFormats: saveFormats, isSaveButtonEnabled: isSaveButtonEnabled, shouldFadeActions: shouldFadeActions, shouldDisableActions: shouldDisableActions, chatUiTranslations: chatUiTranslations, onButtonClick: handleButtonClick }), jsx(ChatMessageList, { messages: postprocessedMessages, participants: participants, expandedMessageId: expandedMessageId, messageRatings: messageRatings, setExpandedMessageId: setExpandedMessageId, handleRating: handleRating, mode: mode, isCopyButtonEnabled: isCopyButtonEnabled, isFeedbackEnabled: isFeedbackEnabled, feedbackMode: feedbackMode, feedbackTranslations: feedbackTranslations, timingTranslations: timingTranslations, chatLocale: chatLocale, onCopy: handleCopy, onMessage: onMessage, onActionButton: onActionButton, onQuickMessageButton: onQuickMessageButton, onReplyToMessage: onReplyToMessage, canReplyToMessage: canReplyToMessage, onCreateAgent: onCreateAgent, toolTitles: toolTitles, teammates: teammates, teamAgentProfiles: teamAgentProfiles, visualMode: visualMode, soundSystem: soundSystem, onToolCallClick: openToolCall, onCitationClick: openCitation, setChatMessagesElement: setChatMessagesElement, onScroll: handleChatScroll, isSpeechPlaybackEnabled: isSpeechPlaybackEnabled, elevenLabsVoiceId: elevenLabsVoiceId, chatUiTranslations: chatUiTranslations, chatMessagesClassName: classNames(isConstrainedArticleMode && styles$5.articleModeChatMessages, getChatCssClassName('chatMessages'), chatCssClassNames.chatMessages), hasActions: hasActions }), onMessage && (jsx(ChatInputArea, { onMessage: onMessage, onChange: onChange, onFileUpload: onFileUpload, speechRecognition: speechRecognition, speechRecognitionLanguage: speechRecognitionLanguage, replyingToMessage: replyingToMessage, onCancelReply: onCancelReply, defaultMessage: defaultMessage, enterBehavior: enterBehavior, resolveEnterBehavior: resolveEnterBehavior, placeholderMessageContent: placeholderMessageContent || (chatUiTranslations === null || chatUiTranslations === void 0 ? void 0 : chatUiTranslations.inputPlaceholder), isFocusedOnLoad: isFocusedOnLoad, isMobile: isMobile, isVoiceCalling: isVoiceCalling, participants: participants, buttonColor: buttonColor, soundSystem: soundSystem, onButtonClick: handleButtonClick, chatUiTranslations: chatUiTranslations, chatInputClassName: classNames(isConstrainedArticleMode && styles$5.articleModeChatInput, getChatCssClassName('chatInput'), chatCssClassNames.chatInput) }))] }) }), jsx(ChatToolCallModal, { isOpen: toolCallModalOpen, toolCall: selectedToolCall, toolCallIdentity: selectedToolCallIdentity, onClose: closeToolCallModal, toolTitles: toolTitles, agentParticipant: agentParticipant, buttonColor: buttonColor, teamAgentProfiles: teamAgentProfiles, chatUiTranslations: chatUiTranslations, locale: chatLocale, availableTools: selectedMessageAvailableTools }), jsx(ChatCitationModal, { isOpen: citationModalOpen, citation: selectedCitation, participants: participants, soundSystem: soundSystem, onClose: closeCitationModal }), jsx(ChatRatingModal, { isOpen: ratingModalOpen, selectedMessage: selectedMessage, postprocessedMessages: postprocessedMessages, messages: messages, hoveredRating: hoveredRating, messageRatings: messageRatings, textRating: textRating, feedbackMode: feedbackMode, feedbackTranslations: feedbackTranslations, mode: mode, isMobile: isMobile, onClose: () => setRatingModalOpen(false), setHoveredRating: setHoveredRating, setMessageRatings: setMessageRatings, setSelectedMessage: setSelectedMessage, setTextRating: setTextRating, submitRating: submitRating })] }));
|
|
50573
50839
|
}
|
|
50574
50840
|
|
|
50575
50841
|
/**
|
|
@@ -51875,7 +52141,7 @@ function PromptbookAgentSeamlessIntegration(props) {
|
|
|
51875
52141
|
: styles.PromptbookAgentSeamlessIntegrationStatusPending) }), jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationText, children: [jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLabel, children: "Chat" }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationHint, children: displayName })] }), jsx("span", { className: styles.PromptbookAgentSeamlessIntegrationScreenReaderOnly, children: connectionStatusText })] }), isOpen && (jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationWindow, id: windowId, children: [jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationHeader, style: { backgroundColor: color }, ref: setHeaderElement, children: [jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationTitleWrap, children: [jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationTitle, children: displayName }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationSubtitle, children: connectionStatusText })] }), isIframeUsed && (jsx("button", { className: styles.PromptbookAgentSeamlessIntegrationClose, onClick: () => setOpen(false), title: "Close", "aria-label": "Close chat", children: jsx(CloseIcon, {}) }))] }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationContent, children: isIframeUsed ? (jsxs(Fragment, { children: [!isIframeLoaded && (jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationLoading, children: [jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLoadingShimmer }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLoadingSpinner }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLoadingTitle, children: "Preparing your chat" }), jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationLoadingText, children: ["Connecting to ", displayName, "..."] })] })), jsx("iframe", { src: agentUrl + '/chat?headless', className: styles.PromptbookAgentSeamlessIntegrationIframe, style: { opacity: isIframeLoaded ? 1 : 0 }, tabIndex: -1, onLoad: () => {
|
|
51876
52142
|
setIsIframeLoaded(true);
|
|
51877
52143
|
setIsChatConnected(true);
|
|
51878
|
-
} })] })) : agent ? (jsx(AgentChat, { agent: agent, actionsContainer: headerElement, isFocusedOnLoad: isFocusedOnLoad, extraActions: jsx("button", { className: styles.PromptbookAgentSeamlessIntegrationClose, onClick: () => setOpen(false), title: "Close", "aria-label": "Close chat", children: jsx(CloseIcon, {}) }),
|
|
52144
|
+
} })] })) : agent ? (jsx(AgentChat, { agent: agent, actionsContainer: headerElement, isFocusedOnLoad: isFocusedOnLoad, extraActions: jsx("button", { className: styles.PromptbookAgentSeamlessIntegrationClose, onClick: () => setOpen(false), title: "Close", "aria-label": "Close chat", children: jsx(CloseIcon, {}) }), layout: "STANDALONE" })) : error ? (jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationError, children: [jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationErrorTitle, children: "Failed to connect to the agent" }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationErrorMessage, children: error.message })] })) : (jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationLoading, children: [jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLoadingShimmer }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLoadingSpinner }), jsx("div", { className: styles.PromptbookAgentSeamlessIntegrationLoadingTitle, children: "Preparing your chat" }), jsxs("div", { className: styles.PromptbookAgentSeamlessIntegrationLoadingText, children: ["Connecting to ", displayName, "..."] })] })) })] }))] }));
|
|
51879
52145
|
}
|
|
51880
52146
|
|
|
51881
52147
|
/**
|