Skip to content

Commit 1d9c14f

Browse files
better Ecommerce Flow
1 parent dd7c4dc commit 1d9c14f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

app/base/blocks/AIChatBlock.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,14 @@ protected function chatBotCss(): TagElement
149149
text-align: center;
150150
font-size: 13px;
151151
color: #555;
152-
}
152+
}
153+
154+
.ai-chat-intro {
155+
background: #f9f9f9;
156+
border-bottom: 1px solid #eee;
157+
text-align: center;
158+
font-size: 11px;
159+
}
153160
'
154161
]]);
155162
}
@@ -213,16 +220,20 @@ function sendMessage() {
213220
]]);
214221
}
215222

216-
protected function chatBotDialog(): string
223+
protected function chatBotDialog(?BasePage $current_page = null): string
217224
{
225+
$title = App::getInstance()->getUtils()->translate('Ecommerce AI Companion', locale: $current_page?->getCurrentLocale());
226+
$intro = App::getInstance()->getUtils()->translate('Ask me to find products, add them to your cart, and assist you with your shopping needs!', locale: $current_page?->getCurrentLocale());
227+
218228
return <<<HTML
219229
<div id="ai-chat-modal" class="ai-chat-modal" style="display:none;">
220230
<div class="ai-chat-backdrop"></div>
221231
<div class="ai-chat-window">
222232
<div class="ai-chat-header">
223-
<span>Assistente AI</span>
233+
<span>$title</span>
224234
<button id="ai-chat-close">×</button>
225235
</div>
236+
<div class="ai-chat-intro">$intro</div>
226237
<div class="ai-chat-messages" id="ai-chat-messages"></div>
227238
<div class="ai-chat-loading" id="ai-chat-loading" style="display:none;">Sto pensando...</div>
228239
<div class="ai-chat-input">
@@ -260,7 +271,7 @@ public function renderHTML(?BasePage $current_page = null, array $data = []): st
260271
return $this->chatBotCss() .
261272
$this->chatBotJs() .
262273
$this->chatBotLaucher() .
263-
$this->chatBotDialog();
274+
$this->chatBotDialog($current_page);
264275
} catch (Exception $e) {
265276
return "";
266277
}

0 commit comments

Comments
 (0)