@appcorp/app-corp-vista 0.3.28 → 0.3.30
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/data/vista-chat-props.js
CHANGED
|
@@ -192,10 +192,12 @@ exports.vistaChatV2Props = {
|
|
|
192
192
|
],
|
|
193
193
|
paymentLoading: '',
|
|
194
194
|
handlePayment: function () { return void 0; },
|
|
195
|
+
handleLoadMore: function () { return void 0; },
|
|
195
196
|
isBalanceLow: false,
|
|
196
197
|
typing: 'Username is typing...',
|
|
197
198
|
bannerHeading: 'Your session has started.',
|
|
198
199
|
bannerDescription: 'Enjoy your conversation.',
|
|
199
200
|
showBanner: true,
|
|
200
201
|
showControls: true,
|
|
202
|
+
showLoadMore: true,
|
|
201
203
|
};
|
|
@@ -8,21 +8,25 @@ var react_1 = __importDefault(require("react"));
|
|
|
8
8
|
var util_functions_1 = require("@react-pakistan/util-functions");
|
|
9
9
|
var vista_vertical_divider_v1_1 = require("../../molecules/vista-vertical-divider-v1");
|
|
10
10
|
var vista_chat_bubble_v1_1 = require("../../molecules/vista-chat-bubble-v1/vista-chat-bubble-v1");
|
|
11
|
+
var vista_button_v1_1 = require("../../molecules/vista-button-v1/vista-button-v1");
|
|
12
|
+
var vista_button_type_1 = require("../../type/vista-button-type");
|
|
11
13
|
var VistaChatMessagesV2 = function (_a) {
|
|
12
|
-
var messages = _a.messages, psychic = _a.psychic, user = _a.user;
|
|
14
|
+
var messages = _a.messages, psychic = _a.psychic, user = _a.user, showLoadMore = _a.showLoadMore, handleLoadMore = _a.handleLoadMore;
|
|
13
15
|
var lastDate = '';
|
|
14
|
-
return (react_1.default.createElement("div", { className: "overflow-y-scroll" },
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
return (react_1.default.createElement("div", { className: "overflow-y-scroll" },
|
|
17
|
+
showLoadMore && (react_1.default.createElement("div", { className: "flex flex-row justify-center" },
|
|
18
|
+
react_1.default.createElement(vista_button_v1_1.VistaButtonV1, { variant: vista_button_type_1.VISTA_BUTTON_VARIANT.SECONDARY, label: "Load Previous Chats...", handleOnClick: handleLoadMore, className: "inline-flex max-w-48" }))),
|
|
19
|
+
messages.map(function (_a, ind) {
|
|
20
|
+
var _b, _c;
|
|
21
|
+
var createdAt = _a.createdAt, id = _a.id, isUser = _a.isUser, message = _a.message, messageStatus = _a.messageStatus;
|
|
22
|
+
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])
|
|
23
|
+
? false
|
|
24
|
+
: true;
|
|
25
|
+
lastDate = createdAt;
|
|
26
|
+
return (react_1.default.createElement("div", { key: id },
|
|
27
|
+
shouldShowDivider && (react_1.default.createElement("div", { className: "pt-8" },
|
|
28
|
+
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) }))),
|
|
29
|
+
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 })));
|
|
30
|
+
})));
|
|
27
31
|
};
|
|
28
32
|
exports.VistaChatMessagesV2 = VistaChatMessagesV2;
|
|
@@ -13,7 +13,7 @@ var vista_button_type_1 = require("../../type/vista-button-type");
|
|
|
13
13
|
var vista_banner_v1_1 = require("../../atoms/vista-banner-v1/vista-banner-v1");
|
|
14
14
|
var vista_chat_messages_v2_1 = require("./vista-chat-messages-v2");
|
|
15
15
|
var VistaChatV2 = function (_a) {
|
|
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;
|
|
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, handleLoadMore = _a.handleLoadMore, 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, showLoadMore = _a.showLoadMore, timer = _a.timer, typing = _a.typing, user = _a.user;
|
|
17
17
|
var handleOnKeyDown = function (e) {
|
|
18
18
|
if (e.key === 'Enter') {
|
|
19
19
|
actionItems[0].handleOnClick();
|
|
@@ -24,7 +24,7 @@ var VistaChatV2 = function (_a) {
|
|
|
24
24
|
react_1.default.createElement(vista_chat_heading_v1_1.VistaChatHeadingV1, { estimatedBalance: estimatedBalance, heading: name, timer: timer }),
|
|
25
25
|
showBanner && (react_1.default.createElement(vista_banner_v1_1.VistaBannerV1, { description: bannerDescription, heading: bannerHeading })),
|
|
26
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,
|
|
27
|
+
react_1.default.createElement(vista_chat_messages_v2_1.VistaChatMessagesV2, { messages: messages, psychic: psychic, showLoadMore: showLoadMore, user: user, handleLoadMore: handleLoadMore })),
|
|
28
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" },
|
|
29
29
|
react_1.default.createElement("div", { className: "col-span-2" },
|
|
30
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
|
@@ -49,6 +49,7 @@ export interface VistaChatV2Props {
|
|
|
49
49
|
containerClassName?: string;
|
|
50
50
|
estimatedBalance?: string;
|
|
51
51
|
handleChatOnChange: (k: string, v: string) => void;
|
|
52
|
+
handleLoadMore: () => void;
|
|
52
53
|
handleOnBlur?: () => void;
|
|
53
54
|
handleOnFocus?: () => void;
|
|
54
55
|
handlePayment: (l: string, v: string) => void;
|
|
@@ -59,12 +60,15 @@ export interface VistaChatV2Props {
|
|
|
59
60
|
psychic: VistaChatV2Psychic;
|
|
60
61
|
showBanner?: boolean;
|
|
61
62
|
showControls?: boolean;
|
|
63
|
+
showLoadMore: boolean;
|
|
62
64
|
timer: string;
|
|
63
65
|
typing?: string;
|
|
64
66
|
user: VistaChatV2User;
|
|
65
67
|
}
|
|
66
68
|
export interface VistaChatMessageV2 {
|
|
69
|
+
handleLoadMore: () => void;
|
|
67
70
|
messages: VistaChatV2Message[];
|
|
68
71
|
psychic: VistaChatV2Psychic;
|
|
72
|
+
showLoadMore: boolean;
|
|
69
73
|
user: VistaChatV2User;
|
|
70
74
|
}
|