@adatechnology/conversations-ui 0.8.0 → 0.9.0
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/dist/{chunk-HMCOTZAX.js → chunk-NSOAUYNE.js} +33 -28
- package/dist/chunk-ZSOD5AQT.js +19 -0
- package/dist/flows/index.js +4 -2
- package/dist/index.js +5 -3
- package/dist/participant/index.d.ts +3 -0
- package/dist/participant/index.js +536 -276
- package/dist/styles.css +99 -23
- package/package.json +2 -1
- package/src/Tooltip.tsx +5 -12
- package/src/TooltipDom.test.tsx +78 -0
- package/src/domHarness.test-helper.ts +53 -0
- package/src/participant/ParticipantBackButton.tsx +1 -1
- package/src/participant/ParticipantBubbleBody.tsx +54 -0
- package/src/participant/ParticipantBubbleStatus.tsx +22 -28
- package/src/participant/ParticipantChannelBadges.tsx +10 -2
- package/src/participant/ParticipantComposer.tsx +1 -1
- package/src/participant/ParticipantComposerControls.tsx +2 -0
- package/src/participant/ParticipantCopyableToken.tsx +1 -0
- package/src/participant/ParticipantFailedMenu.tsx +40 -0
- package/src/participant/ParticipantFailedMenuList.tsx +41 -0
- package/src/participant/ParticipantMessageBubble.test.tsx +6 -6
- package/src/participant/ParticipantMessageBubble.tsx +20 -52
- package/src/participant/ParticipantMessageText.test.tsx +1 -1
- package/src/participant/ParticipantMessageText.tsx +4 -2
- package/src/participant/ParticipantProtocolBadge.tsx +1 -0
- package/src/participant/ParticipantScrollToLatest.tsx +1 -1
- package/src/participant/ParticipantThread.tsx +23 -12
- package/src/participant/ParticipantThreadHeader.test.tsx +1 -1
- package/src/participant/failedMenuKeyboard.ts +29 -0
- package/src/participant/participantFailedMenuDom.test.tsx +154 -0
- package/src/participant/participantFailedMenuState.test.ts +61 -0
- package/src/participant/participantFailedMenuState.ts +57 -0
- package/src/participant/participantFailedMessage.test.tsx +83 -0
- package/src/participant/participantLabels.ts +6 -0
- package/src/participant/participantThemeContrast.test.ts +8 -0
- package/src/participant/participantTooltips.test.tsx +74 -0
- package/src/participant/test-fixtures/thread-avatars-initials.golden.html +1 -1
- package/src/participant/test-fixtures/thread-closed.golden.html +1 -1
- package/src/participant/test-fixtures/thread-default.golden.html +1 -1
- package/src/participant/test-fixtures/thread-error.golden.html +1 -1
- package/src/participant/test-fixtures/thread-loading.golden.html +1 -1
- package/src/participant/test-fixtures/thread-plain.golden.html +1 -1
- package/src/participant/test-fixtures/thread-tail-off.golden.html +1 -1
- package/src/participant/useFailedMenuEffects.ts +59 -0
- package/src/participant/useParticipantFailedMenu.ts +60 -0
- package/src/participant/useSuppressTouchTooltips.ts +38 -0
- package/src/styles.css +19 -5
- package/src/tooltipLayerRegistry.test.ts +56 -0
- package/src/tooltipLayerRegistry.ts +34 -0
|
@@ -1,10 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn
|
|
3
|
-
} from "./chunk-PJNR6UMN.js";
|
|
4
|
-
|
|
5
1
|
// src/Tooltip.tsx
|
|
6
2
|
import { useEffect, useRef, useState } from "react";
|
|
7
3
|
import { createPortal } from "react-dom";
|
|
4
|
+
|
|
5
|
+
// src/tooltipLayerRegistry.ts
|
|
6
|
+
function createTooltipLayerRegistry() {
|
|
7
|
+
const layers = /* @__PURE__ */ new Map();
|
|
8
|
+
let owner;
|
|
9
|
+
function handOff() {
|
|
10
|
+
const next = layers.entries().next();
|
|
11
|
+
if (next.done) {
|
|
12
|
+
owner = void 0;
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const [layer, onOwnershipChange] = next.value;
|
|
16
|
+
owner = layer;
|
|
17
|
+
onOwnershipChange(true);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
register(layer, onOwnershipChange) {
|
|
21
|
+
layers.set(layer, onOwnershipChange);
|
|
22
|
+
if (owner === void 0) handOff();
|
|
23
|
+
return () => {
|
|
24
|
+
layers.delete(layer);
|
|
25
|
+
if (owner !== layer) return;
|
|
26
|
+
owner = void 0;
|
|
27
|
+
handOff();
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/Tooltip.tsx
|
|
8
34
|
import { jsx } from "react/jsx-runtime";
|
|
9
35
|
var TOOLTIP_ATTRIBUTE = "data-cv-tooltip";
|
|
10
36
|
var TOOLTIP_DELAY_MS = 120;
|
|
@@ -26,20 +52,12 @@ function tooltipStateFor(target, text) {
|
|
|
26
52
|
});
|
|
27
53
|
return { text, ...position };
|
|
28
54
|
}
|
|
29
|
-
var
|
|
55
|
+
var layerRegistry = createTooltipLayerRegistry();
|
|
30
56
|
function TooltipLayer() {
|
|
31
57
|
const identity = useRef({});
|
|
32
58
|
const [isOwner, setIsOwner] = useState(false);
|
|
33
59
|
const [tooltip, setTooltip] = useState(void 0);
|
|
34
|
-
useEffect(() =>
|
|
35
|
-
const owned = identity.current;
|
|
36
|
-
if (layerOwner && layerOwner !== owned) return void 0;
|
|
37
|
-
layerOwner = owned;
|
|
38
|
-
setIsOwner(true);
|
|
39
|
-
return () => {
|
|
40
|
-
if (layerOwner === owned) layerOwner = void 0;
|
|
41
|
-
};
|
|
42
|
-
}, []);
|
|
60
|
+
useEffect(() => layerRegistry.register(identity.current, setIsOwner), []);
|
|
43
61
|
useEffect(() => {
|
|
44
62
|
if (!isOwner) return void 0;
|
|
45
63
|
let timer;
|
|
@@ -108,20 +126,7 @@ function TooltipLayer() {
|
|
|
108
126
|
);
|
|
109
127
|
}
|
|
110
128
|
|
|
111
|
-
// src/lib/WhatsAppMessagePreview.tsx
|
|
112
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
113
|
-
function WhatsAppMessagePreview({ children, belowBubble, footer, className }) {
|
|
114
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("rounded-xl bg-[#e5ddd5] dark:bg-gray-900 p-3 space-y-1.5", className), children: [
|
|
115
|
-
/* @__PURE__ */ jsxs("div", { className: "max-w-[85%]", children: [
|
|
116
|
-
/* @__PURE__ */ jsx2("div", { className: "rounded-lg rounded-tl-none bg-white dark:bg-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 shadow-sm whitespace-pre-wrap break-words", children }),
|
|
117
|
-
belowBubble
|
|
118
|
-
] }),
|
|
119
|
-
footer
|
|
120
|
-
] });
|
|
121
|
-
}
|
|
122
|
-
|
|
123
129
|
export {
|
|
124
130
|
TOOLTIP_ATTRIBUTE,
|
|
125
|
-
TooltipLayer
|
|
126
|
-
WhatsAppMessagePreview
|
|
131
|
+
TooltipLayer
|
|
127
132
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-PJNR6UMN.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/WhatsAppMessagePreview.tsx
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
function WhatsAppMessagePreview({ children, belowBubble, footer, className }) {
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("rounded-xl bg-[#e5ddd5] dark:bg-gray-900 p-3 space-y-1.5", className), children: [
|
|
9
|
+
/* @__PURE__ */ jsxs("div", { className: "max-w-[85%]", children: [
|
|
10
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-lg rounded-tl-none bg-white dark:bg-gray-700 px-3 py-2 text-sm text-gray-900 dark:text-gray-100 shadow-sm whitespace-pre-wrap break-words", children }),
|
|
11
|
+
belowBubble
|
|
12
|
+
] }),
|
|
13
|
+
footer
|
|
14
|
+
] });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
WhatsAppMessagePreview
|
|
19
|
+
};
|
package/dist/flows/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
TOOLTIP_ATTRIBUTE,
|
|
3
|
-
TooltipLayer,
|
|
4
2
|
WhatsAppMessagePreview
|
|
5
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZSOD5AQT.js";
|
|
4
|
+
import {
|
|
5
|
+
TOOLTIP_ATTRIBUTE,
|
|
6
|
+
TooltipLayer
|
|
7
|
+
} from "./chunk-NSOAUYNE.js";
|
|
6
8
|
import {
|
|
7
9
|
AudioPlayer,
|
|
8
10
|
AudioRecorderButton,
|
|
@@ -140,9 +140,12 @@ type ParticipantConversationsLabels = {
|
|
|
140
140
|
readonly statusRead: string;
|
|
141
141
|
readonly statusFailed: string;
|
|
142
142
|
readonly statusFailedShort: string;
|
|
143
|
+
/** @deprecated No longer rendered by the default view: the retry button is icon-only and named by `statusFailed`. */
|
|
143
144
|
readonly retry: string;
|
|
144
145
|
readonly discard: string;
|
|
145
146
|
readonly edit: string;
|
|
147
|
+
/** Name of the menu button on a failed message. Optional; translated hosts should fill it, otherwise the English default shows. */
|
|
148
|
+
readonly messageOptions?: string;
|
|
146
149
|
readonly notFound: string;
|
|
147
150
|
readonly loading: string;
|
|
148
151
|
readonly loadError: string;
|