@appcorp/app-corp-vista 0.3.27 → 0.3.28
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.
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VistaChatMessagesV2 = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
9
|
+
var vista_vertical_divider_v1_1 = require("../../molecules/vista-vertical-divider-v1");
|
|
10
|
+
var vista_chat_bubble_v1_1 = require("../../molecules/vista-chat-bubble-v1/vista-chat-bubble-v1");
|
|
11
|
+
var VistaChatMessagesV2 = function (_a) {
|
|
12
|
+
var messages = _a.messages, psychic = _a.psychic, user = _a.user;
|
|
13
|
+
var lastDate = '';
|
|
14
|
+
return (react_1.default.createElement("div", { className: "overflow-y-scroll" }, messages.map(function (_a, ind) {
|
|
15
|
+
var _b, _c;
|
|
16
|
+
var createdAt = _a.createdAt, id = _a.id, isUser = _a.isUser, message = _a.message, messageStatus = _a.messageStatus;
|
|
17
|
+
var shouldShowDivider = ((_b = lastDate.split('T')) === null || _b === void 0 ? void 0 : _b[0]) === ((_c = createdAt.split('T')) === null || _c === void 0 ? void 0 : _c[0])
|
|
18
|
+
? false
|
|
19
|
+
: true;
|
|
20
|
+
lastDate = createdAt;
|
|
21
|
+
console.log({ shouldShowDivider: shouldShowDivider, lastDate: lastDate, createdAt: createdAt });
|
|
22
|
+
return (react_1.default.createElement("div", { key: id },
|
|
23
|
+
shouldShowDivider && (react_1.default.createElement("div", { className: "pt-8" },
|
|
24
|
+
react_1.default.createElement(vista_vertical_divider_v1_1.VistaVerticalDividerV1, { label: (0, util_functions_1.formatDate)(createdAt, util_functions_1.DATE_FORMATS.DAY_DD_MM_YY_COMPACT) }))),
|
|
25
|
+
react_1.default.createElement(vista_chat_bubble_v1_1.VistaChatBubbleV1, { createdAt: createdAt, isLast: ind === messages.length - 1, isUser: isUser, message: message, messageStatus: messageStatus, psychic: psychic, user: user })));
|
|
26
|
+
})));
|
|
27
|
+
};
|
|
28
|
+
exports.VistaChatMessagesV2 = VistaChatMessagesV2;
|
|
@@ -10,27 +10,10 @@ var vista_chat_heading_v1_1 = require("../../molecules/vista-chat-heading-v1/vis
|
|
|
10
10
|
var vista_text_input_v1_1 = require("../../molecules/vista-text-input-v1");
|
|
11
11
|
var vista_button_v1_1 = require("../../molecules/vista-button-v1/vista-button-v1");
|
|
12
12
|
var vista_button_type_1 = require("../../type/vista-button-type");
|
|
13
|
-
var vista_chat_bubble_v1_1 = require("../../molecules/vista-chat-bubble-v1/vista-chat-bubble-v1");
|
|
14
|
-
var vista_vertical_divider_v1_1 = require("../../molecules/vista-vertical-divider-v1");
|
|
15
|
-
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
16
13
|
var vista_banner_v1_1 = require("../../atoms/vista-banner-v1/vista-banner-v1");
|
|
14
|
+
var vista_chat_messages_v2_1 = require("./vista-chat-messages-v2");
|
|
17
15
|
var VistaChatV2 = function (_a) {
|
|
18
|
-
var actionItems = _a.actionItems, bannerDescription = _a.bannerDescription, bannerHeading = _a.bannerHeading, buttonDenominations = _a.buttonDenominations, chatId = _a.chatId, chatValue = _a.chatValue, _b = _a.containerClassName, containerClassName = _b === void 0 ? '' : _b, _c = _a.estimatedBalance, estimatedBalance = _c === void 0 ? '' : _c, handleChatOnChange = _a.handleChatOnChange, handleOnBlur = _a.handleOnBlur, handleOnFocus = _a.handleOnFocus, handlePayment = _a.handlePayment, isBalanceLow = _a.isBalanceLow, messages = _a.messages, name = _a.name, paymentLoading = _a.paymentLoading, psychic = _a.psychic,
|
|
19
|
-
var renderChatMessages = function () {
|
|
20
|
-
var lastDate = '';
|
|
21
|
-
return (react_1.default.createElement("div", { className: "overflow-y-scroll" }, messages.map(function (_a, ind) {
|
|
22
|
-
var _b, _c;
|
|
23
|
-
var createdAt = _a.createdAt, id = _a.id, isUser = _a.isUser, message = _a.message, messageStatus = _a.messageStatus;
|
|
24
|
-
var shouldShowDivider = ((_b = lastDate.split('T')) === null || _b === void 0 ? void 0 : _b[0]) === ((_c = createdAt.split('T')) === null || _c === void 0 ? void 0 : _c[0])
|
|
25
|
-
? false
|
|
26
|
-
: true;
|
|
27
|
-
lastDate = createdAt;
|
|
28
|
-
return (react_1.default.createElement("div", { key: id },
|
|
29
|
-
shouldShowDivider && (react_1.default.createElement("div", { className: "pt-8" },
|
|
30
|
-
react_1.default.createElement(vista_vertical_divider_v1_1.VistaVerticalDividerV1, { label: (0, util_functions_1.formatDate)(createdAt, util_functions_1.DATE_FORMATS.DAY_DD_MM_YY_COMPACT) }))),
|
|
31
|
-
react_1.default.createElement(vista_chat_bubble_v1_1.VistaChatBubbleV1, { createdAt: createdAt, isLast: ind === messages.length - 1, isUser: isUser, message: message, psychic: psychic, user: user, messageStatus: messageStatus })));
|
|
32
|
-
})));
|
|
33
|
-
};
|
|
16
|
+
var actionItems = _a.actionItems, bannerDescription = _a.bannerDescription, bannerHeading = _a.bannerHeading, buttonDenominations = _a.buttonDenominations, chatId = _a.chatId, chatValue = _a.chatValue, _b = _a.containerClassName, containerClassName = _b === void 0 ? '' : _b, _c = _a.estimatedBalance, estimatedBalance = _c === void 0 ? '' : _c, handleChatOnChange = _a.handleChatOnChange, handleOnBlur = _a.handleOnBlur, handleOnFocus = _a.handleOnFocus, handlePayment = _a.handlePayment, isBalanceLow = _a.isBalanceLow, messages = _a.messages, name = _a.name, paymentLoading = _a.paymentLoading, psychic = _a.psychic, _d = _a.showBanner, showBanner = _d === void 0 ? false : _d, _e = _a.showControls, showControls = _e === void 0 ? true : _e, timer = _a.timer, typing = _a.typing, user = _a.user;
|
|
34
17
|
var handleOnKeyDown = function (e) {
|
|
35
18
|
if (e.key === 'Enter') {
|
|
36
19
|
actionItems[0].handleOnClick();
|
|
@@ -40,7 +23,8 @@ var VistaChatV2 = function (_a) {
|
|
|
40
23
|
react_1.default.createElement("section", { className: "flex flex-col h-full" },
|
|
41
24
|
react_1.default.createElement(vista_chat_heading_v1_1.VistaChatHeadingV1, { estimatedBalance: estimatedBalance, heading: name, timer: timer }),
|
|
42
25
|
showBanner && (react_1.default.createElement(vista_banner_v1_1.VistaBannerV1, { description: bannerDescription, heading: bannerHeading })),
|
|
43
|
-
react_1.default.createElement("div", { className: "overflow-y-auto h-full flex flex-col justify-end p-4" },
|
|
26
|
+
react_1.default.createElement("div", { className: "overflow-y-auto h-full flex flex-col justify-end p-4" },
|
|
27
|
+
react_1.default.createElement(vista_chat_messages_v2_1.VistaChatMessagesV2, { messages: messages, user: user, psychic: psychic })),
|
|
44
28
|
isBalanceLow && (react_1.default.createElement("div", { className: "grid grid-cols-5 m-4 p-4 border-2 border-primary border-dashed rounded-md justify-between items-center bg-cyan-200" },
|
|
45
29
|
react_1.default.createElement("div", { className: "col-span-2" },
|
|
46
30
|
react_1.default.createElement("p", { className: "text-md font-semibold" }, "You are running out of your Kismaa credits, click one of the buttons to top up your account.")),
|
package/package.json
CHANGED
|
@@ -57,9 +57,14 @@ export interface VistaChatV2Props {
|
|
|
57
57
|
name: string;
|
|
58
58
|
paymentLoading: string;
|
|
59
59
|
psychic: VistaChatV2Psychic;
|
|
60
|
-
showBanner
|
|
60
|
+
showBanner?: boolean;
|
|
61
61
|
showControls?: boolean;
|
|
62
62
|
timer: string;
|
|
63
63
|
typing?: string;
|
|
64
64
|
user: VistaChatV2User;
|
|
65
65
|
}
|
|
66
|
+
export interface VistaChatMessageV2 {
|
|
67
|
+
messages: VistaChatV2Message[];
|
|
68
|
+
psychic: VistaChatV2Psychic;
|
|
69
|
+
user: VistaChatV2User;
|
|
70
|
+
}
|