pager-widget 1.0.3 → 1.0.4
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/index.css +1 -1
- package/dist/index.js +4 -4
- package/dist/react-parcel.9f367d21.css +2 -18
- package/dist/react-parcel.9f367d21.css.map +1 -1
- package/dist/react-parcel.js +119 -214
- package/dist/react-parcel.js.map +1 -1
- package/out/AgentFeedbackButtonWrapper.js +15 -0
- package/out/App.js +28 -0
- package/out/BotMain.js +91 -0
- package/out/ButtonsWrapper.js +29 -0
- package/out/ChatPage.js +9 -0
- package/out/ChatPageContent.js +131 -0
- package/out/ChatPageHeader.js +267 -0
- package/out/ChatPageInput.js +29 -0
- package/out/ChatWidget.js +17 -0
- package/out/Consent.js +66 -0
- package/out/CountryDropdown.js +31 -0
- package/out/Form.js +238 -0
- package/out/HomePage.js +11 -0
- package/out/HomePageContent.js +32 -0
- package/out/HomePageFooter.js +87 -0
- package/out/HomePageHeader.js +66 -0
- package/out/InputField.js +80 -0
- package/out/Markdown.js +126 -0
- package/out/Message.js +197 -0
- package/out/MessagesT.js +2 -0
- package/out/NewRecentMessagePage.js +525 -0
- package/out/NewRecentMessageTab.js +23 -0
- package/out/ReceivedMessage.js +211 -0
- package/out/RecentMessageDetail.js +178 -0
- package/out/RecentMessageList.js +112 -0
- package/out/RecentMessageListCard.js +20 -0
- package/out/RecentMessageListHeader.js +156 -0
- package/out/RecentMessagePage.js +183 -0
- package/out/RecentMessageTab.js +35 -0
- package/out/WidgetMessage.js +14 -0
- package/out/WidgetToggleButton.js +191 -0
- package/out/WidgetType.js +2 -0
- package/out/assets/icons/pikaicons-react.js +17475 -0
- package/out/components/ConsentForm.js +7 -0
- package/out/components/CustomTooltip.js +34 -0
- package/out/hooks/useChatHistoryExists.js +32 -0
- package/out/hooks/useChatHistoryListExist.js +81 -0
- package/out/hooks/useChatScroll.js +14 -0
- package/out/hooks/useCurrentConversationExists.js +88 -0
- package/out/hooks/useInitialMessage.js +33 -0
- package/out/hooks/useMessage.js +230 -0
- package/out/hooks/useMessageReceiver.js +183 -0
- package/out/hooks/usePopupAnimation.js +20 -0
- package/out/hooks/useSocket.js +19 -0
- package/out/hooks/useSocketContext.js +81 -0
- package/out/hooks/useWidgetDimension.js +41 -0
- package/out/hooks/useWidgetToggle.js +22 -0
- package/out/index.js +31 -0
- package/out/markdown/CodeCopy.js +22 -0
- package/out/markdown/CodeHighlight.js +58 -0
- package/out/markdown/PagerMarkdown.js +36 -0
- package/out/markdown/pager_md.js +152 -0
- package/out/onscreenNotificationPopup.js +23 -0
- package/out/socket.js +11 -0
- package/out/utils/checkConversationExit.js +24 -0
- package/out/utils/convertTime.js +43 -0
- package/out/utils/sendInitialMessage.js +82 -0
- package/out/widget.js +21 -0
- package/out/widgetConfigStore.js +205 -0
- package/out/widgetConfigStore2.js +569 -0
- package/out/widgetControlstore.js +23 -0
- package/out/widgetStateHandler.js +106 -0
- package/out/widgetStore.js +171 -0
- package/out/widgetUserStore.js +47 -0
- package/package.json +1 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const BotMain_1 = require("./BotMain");
|
|
39
|
+
const pikaicons_react_1 = require("./assets/icons/pikaicons-react");
|
|
40
|
+
const widgetStore_1 = require("./widgetStore");
|
|
41
|
+
const RecentMessageListHeader = ({ toggleWidget, isExpanded, }) => {
|
|
42
|
+
const expandRef = react_1.default.useRef(null);
|
|
43
|
+
const [expandPopupOpen, setExpandPopupOpen] = react_1.default.useState(false);
|
|
44
|
+
const [showExpandPopUp, setShowExpandPopUp] = react_1.default.useState(false);
|
|
45
|
+
const expandMenuItems = [
|
|
46
|
+
{
|
|
47
|
+
id: 1,
|
|
48
|
+
icon: ((0, jsx_runtime_1.jsx)(pikaicons_react_1.PiPhoneStroke, { className: "w-[16px] h-[16px] text-slate-600" })),
|
|
49
|
+
label: 'Default mode',
|
|
50
|
+
selected: isExpanded === widgetStore_1.WidgetExpandType.DEFAULT,
|
|
51
|
+
onClick: () => {
|
|
52
|
+
widgetStore_1.widgetStore.trigger.expandWidget({
|
|
53
|
+
expanded_size: widgetStore_1.WidgetExpandType.DEFAULT,
|
|
54
|
+
});
|
|
55
|
+
setExpandPopupOpen(false);
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 2,
|
|
60
|
+
icon: ((0, jsx_runtime_1.jsx)(pikaicons_react_1.PiTabletStroke, { className: "w-[16px] h-[16px] text-slate-600" })),
|
|
61
|
+
label: 'Expanded mode',
|
|
62
|
+
selected: isExpanded === widgetStore_1.WidgetExpandType.EXPANDED,
|
|
63
|
+
onClick: () => {
|
|
64
|
+
widgetStore_1.widgetStore.trigger.expandWidget({
|
|
65
|
+
expanded_size: widgetStore_1.WidgetExpandType.EXPANDED,
|
|
66
|
+
});
|
|
67
|
+
setExpandPopupOpen(false);
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 3,
|
|
72
|
+
icon: ((0, jsx_runtime_1.jsx)(pikaicons_react_1.PiSpatialCurvedScreenStroke, { className: "w-[16px] h-[16px] text-slate-600" })),
|
|
73
|
+
label: 'Full screen mode',
|
|
74
|
+
selected: isExpanded === widgetStore_1.WidgetExpandType.FULLSCREEN,
|
|
75
|
+
onClick: () => {
|
|
76
|
+
widgetStore_1.widgetStore.trigger.expandWidget({
|
|
77
|
+
expanded_size: widgetStore_1.WidgetExpandType.FULLSCREEN,
|
|
78
|
+
});
|
|
79
|
+
setExpandPopupOpen(false);
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
const selectedExpandItem = expandMenuItems.find((item) => {
|
|
84
|
+
return item.selected ? item.icon : null;
|
|
85
|
+
});
|
|
86
|
+
(0, react_1.useEffect)(() => {
|
|
87
|
+
function handleClick(event) {
|
|
88
|
+
if (expandRef.current &&
|
|
89
|
+
!expandRef.current.contains(event.target)) {
|
|
90
|
+
setExpandPopupOpen(false);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (expandPopupOpen) {
|
|
94
|
+
document.addEventListener('mousedown', handleClick);
|
|
95
|
+
}
|
|
96
|
+
return () => {
|
|
97
|
+
document.removeEventListener('mousedown', handleClick);
|
|
98
|
+
};
|
|
99
|
+
}, [expandPopupOpen]);
|
|
100
|
+
react_1.default.useEffect(() => {
|
|
101
|
+
if (expandPopupOpen) {
|
|
102
|
+
setShowExpandPopUp(true);
|
|
103
|
+
}
|
|
104
|
+
else if (showExpandPopUp) {
|
|
105
|
+
const timeout = setTimeout(() => setShowExpandPopUp(false), 140);
|
|
106
|
+
return () => clearTimeout(timeout);
|
|
107
|
+
}
|
|
108
|
+
}, [expandPopupOpen, showExpandPopUp]);
|
|
109
|
+
const handleBackButtonClick = () => {
|
|
110
|
+
if (isExpanded !== widgetStore_1.WidgetExpandType.DEFAULT) {
|
|
111
|
+
widgetStore_1.widgetStore.trigger.expandWidget({
|
|
112
|
+
expanded_size: widgetStore_1.WidgetExpandType.DEFAULT,
|
|
113
|
+
});
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
widgetStore_1.widgetStore.trigger.selectTab({ tab: BotMain_1.TabType.HOME });
|
|
116
|
+
}, 300);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
widgetStore_1.widgetStore.trigger.selectTab({ tab: BotMain_1.TabType.HOME });
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
return ((0, jsx_runtime_1.jsxs)("header", { className: "flex items-center px-0 py-[15px] border-b border-zinc-300 w-full justify-between h-[60px] bg-white rounded-t-[22px]", "data-model-id": "10445:55564", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 px-5 py-0 w-full", children: [(0, jsx_runtime_1.jsx)("button", { className: "inline-flex items-center justify-center gap-2.5 p-0 cursor-pointer hover:bg-slate-100 rounded-xl overflow-hidden", onClick: handleBackButtonClick, children: (0, jsx_runtime_1.jsx)(pikaicons_react_1.PiChevronLeftStroke, { className: "w-6 h-6 cursor-pointer" }) }), (0, jsx_runtime_1.jsx)("span", { className: "text-slate-950 text-base font-medium leading-6", children: "Recent chats" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 px-5 py-0 w-max justify-end", children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative", ref: expandRef, children: [(0, jsx_runtime_1.jsx)("button", { className: "inline-flex items-center gap-2.5 p-1 cursor-pointer hover:bg-slate-100 rounded-lg overflow-hidden", onClick: () => setExpandPopupOpen(!expandPopupOpen), children: (0, jsx_runtime_1.jsx)("div", { className: "inline-flex items-center gap-2.5", children: selectedExpandItem
|
|
123
|
+
? selectedExpandItem.icon
|
|
124
|
+
: null }) }), showExpandPopUp && ((0, jsx_runtime_1.jsxs)("nav", { className: `flex flex-col w-[148px] h-max absolute items-start gap-1 p-1 right-0 bg-white rounded-lg overflow-hidden border border-solid border-slate-200 z-50`, style: {
|
|
125
|
+
animation: expandPopupOpen
|
|
126
|
+
? 'popin 0.18s cubic-bezier(0.4,0,0.2,1)'
|
|
127
|
+
: 'popout 0.14s cubic-bezier(0.4,0,0.2,1)',
|
|
128
|
+
}, children: [(0, jsx_runtime_1.jsx)("style", { children: `
|
|
129
|
+
@keyframes popin {
|
|
130
|
+
0% {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
transform: scale(0.95) translateY(-8px);
|
|
133
|
+
}
|
|
134
|
+
100% {
|
|
135
|
+
opacity: 1;
|
|
136
|
+
transform: scale(1) translateY(0);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
@keyframes popout {
|
|
140
|
+
0% {
|
|
141
|
+
opacity: 1;
|
|
142
|
+
transform: scale(1) translateY(0);
|
|
143
|
+
}
|
|
144
|
+
100% {
|
|
145
|
+
opacity: 0;
|
|
146
|
+
transform: scale(0.95) translateY(-8px);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
` }), expandMenuItems.map((item) => ((0, jsx_runtime_1.jsxs)("button", { className: `flex items-center gap-1.5 pl-2 pr-3 py-1.5 relative self-stretch w-full cursor-pointer
|
|
150
|
+
hover:bg-slate-100 rounded-md overflow-hidden`, style: {
|
|
151
|
+
backgroundColor: item.selected
|
|
152
|
+
? '#f0f0f0'
|
|
153
|
+
: '',
|
|
154
|
+
}, onClick: item.onClick, children: [(0, jsx_runtime_1.jsx)("div", { className: "inline-flex items-center gap-2.5 flex-[0_0_auto]", children: item.icon }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start justify-center gap-2 flex-1 self-stretch grow", children: (0, jsx_runtime_1.jsx)("div", { className: "inline-flex flex-col items-start gap-1 flex-[0_0_auto]", children: (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1 flex-[0_0_auto]", children: (0, jsx_runtime_1.jsx)("div", { className: "w-fit whitespace-nowrap text-xs font-medium text-[#020618]", children: item.label }) }) }) })] }, item.id)))] }))] }), (0, jsx_runtime_1.jsx)("button", { className: "inline-flex items-center gap-2.5 p-1 cursor-pointer hover:bg-slate-50 rounded-lg overflow-hidden", onClick: toggleWidget, children: (0, jsx_runtime_1.jsx)("div", { className: "inline-flex items-center gap-2.5", children: (0, jsx_runtime_1.jsx)(pikaicons_react_1.PiMultipleCrossCancelDefaultStroke, { className: "w-[18px] h-[18px]" }) }) })] })] }));
|
|
155
|
+
};
|
|
156
|
+
exports.default = RecentMessageListHeader;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.RecentMessagePage = void 0;
|
|
40
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
|
+
const BotMain_1 = require("./BotMain");
|
|
44
|
+
const pikaicons_react_1 = require("./assets/icons/pikaicons-react");
|
|
45
|
+
const useChatHistoryExists_1 = require("./hooks/useChatHistoryExists");
|
|
46
|
+
const widgetConfigStore2_1 = require("./widgetConfigStore2");
|
|
47
|
+
const pager_md_1 = __importDefault(require("./markdown/pager_md"));
|
|
48
|
+
const ReceivedMessage_1 = require("./ReceivedMessage");
|
|
49
|
+
const widgetStore_1 = require("./widgetStore");
|
|
50
|
+
const RecentMessagePage = ({ toggleWidget, isExpanded, }) => {
|
|
51
|
+
const widget = (0, widgetConfigStore2_1.useWidgetData)();
|
|
52
|
+
const { recentChat } = (0, useChatHistoryExists_1.useChatHistoryExists)();
|
|
53
|
+
const chatValues = recentChat ?? {};
|
|
54
|
+
const widgetId = widget?.data?.id;
|
|
55
|
+
const messageResponse = chatValues?.[widgetId] ?? [];
|
|
56
|
+
const expandRef = react_1.default.useRef(null);
|
|
57
|
+
const [expandPopupOpen, setExpandPopupOpen] = react_1.default.useState(false);
|
|
58
|
+
const [showExpandPopUp, setShowExpandPopUp] = react_1.default.useState(false);
|
|
59
|
+
const expandMenuItems = [
|
|
60
|
+
{
|
|
61
|
+
id: 1,
|
|
62
|
+
icon: ((0, jsx_runtime_1.jsx)(pikaicons_react_1.PiPhoneStroke, { className: "w-[16px] h-[16px] text-slate-600" })),
|
|
63
|
+
label: 'Default mode',
|
|
64
|
+
selected: isExpanded === widgetStore_1.WidgetExpandType.DEFAULT,
|
|
65
|
+
onClick: () => {
|
|
66
|
+
widgetStore_1.widgetStore.trigger.expandWidget({
|
|
67
|
+
expanded_size: widgetStore_1.WidgetExpandType.DEFAULT,
|
|
68
|
+
});
|
|
69
|
+
setExpandPopupOpen(false);
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: 2,
|
|
74
|
+
icon: ((0, jsx_runtime_1.jsx)(pikaicons_react_1.PiTabletStroke, { className: "w-[16px] h-[16px] text-slate-600" })),
|
|
75
|
+
label: 'Expanded mode',
|
|
76
|
+
selected: isExpanded === widgetStore_1.WidgetExpandType.EXPANDED,
|
|
77
|
+
onClick: () => {
|
|
78
|
+
widgetStore_1.widgetStore.trigger.expandWidget({
|
|
79
|
+
expanded_size: widgetStore_1.WidgetExpandType.EXPANDED,
|
|
80
|
+
});
|
|
81
|
+
setExpandPopupOpen(false);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: 3,
|
|
86
|
+
icon: ((0, jsx_runtime_1.jsx)(pikaicons_react_1.PiSpatialCurvedScreenStroke, { className: "w-[16px] h-[16px] text-slate-600" })),
|
|
87
|
+
label: 'Full screen mode',
|
|
88
|
+
selected: isExpanded === widgetStore_1.WidgetExpandType.FULLSCREEN,
|
|
89
|
+
onClick: () => {
|
|
90
|
+
widgetStore_1.widgetStore.trigger.expandWidget({
|
|
91
|
+
expanded_size: widgetStore_1.WidgetExpandType.FULLSCREEN,
|
|
92
|
+
});
|
|
93
|
+
setExpandPopupOpen(false);
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
const selectedExpandItem = expandMenuItems.find((item) => {
|
|
98
|
+
return item.selected ? item.icon : null;
|
|
99
|
+
});
|
|
100
|
+
(0, react_1.useEffect)(() => {
|
|
101
|
+
function handleClick(event) {
|
|
102
|
+
if (expandRef.current &&
|
|
103
|
+
!expandRef.current.contains(event.target)) {
|
|
104
|
+
setExpandPopupOpen(false);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (expandPopupOpen) {
|
|
108
|
+
document.addEventListener('mousedown', handleClick);
|
|
109
|
+
}
|
|
110
|
+
return () => {
|
|
111
|
+
document.removeEventListener('mousedown', handleClick);
|
|
112
|
+
};
|
|
113
|
+
}, [expandPopupOpen]);
|
|
114
|
+
react_1.default.useEffect(() => {
|
|
115
|
+
if (expandPopupOpen) {
|
|
116
|
+
setShowExpandPopUp(true);
|
|
117
|
+
}
|
|
118
|
+
else if (showExpandPopUp) {
|
|
119
|
+
const timeout = setTimeout(() => setShowExpandPopUp(false), 140);
|
|
120
|
+
return () => clearTimeout(timeout);
|
|
121
|
+
}
|
|
122
|
+
}, [expandPopupOpen, showExpandPopUp]);
|
|
123
|
+
if (!Array.isArray(messageResponse) || messageResponse.length === 0) {
|
|
124
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "p-4 text-center text-gray-500", children: "No recent messages found." }));
|
|
125
|
+
}
|
|
126
|
+
const handleBackButtonClick = () => {
|
|
127
|
+
if (isExpanded !== widgetStore_1.WidgetExpandType.DEFAULT) {
|
|
128
|
+
widgetStore_1.widgetStore.trigger.expandWidget({
|
|
129
|
+
expanded_size: widgetStore_1.WidgetExpandType.DEFAULT,
|
|
130
|
+
});
|
|
131
|
+
setTimeout(() => {
|
|
132
|
+
widgetStore_1.widgetStore.trigger.selectTab({ tab: BotMain_1.TabType.HOME });
|
|
133
|
+
}, 300);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
widgetStore_1.widgetStore.trigger.selectTab({ tab: BotMain_1.TabType.HOME });
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("header", { className: "flex items-center px-0 py-[15px] border-b border-zinc-300 w-full justify-between h-[60px] bg-white rounded-t-[22px] cursor-pointer", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 px-5 w-full", children: [(0, jsx_runtime_1.jsx)("button", { className: "inline-flex items-center justify-center gap-2.5 p-0 cursor-pointer hover:bg-slate-100 rounded-xl overflow-hidden", onClick: handleBackButtonClick, children: (0, jsx_runtime_1.jsx)(pikaicons_react_1.PiChevronLeftStroke, { className: "w-6 h-6" }) }), (0, jsx_runtime_1.jsx)("img", { className: "w-auto h-[30px]", src: widget?.data?.logo_url, alt: "Bot logo" }), (0, jsx_runtime_1.jsx)("span", { className: "flex flex-col items-start grow", children: (0, jsx_runtime_1.jsx)("span", { className: "flex flex-col items-start gap-[18px] flex-[0_0_auto]", children: (0, jsx_runtime_1.jsx)("h1", { className: "w-fit mt-[-1.00px] font-text-md-medium font-[number:var(--text-md-medium-font-weight)] text-[#020618] text-[length:var(--text-md-medium-font-size)] tracking-[var(--text-md-medium-letter-spacing)] leading-[var(--text-md-medium-line-height)] whitespace-nowrap [font-style:var(--text-md-medium-font-style)]", children: widget?.data?.name }) }) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 px-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative", ref: expandRef, children: [(0, jsx_runtime_1.jsx)("button", { className: "inline-flex items-center gap-2.5 p-1 cursor-pointer hover:bg-slate-100 rounded-lg overflow-hidden", onClick: () => setExpandPopupOpen(!expandPopupOpen), children: (0, jsx_runtime_1.jsx)("div", { className: "inline-flex items-center gap-2.5", children: selectedExpandItem
|
|
140
|
+
? selectedExpandItem.icon
|
|
141
|
+
: null }) }), showExpandPopUp && ((0, jsx_runtime_1.jsxs)("nav", { className: `flex flex-col w-[148px] h-max absolute items-start gap-1 p-1 right-0 bg-white rounded-lg overflow-hidden border border-solid border-slate-200 z-50`, style: {
|
|
142
|
+
animation: expandPopupOpen
|
|
143
|
+
? 'popin 0.18s cubic-bezier(0.4,0,0.2,1)'
|
|
144
|
+
: 'popout 0.14s cubic-bezier(0.4,0,0.2,1)',
|
|
145
|
+
}, children: [(0, jsx_runtime_1.jsx)("style", { children: `
|
|
146
|
+
@keyframes popin {
|
|
147
|
+
0% {
|
|
148
|
+
opacity: 0;
|
|
149
|
+
transform: scale(0.95) translateY(-8px);
|
|
150
|
+
}
|
|
151
|
+
100% {
|
|
152
|
+
opacity: 1;
|
|
153
|
+
transform: scale(1) translateY(0);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
@keyframes popout {
|
|
157
|
+
0% {
|
|
158
|
+
opacity: 1;
|
|
159
|
+
transform: scale(1) translateY(0);
|
|
160
|
+
}
|
|
161
|
+
100% {
|
|
162
|
+
opacity: 0;
|
|
163
|
+
transform: scale(0.95) translateY(-8px);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
` }), expandMenuItems.map((item) => ((0, jsx_runtime_1.jsxs)("button", { className: `flex items-center gap-1.5 pl-2 pr-3 py-1.5 relative self-stretch w-full cursor-pointer
|
|
167
|
+
hover:bg-slate-100 rounded-md overflow-hidden`, style: {
|
|
168
|
+
backgroundColor: item.selected
|
|
169
|
+
? '#f0f0f0'
|
|
170
|
+
: '',
|
|
171
|
+
}, onClick: item.onClick, children: [(0, jsx_runtime_1.jsx)("div", { className: "inline-flex items-center gap-2.5 flex-[0_0_auto]", children: item.icon }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start justify-center gap-2 flex-1 self-stretch grow", children: (0, jsx_runtime_1.jsx)("div", { className: "inline-flex flex-col items-start gap-1 flex-[0_0_auto]", children: (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-1 flex-[0_0_auto]", children: (0, jsx_runtime_1.jsx)("div", { className: "w-fit whitespace-nowrap text-xs font-medium text-[#020618]", children: item.label }) }) }) })] }, item.id)))] }))] }), (0, jsx_runtime_1.jsx)("button", { className: "inline-flex items-center p-1 hover:bg-slate-50 rounded-lg cursor-pointer", onClick: toggleWidget, children: (0, jsx_runtime_1.jsx)(pikaicons_react_1.PiMultipleCrossCancelDefaultStroke, { className: "w-[18px] h-[18px]" }) })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col h-[93%] pt-2 justify-between pb-2.5", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-4 h-full overflow-y-scroll w-full", children: (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col gap-5 w-full pb-3", children: messageResponse.map((message, index) => ((0, jsx_runtime_1.jsx)("div", { children: message.type === 'received' ? ((0, jsx_runtime_1.jsx)(ReceivedMessage_1.ReceivedMessage, { message: message.message, time: message.time, sendFeedback: function () {
|
|
172
|
+
throw new Error('Function not implemented.');
|
|
173
|
+
}, sendMessage: function () {
|
|
174
|
+
throw new Error('Function not implemented.');
|
|
175
|
+
} })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-end px-5 animate-slide-in-right", children: (0, jsx_runtime_1.jsx)("div", { className: "w-[300px] flex flex-col items-end gap-1", children: (0, jsx_runtime_1.jsx)("div", { className: "flex flex-1 text-sm px-3.5 py-2.5 rounded-lg", style: {
|
|
176
|
+
backgroundColor: widget?.data
|
|
177
|
+
?.secondary_color,
|
|
178
|
+
color: widget?.data
|
|
179
|
+
?.user_message_text_color,
|
|
180
|
+
}, children: (0, jsx_runtime_1.jsx)(pager_md_1.default, { mdText: message.message.input ??
|
|
181
|
+
'' }) }) }) })) }, message.message?.event_id ?? index))) }) }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-start gap-2.5 bg-white", children: (0, jsx_runtime_1.jsx)("div", { className: "flex flex-col items-center justify-center gap-8 w-full overflow-hidden border border-zinc-100", children: (0, jsx_runtime_1.jsx)("div", { className: "flex items-center gap-2.5 px-4 py-2 w-full bg-white", children: (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-center gap-1.5 flex-1", children: (0, jsx_runtime_1.jsx)("div", { className: "inline-flex flex-col items-start justify-center", children: (0, jsx_runtime_1.jsx)("div", { className: "flex items-center w-full gap-1.5", children: (0, jsx_runtime_1.jsx)("span", { className: "font-text-xs-regular text-[#1d293d] text-xs tracking-[0px] leading-[18px] whitespace-nowrap", children: "Your conversation has ended" }) }) }) }) }) }) })] })] }));
|
|
182
|
+
};
|
|
183
|
+
exports.RecentMessagePage = RecentMessagePage;
|
|
@@ -0,0 +1,35 @@
|
|
|
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.RecentMessageTab = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const BotMain_1 = require("./BotMain");
|
|
10
|
+
const widgetStore_1 = require("./widgetStore");
|
|
11
|
+
const widgetConfigStore2_1 = require("./widgetConfigStore2");
|
|
12
|
+
const convertTime_1 = require("./utils/convertTime");
|
|
13
|
+
const useCurrentConversationExists_1 = require("./hooks/useCurrentConversationExists");
|
|
14
|
+
const PagerMarkdown_1 = __importDefault(require("./markdown/PagerMarkdown"));
|
|
15
|
+
const RecentMessageTab = () => {
|
|
16
|
+
const widget = (0, widgetConfigStore2_1.useWidgetData)();
|
|
17
|
+
const { hasRecentConversation, recentConversation } = (0, useCurrentConversationExists_1.useCurrentConversationExist)(widget?.data?.id);
|
|
18
|
+
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
19
|
+
const events = recentConversation?.events || [];
|
|
20
|
+
const lastEvent = events[events.length - 1];
|
|
21
|
+
const lastTime = lastEvent?.time;
|
|
22
|
+
const lastMessageText = lastEvent?.type === 'received'
|
|
23
|
+
? lastEvent.message?.output?.[0]?.value?.value
|
|
24
|
+
: lastEvent?.message?.input?.value; // fallback for sent type
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: hasRecentConversation && ((0, jsx_runtime_1.jsxs)("div", { className: `w-full flex items-center gap-2.5 pl-5 pr-4 py-3 rounded-xl bg-white cursor-pointer max-h-[200px]`, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), onClick: () => widgetStore_1.widgetStore.trigger.selectTab({
|
|
26
|
+
tab: BotMain_1.TabType.CHAT,
|
|
27
|
+
}), style: {
|
|
28
|
+
border: `1px solid ${isHovered ? widget?.data?.brand_color : '#e4e4e7'}`,
|
|
29
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-col items-start gap-1 flex-1 grow flex w-[91%]", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-col items-start gap-1 self-stretch w-full flex", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex-col items-start gap-[18px] self-stretch w-full flex", children: (0, jsx_runtime_1.jsx)("h3", { className: "w-fit mt-[-1.00px] text-sm font-semibold text-[#020618]", children: "Recent messages" }) }), (0, jsx_runtime_1.jsx)("div", { title: "Hello! Thanks for contacting us! all of\n our team", className: "flex-col items-start gap-[18px] self-stretch w-full flex", children: (0, jsx_runtime_1.jsx)("p", { className: "self-stretch mt-[-1.00px] max-h-8 text-sm text-[#020618] leading-5 whitespace-nowrap overflow-hidden text-ellipsis w-full", children: (0, jsx_runtime_1.jsx)(PagerMarkdown_1.default, { message: lastMessageText }) }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "items-center gap-1.5 self-stretch w-full flex", children: (0, jsx_runtime_1.jsx)("span", { className: "text-xs text-[#62748e]", children: (0, convertTime_1.formatTimeAMPM)(lastTime) }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "inline-flex items-center", children: (0, jsx_runtime_1.jsx)("svg", { style: {
|
|
30
|
+
color: isHovered
|
|
31
|
+
? widget?.data?.brand_color
|
|
32
|
+
: '#b8b8b8',
|
|
33
|
+
}, width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: (0, jsx_runtime_1.jsx)("path", { d: "M9 18l6-6-6-6" }) }) })] })) }));
|
|
34
|
+
};
|
|
35
|
+
exports.RecentMessageTab = RecentMessageTab;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetMessage = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Message_1 = require("./Message");
|
|
6
|
+
// TODO :: MEssageEntry Should have better Types
|
|
7
|
+
const WidgetMessage = ({ messages,
|
|
8
|
+
// typing,
|
|
9
|
+
sendFeedback, sendMessage, setMessages, }) => {
|
|
10
|
+
console.log('DEBUG :: updated messages', messages);
|
|
11
|
+
// const scrollRef = useChatScroll([messages, typing])
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: messages.map((message) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [console.log(message, 'messagein'), (0, jsx_runtime_1.jsx)(Message_1.Message, { messageResponse: message, sendFeedback: sendFeedback, sendMessage: sendMessage, setMessages: setMessages })] }))) }));
|
|
13
|
+
};
|
|
14
|
+
exports.WidgetMessage = WidgetMessage;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.WidgetToggleButton = void 0;
|
|
40
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
+
const pikaicons_react_1 = require("./assets/icons/pikaicons-react");
|
|
42
|
+
const react_1 = __importStar(require("react"));
|
|
43
|
+
const widgetConfigStore2_1 = require("./widgetConfigStore2");
|
|
44
|
+
const lucide_react_1 = require("lucide-react");
|
|
45
|
+
const HomePageHeader_1 = require("./HomePageHeader");
|
|
46
|
+
const widgetStore_1 = require("./widgetStore");
|
|
47
|
+
const useChatHistoryListExist_1 = require("./hooks/useChatHistoryListExist");
|
|
48
|
+
const pager_md_1 = __importDefault(require("./markdown/pager_md"));
|
|
49
|
+
const WidgetToggleButton = ({ setUserInitialMessage, widgetToggleState, toggleWidget, }) => {
|
|
50
|
+
const widget = (0, widgetConfigStore2_1.useWidgetData)();
|
|
51
|
+
const { status } = widget;
|
|
52
|
+
const [btnHover, setBtnHover] = react_1.default.useState(false);
|
|
53
|
+
const [floatBtnHover, setFloatBtnHover] = react_1.default.useState(null);
|
|
54
|
+
const [toggleText, setToggleText] = react_1.default.useState(true);
|
|
55
|
+
const [isToggleOpen, setIsToggleOpen] = react_1.default.useState(widgetToggleState);
|
|
56
|
+
const { recentChatList } = (0, useChatHistoryListExist_1.useChatHistoryListExists)();
|
|
57
|
+
if (!(status !== 'NOT_STARTED' &&
|
|
58
|
+
status !== 'WIDGET_LOADING' &&
|
|
59
|
+
status !== 'INVALID_STATE')) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
function hexToRGB(hex) {
|
|
63
|
+
if (!hex || typeof hex !== 'string')
|
|
64
|
+
return 'rgba(0, 0, 0, 0.2)';
|
|
65
|
+
hex = hex.replace(/^#/, '');
|
|
66
|
+
if (hex.length === 3) {
|
|
67
|
+
hex = hex
|
|
68
|
+
.split('')
|
|
69
|
+
.map((c) => c + c)
|
|
70
|
+
.join('');
|
|
71
|
+
}
|
|
72
|
+
const bigint = parseInt(hex, 16);
|
|
73
|
+
const r = (bigint >> 16) & 255;
|
|
74
|
+
const g = (bigint >> 8) & 255;
|
|
75
|
+
const b = bigint & 255;
|
|
76
|
+
return `rgba(${r}, ${g}, ${b}, 0.8)`;
|
|
77
|
+
}
|
|
78
|
+
const size = (0, react_1.useMemo)(() => {
|
|
79
|
+
return widget?.data?.launcher_logo_size;
|
|
80
|
+
}, [widget?.data?.launcher_logo_size]);
|
|
81
|
+
console.log(size, 'size');
|
|
82
|
+
const sizeClass = (() => {
|
|
83
|
+
switch (size) {
|
|
84
|
+
case 'S':
|
|
85
|
+
return 'w-[60px] h-[60px]';
|
|
86
|
+
case 'M':
|
|
87
|
+
return 'w-[80px] h-[80px]';
|
|
88
|
+
case 'L':
|
|
89
|
+
return 'w-[100px] h-[100px]';
|
|
90
|
+
case 'XL':
|
|
91
|
+
return 'w-[120px] h-[120px]';
|
|
92
|
+
case 'XXL':
|
|
93
|
+
return 'w-[140px] h-[140px]';
|
|
94
|
+
case 'XXXL':
|
|
95
|
+
return 'w-[160px] h-[160px]';
|
|
96
|
+
default:
|
|
97
|
+
return 'w-[100px] h-[100px]';
|
|
98
|
+
}
|
|
99
|
+
})();
|
|
100
|
+
const shapeClass = widget?.data?.launcher_logo_shape === 'Square'
|
|
101
|
+
? 'rounded-xl'
|
|
102
|
+
: 'rounded-full';
|
|
103
|
+
(0, react_1.useEffect)(() => {
|
|
104
|
+
if (widgetToggleState == 'CLOSE') {
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
setIsToggleOpen('CLOSE');
|
|
107
|
+
}, 0);
|
|
108
|
+
}
|
|
109
|
+
else if (widgetToggleState == 'OPEN') {
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
setIsToggleOpen('OPEN');
|
|
112
|
+
}, 200);
|
|
113
|
+
}
|
|
114
|
+
}, [widgetToggleState, toggleText]);
|
|
115
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col items-end gap-3", children: [toggleText &&
|
|
116
|
+
widgetToggleState == 'CLOSE' &&
|
|
117
|
+
!recentChatList &&
|
|
118
|
+
widget.data.widget_starter_flow_enabled &&
|
|
119
|
+
!localStorage.getItem('CURRENT_CONVERSATION') && ((0, jsx_runtime_1.jsxs)("span", { className: `relative group flex flex-col gap-3 mr-4 ${isToggleOpen === 'CLOSE' ? 'visible' : ''}`, children: [(0, jsx_runtime_1.jsx)("button", { onMouseOver: () => setFloatBtnHover(3), onMouseLeave: () => setFloatBtnHover(null), style: {
|
|
120
|
+
backgroundColor: widget.data.use_brand_color
|
|
121
|
+
? floatBtnHover === 3
|
|
122
|
+
? hexToRGB(widget.data.brand_color)
|
|
123
|
+
: widget.data.brand_color
|
|
124
|
+
: floatBtnHover === 3
|
|
125
|
+
? '#f0f0f0'
|
|
126
|
+
: 'white',
|
|
127
|
+
}, className: "cursor-pointer floating-chip-hover relative flex items-center justify-start rounded-lg min-h-[36px] px-2.5 py-2.5 shadow-md transition-all duration-300 max-w-[280px]", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-1.5", children: [(0, jsx_runtime_1.jsx)("img", { src: widget?.data?.logo_url, alt: "", className: "w-[22px] h-[22px]" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-1.5 items-start", children: [(0, jsx_runtime_1.jsx)("span", { style: {
|
|
128
|
+
color: widget.data
|
|
129
|
+
.use_brand_color
|
|
130
|
+
? (0, HomePageHeader_1.isDarkColor)(widget.data
|
|
131
|
+
.brand_color) == 'light'
|
|
132
|
+
? '#000000'
|
|
133
|
+
: '#FFFFFF'
|
|
134
|
+
: '#000000',
|
|
135
|
+
}, className: "text-xs font-semibold leading-[18px] text-start", children: widget?.data?.name }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
136
|
+
color: widget.data
|
|
137
|
+
.use_brand_color
|
|
138
|
+
? (0, HomePageHeader_1.isDarkColor)(widget.data
|
|
139
|
+
.brand_color) == 'light'
|
|
140
|
+
? '#000000'
|
|
141
|
+
: '#FFFFFF'
|
|
142
|
+
: '#000000',
|
|
143
|
+
}, className: "text-sm whitespace-pre-wrap font-regular leading-5 text-start", children: (0, jsx_runtime_1.jsx)(pager_md_1.default, { mdText: widget?.data
|
|
144
|
+
?.widget_greeting }) })] })] }) }), (0, jsx_runtime_1.jsx)("span", { onClick: () => setToggleText(false), style: {
|
|
145
|
+
background: '#FFFFFF',
|
|
146
|
+
color: '#000000',
|
|
147
|
+
border: '1px solid #000000',
|
|
148
|
+
}, className: `absolute -top-3 -right-3 p-[3.5px] rounded-full shadow-md border hover:text-zinc-500 hover:border-zinc-500 transform transition-all duration-200 opacity-0 translate-y-1 group-hover:opacity-100 group-hover:translate-y-0 pointer-events-none group-hover:pointer-events-auto cursor-pointer hover:scale-105 active:scale-95`, children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "w-3 h-3 transition-transform" }) }), (0, jsx_runtime_1.jsx)("div", { className: "w-[280px] flex flex-wrap gap-3 justify-end", children: Array.isArray(widget.data.starter_buttons) &&
|
|
149
|
+
widget.data.starter_buttons.map((buttonText, i) => ((0, jsx_runtime_1.jsx)("button", { onMouseOver: () => setFloatBtnHover(i), onMouseLeave: () => setFloatBtnHover(null), onClick: () => {
|
|
150
|
+
setUserInitialMessage(buttonText);
|
|
151
|
+
localStorage.setItem('Tab', 'Chat');
|
|
152
|
+
widgetStore_1.widgetStore.trigger.selectTab({
|
|
153
|
+
tab: widgetStore_1.TabType.CHAT,
|
|
154
|
+
});
|
|
155
|
+
toggleWidget();
|
|
156
|
+
}, style: {
|
|
157
|
+
backgroundColor: widget.data
|
|
158
|
+
.use_brand_color
|
|
159
|
+
? floatBtnHover === i
|
|
160
|
+
? hexToRGB(widget.data
|
|
161
|
+
.brand_color)
|
|
162
|
+
: widget.data
|
|
163
|
+
.brand_color
|
|
164
|
+
: floatBtnHover === i
|
|
165
|
+
? '#f0f0f0'
|
|
166
|
+
: 'white',
|
|
167
|
+
color: widget.data
|
|
168
|
+
.use_brand_color
|
|
169
|
+
? (0, HomePageHeader_1.isDarkColor)(widget.data
|
|
170
|
+
.brand_color) == 'light'
|
|
171
|
+
? '#000000'
|
|
172
|
+
: '#FFFFFF'
|
|
173
|
+
: '#000000',
|
|
174
|
+
}, className: "cursor-pointer floating-chip-hover flex items-center text-sm font-regular leading-5 rounded-[10px] min-h-max px-2.5 py-1.5 shadow-md transition-all duration-300 max-w-max w-max", children: buttonText }, i))) })] })), (0, jsx_runtime_1.jsxs)("button", { onClick: toggleWidget, onMouseEnter: () => setBtnHover(true), onMouseLeave: () => setBtnHover(false), style: {
|
|
175
|
+
borderColor: widget?.data?.brand_color,
|
|
176
|
+
}, className: `relative overflow-hidden flex items-center justify-center cursor-pointer transition ${shapeClass} ${widgetToggleState === 'OPEN' ? 'h-[58px] w-[58px]' : sizeClass} mb-4 mr-4 active:scale-95 duration-200 transition-all`, children: [isToggleOpen === 'CLOSE' &&
|
|
177
|
+
widget?.data?.launcher_logo && ((0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 bg-center bg-cover transition-all duration-200", style: {
|
|
178
|
+
backgroundImage: `url(${widget.data.launcher_logo})`,
|
|
179
|
+
} })), isToggleOpen === 'OPEN' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: `absolute inset-0 transition-all duration-200`, style: {
|
|
180
|
+
backgroundColor: btnHover
|
|
181
|
+
? hexToRGB(widget?.data?.brand_color)
|
|
182
|
+
: widget?.data?.brand_color,
|
|
183
|
+
opacity: widgetToggleState === 'OPEN' ? 1 : 0,
|
|
184
|
+
} }), (0, jsx_runtime_1.jsx)(pikaicons_react_1.PiMultipleCrossCancelDefaultStroke, { style: {
|
|
185
|
+
color: (0, HomePageHeader_1.isDarkColor)(widget.data.brand_color) ==
|
|
186
|
+
'light'
|
|
187
|
+
? '#000000'
|
|
188
|
+
: '#FFFFFF',
|
|
189
|
+
}, className: "w-8 h-8 relative z-10 transition-all duration-300" })] }))] })] }) }));
|
|
190
|
+
};
|
|
191
|
+
exports.WidgetToggleButton = WidgetToggleButton;
|