@appcorp/app-corp-vista 0.1.75 → 0.1.77

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.
@@ -1,22 +1,63 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
5
35
  Object.defineProperty(exports, "__esModule", { value: true });
6
36
  exports.VistaChatBubbleV1 = void 0;
7
- var react_1 = __importDefault(require("react"));
37
+ var react_1 = __importStar(require("react"));
8
38
  var vista_avatar_v1_1 = require("../vista-avatar-v1/vista-avatar-v1");
9
39
  var format_timestamp_1 = require("../../utils/format-timestamp");
10
40
  var chat_triangle_1 = require("../../atoms/chat-triangle/chat-triangle");
11
41
  var VistaChatBubbleV1 = function (_a) {
12
- var message = _a.message, createdAt = _a.createdAt, isUser = _a.isUser, user = _a.user, psychic = _a.psychic;
42
+ var createdAt = _a.createdAt, isLast = _a.isLast, isUser = _a.isUser, message = _a.message, psychic = _a.psychic, user = _a.user;
43
+ var lastChatBubble = (0, react_1.useRef)(null);
13
44
  var getBubbleStyles = function () { return ({
14
45
  borderTopLeftRadius: isUser ? '8px' : '0px',
15
46
  borderTopRightRadius: isUser ? '0px' : '8px',
16
47
  borderBottomLeftRadius: '8px',
17
48
  borderBottomRightRadius: '8px',
18
49
  }); };
19
- return (react_1.default.createElement("div", { className: "flex items-start gap-6 my-2 ".concat(isUser ? 'justify-end' : 'justify-start') },
50
+ (0, react_1.useEffect)(function () {
51
+ var _a;
52
+ if (isLast) {
53
+ (_a = lastChatBubble.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
54
+ behavior: 'smooth',
55
+ block: 'center',
56
+ inline: 'end',
57
+ });
58
+ }
59
+ }, [isLast]);
60
+ return (react_1.default.createElement("div", { className: "flex items-start gap-6 my-2 ".concat(isUser ? 'justify-end' : 'justify-start'), ref: isLast ? lastChatBubble : null },
20
61
  react_1.default.createElement("div", { className: isUser ? 'order-1' : 'order-2' },
21
62
  react_1.default.createElement("div", { className: "relative ".concat(isUser ? 'bg-primary text-white' : 'bg-gray-200 text-black'), style: getBubbleStyles() },
22
63
  react_1.default.createElement("div", { className: "absolute top-0 size-4 ".concat(isUser ? '-right-4 rotate-90' : '-left-4 rotate-180') },
@@ -51,7 +51,7 @@ var VistaComboboxV1 = function (_a) {
51
51
  return id === selectedItem.id;
52
52
  })[0];
53
53
  }, [selectedItem]);
54
- return (react_1.default.createElement(react_2.Combobox, { as: "div", className: "".concat(comboboxClassName), onChange: function (v) { return handleOnChange(nodeSelectKey, v); }, value: filteredItem === null || filteredItem === void 0 ? void 0 : filteredItem[selectKey1], disabled: disabled },
54
+ return (react_1.default.createElement(react_2.Combobox, { as: "div", className: "".concat(comboboxClassName), onChange: function (v) { return handleOnChange(nodeSelectKey, v); }, value: (filteredItem === null || filteredItem === void 0 ? void 0 : filteredItem[selectKey1]) || '', disabled: disabled },
55
55
  react_1.default.createElement(react_2.Label, { className: "block text-sm/6 font-medium text-gray-900 dark:text-white ".concat(labelClassName) },
56
56
  label,
57
57
  " ",
@@ -15,9 +15,9 @@ var vista_chat_bubble_v1_1 = require("../../molecules/vista-chat-bubble-v1/vista
15
15
  var VistaChatV2 = function (_a) {
16
16
  var actionItems = _a.actionItems, chatId = _a.chatId, chatValue = _a.chatValue, _b = _a.containerClassName, containerClassName = _b === void 0 ? '' : _b, handleChatOnChange = _a.handleChatOnChange, messages = _a.messages, name = _a.name, psychic = _a.psychic, sideBarHeading = _a.sideBarHeading, sideBarNode = _a.sideBarNode, timer = _a.timer, user = _a.user;
17
17
  var renderChatMessages = function () {
18
- return (react_1.default.createElement("div", { className: 'overflow-y-scroll' }, messages.map((function (_a) {
18
+ return (react_1.default.createElement("div", { className: 'overflow-y-scroll' }, messages.map((function (_a, ind) {
19
19
  var createdAt = _a.createdAt, id = _a.id, isUser = _a.isUser, message = _a.message;
20
- return (react_1.default.createElement(vista_chat_bubble_v1_1.VistaChatBubbleV1, { createdAt: createdAt, isUser: isUser, key: id, message: message, psychic: psychic, user: user }));
20
+ return (react_1.default.createElement(vista_chat_bubble_v1_1.VistaChatBubbleV1, { createdAt: createdAt, isUser: isUser, key: id, message: message, psychic: psychic, user: user, isLast: ind === messages.length - 1 }));
21
21
  }))));
22
22
  };
23
23
  var handleOnKeyDown = function (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/app-corp-vista",
3
- "version": "0.1.75",
3
+ "version": "0.1.77",
4
4
  "scripts": {
5
5
  "build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib",
6
6
  "build:next": "next build",
@@ -1,6 +1,7 @@
1
1
  import { VistaChatV2Psychic, VistaChatV2User } from "./vista-chat-type";
2
2
  export interface VistaChatBubbleV1Props {
3
3
  createdAt: string;
4
+ isLast: boolean;
4
5
  isUser: boolean;
5
6
  message: string;
6
7
  psychic: VistaChatV2Psychic;