@appcorp/app-corp-vista 0.1.84 → 0.1.86
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 +22 -0
- package/molecules/vista-chat-heading-v1/vista-chat-heading-v1.d.ts +1 -0
- package/molecules/vista-chat-heading-v1/vista-chat-heading-v1.js +6 -2
- package/organisms/vista-chat-v2/vista-chat-v2.js +9 -2
- package/package.json +2 -1
- package/type/vista-chat-type.d.ts +9 -0
- package/utils/generate-toast.d.ts +7 -0
- package/utils/generate-toast.js +14 -0
package/data/vista-chat-props.js
CHANGED
|
@@ -121,6 +121,7 @@ exports.vistaChatV2Props = {
|
|
|
121
121
|
sideBarNode: react_1.default.createElement("p", null, "Hello World"),
|
|
122
122
|
name: 'John Doe',
|
|
123
123
|
timer: '00:20',
|
|
124
|
+
estimatedBalance: '30.00',
|
|
124
125
|
user: {
|
|
125
126
|
avatarUrl: '',
|
|
126
127
|
avatarAlt: '',
|
|
@@ -175,4 +176,25 @@ exports.vistaChatV2Props = {
|
|
|
175
176
|
variant: vista_button_type_1.VISTA_BUTTON_VARIANT.SECONDARY,
|
|
176
177
|
},
|
|
177
178
|
],
|
|
179
|
+
buttonDenominations: [
|
|
180
|
+
{
|
|
181
|
+
loading: 'loading-5',
|
|
182
|
+
value: '5.00',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
loading: 'loading-10',
|
|
186
|
+
value: '10.00',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
loading: 'loading-15',
|
|
190
|
+
value: '15.00',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
loading: 'loading-25',
|
|
194
|
+
value: '25.00',
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
paymentLoading: '',
|
|
198
|
+
handlePayment: function () { return void 0; },
|
|
199
|
+
isBalanceLow: false,
|
|
178
200
|
};
|
|
@@ -6,9 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.VistaChatHeadingV1 = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var VistaChatHeadingV1 = function (_a) {
|
|
9
|
-
var heading = _a.heading, timer = _a.timer;
|
|
9
|
+
var estimatedBalance = _a.estimatedBalance, heading = _a.heading, timer = _a.timer;
|
|
10
10
|
return (react_1.default.createElement("div", { className: "border-b border-gray-200 p-4 text-black dark:text-white flex flex-row justify-between" },
|
|
11
11
|
react_1.default.createElement("p", { className: "text-lg font-semibold" }, heading),
|
|
12
|
-
|
|
12
|
+
react_1.default.createElement("div", { className: 'flex flex-row justify-between items-center gap-8' },
|
|
13
|
+
estimatedBalance && (react_1.default.createElement("p", null,
|
|
14
|
+
"$",
|
|
15
|
+
estimatedBalance)),
|
|
16
|
+
timer && (react_1.default.createElement("p", null, timer)))));
|
|
13
17
|
};
|
|
14
18
|
exports.VistaChatHeadingV1 = VistaChatHeadingV1;
|
|
@@ -13,7 +13,7 @@ var vista_button_v1_1 = require("../../molecules/vista-button-v1/vista-button-v1
|
|
|
13
13
|
var vista_button_type_1 = require("../../type/vista-button-type");
|
|
14
14
|
var vista_chat_bubble_v1_1 = require("../../molecules/vista-chat-bubble-v1/vista-chat-bubble-v1");
|
|
15
15
|
var VistaChatV2 = function (_a) {
|
|
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;
|
|
16
|
+
var actionItems = _a.actionItems, 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, handlePayment = _a.handlePayment, isBalanceLow = _a.isBalanceLow, messages = _a.messages, name = _a.name, paymentLoading = _a.paymentLoading, psychic = _a.psychic, sideBarHeading = _a.sideBarHeading, sideBarNode = _a.sideBarNode, timer = _a.timer, user = _a.user;
|
|
17
17
|
var renderChatMessages = function () {
|
|
18
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;
|
|
@@ -28,8 +28,15 @@ var VistaChatV2 = function (_a) {
|
|
|
28
28
|
return (react_1.default.createElement("div", { className: "relative h-screen grid grid-cols-12 grid-rows-1 overflow-hidden ".concat(containerClassName) },
|
|
29
29
|
react_1.default.createElement(vista_chat_side_bar_v2_1.VistaChatSideBarV2, { sideBarHeading: sideBarHeading, sideBarNode: sideBarNode }),
|
|
30
30
|
react_1.default.createElement("section", { className: "col-span-9 flex flex-col" },
|
|
31
|
-
react_1.default.createElement(vista_chat_heading_v1_1.VistaChatHeadingV1, { heading: name, timer: timer }),
|
|
31
|
+
react_1.default.createElement(vista_chat_heading_v1_1.VistaChatHeadingV1, { heading: name, timer: timer, estimatedBalance: estimatedBalance }),
|
|
32
32
|
react_1.default.createElement("div", { className: "overflow-y-auto h-full flex flex-col justify-end p-4" }, renderChatMessages()),
|
|
33
|
+
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' },
|
|
34
|
+
react_1.default.createElement("div", { className: 'col-span-2' },
|
|
35
|
+
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.")),
|
|
36
|
+
react_1.default.createElement("div", { className: "flex flex-row justify-end gap-4 col-span-3" }, buttonDenominations.map(function (_a) {
|
|
37
|
+
var loading = _a.loading, value = _a.value;
|
|
38
|
+
return (react_1.default.createElement(vista_button_v1_1.VistaButtonV1, { className: "min-w-[120px] disabled:cursor-not-allowed", disabled: paymentLoading === loading, handleOnClick: function () { return handlePayment(loading, value); }, key: value, label: "Top up $".concat(value), loading: paymentLoading === loading, size: vista_button_type_1.VISTA_BUTTON_SIZE.LG }));
|
|
39
|
+
})))),
|
|
33
40
|
react_1.default.createElement("div", { className: "flex flex-row items-center gap-4 border-t border-gray-200 p-4" },
|
|
34
41
|
react_1.default.createElement("div", { className: 'w-full' },
|
|
35
42
|
react_1.default.createElement(vista_text_input_v1_1.VistaTextInputV1, { handleOnChange: handleChatOnChange, id: chatId, placeholder: 'Enter message...', value: chatValue, handleOnKeyDown: handleOnKeyDown })),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/app-corp-vista",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.86",
|
|
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",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"react": "^19",
|
|
81
81
|
"react-copy-to-clipboard": "^5.1.0",
|
|
82
82
|
"react-dom": "^19",
|
|
83
|
+
"react-hot-toast": "^2",
|
|
83
84
|
"react-photo-view": "^1.2.7",
|
|
84
85
|
"react-slick": "^0.30.3",
|
|
85
86
|
"react-tooltip": "^5.28.1",
|
|
@@ -34,14 +34,23 @@ export interface VistaChatV2Message {
|
|
|
34
34
|
isUser: boolean;
|
|
35
35
|
message: string;
|
|
36
36
|
}
|
|
37
|
+
export interface ButtonDenomination {
|
|
38
|
+
loading: string;
|
|
39
|
+
value: string;
|
|
40
|
+
}
|
|
37
41
|
export interface VistaChatV2Props {
|
|
38
42
|
actionItems: VistaChatV2ActionItem[];
|
|
43
|
+
buttonDenominations: ButtonDenomination[];
|
|
39
44
|
chatId: string;
|
|
40
45
|
chatValue: string;
|
|
41
46
|
containerClassName?: string;
|
|
47
|
+
estimatedBalance?: string;
|
|
42
48
|
handleChatOnChange: (k: string, v: string) => void;
|
|
49
|
+
handlePayment: (l: string, v: string) => void;
|
|
50
|
+
isBalanceLow: boolean;
|
|
43
51
|
messages: VistaChatV2Message[];
|
|
44
52
|
name: string;
|
|
53
|
+
paymentLoading: string;
|
|
45
54
|
psychic: VistaChatV2Psychic;
|
|
46
55
|
sideBarHeading: string;
|
|
47
56
|
sideBarNode: ReactNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
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.generateToast = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var vista_notification_v1_1 = require("../molecules/vista-notification-v1/vista-notification-v1");
|
|
9
|
+
var react_hot_toast_1 = require("react-hot-toast");
|
|
10
|
+
var generateToast = function (_a) {
|
|
11
|
+
var variant = _a.variant, description = _a.description;
|
|
12
|
+
var toastId = react_hot_toast_1.toast.custom(react_1.default.createElement(vista_notification_v1_1.VistaNotificationV1, { description: description, handleIsVisible: function () { return react_hot_toast_1.toast.dismiss(toastId); }, isVisible: true, variant: variant }));
|
|
13
|
+
};
|
|
14
|
+
exports.generateToast = generateToast;
|