Skip to content

Commit edc0435

Browse files
committed
Initial commit v0.5.0
1 parent d074b91 commit edc0435

File tree

8 files changed

+33
-8
lines changed

8 files changed

+33
-8
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ The available options are:
105105
| cssUrl | `undefined` | `String` | Location of an external chat.css file. |
106106
| formFallback | `false` | `Boolean` | Fallback to form, see next section for description |
107107
| formFallbackMessage | See includes/function/chat.php | `String` | Message displayed above the Fallback Form, if no agent is available |
108+
| loaderWaitingMessage | See includes/function/chat.php | `String` | Message in chat modal, when waiting for agent to answer |
108109
| waitingListWaitingMessage | See includes/function/chat.php | `String` | Message in chat modal, if user already waits a bit longer |
109110
| waitingListTimeoutMessage | See includes/function/chat.php | `String` | Message displayed above the Fallback Form, if user waited too long |
110111

assets/css/shared/chat.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ $black: #000;
184184
}
185185
}
186186

187+
.zammad-chat-is-open .zammad-chat-modal {
188+
flex-direction: column;
189+
}
190+
187191
.zammad-chat-modal {
188192
align-items: center;
189193
background: $white;
@@ -233,7 +237,7 @@ $black: #000;
233237
}
234238

235239
.zammad-chat-modal .zammad-chat-loading-animation {
236-
margin-right: 8px;
240+
margin-bottom: 8px;
237241
vertical-align: middle;
238242
}
239243

assets/js/shared/chat.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,27 @@ jQuery(function initForm($) {
122122
};
123123
};
124124

125+
chat.showLoader = () => {
126+
zammadDebugMessage('Show loader...');
127+
// Get the Zammad loader view
128+
const loader = chat.el
129+
.find('.zammad-chat-modal')
130+
.html(chat.view('loader')());
131+
// Allow to override the loading text
132+
if (chatOptions.loaderWaitingMessage.length) {
133+
zammadChatModalText(chatOptions.loaderWaitingMessage);
134+
}
135+
return loader;
136+
};
137+
125138
chat.onQueue = () => {
126139
zammadDebugMessage('Waiting for an agent to answer...');
127140
zammadDebugMessage(chat, true);
128141

129142
// Reducing the time we wait for an agent to answer
130-
chat.waitingListTimeout.options.timeout = '0';
131-
chat.waitingListTimeout.options.timeoutIntervallCheck = '0.2';
143+
chat.waitingListTimeout.options.timeout = chatOptions.timeout;
144+
chat.waitingListTimeout.options.timeoutIntervallCheck =
145+
chatOptions.timeoutIntervallCheck;
132146

133147
// Let the user know that we are waiting
134148
zammadChatModalText(chatOptions.waitingListWaitingMessage);
@@ -143,7 +157,7 @@ jQuery(function initForm($) {
143157

144158
// Add reload functionality e.g. to buttons
145159
form.find('.js-restart').on('click', function zammadReloadWindow() {
146-
zammadDebugMessage('Reload Window...');
160+
zammadDebugMessage('Reload Window to start new chat...');
147161
window.location.reload();
148162
});
149163

dist/css/chat-style.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/chat.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/functions/chat.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ function zammad_init_chat($chat_id = 1, $args = array())
7171
'inactiveClass' => 'is-inactive',
7272
'cssAutoload' => (bool) false,
7373
'cssUrl ' => null,
74+
'timeout' => '0.4', // Minutes to wait till timeout when waiting for an agents answer
75+
'timeoutIntervallCheck' => '0.5', // Interval to check for timeout
7476
'formFallback' => (bool) false,
7577
'formFallbackMessage' => __('Please send us your request and we will answer as soon as possible', 'zammad-wp'),
78+
'loaderWaitingMessage' => '',
7679
'waitingListWaitingMessage' => __('Sorry for the delay, still connecting.', 'zammad-wp'),
7780
'waitingListTimeoutMessage' => sprintf(
7881
// translators: Placeholder is "click here" link text

plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414

1515
// Useful global constants.
16-
define('ZAMMAD_WP_VERSION', '0.4.0');
16+
define('ZAMMAD_WP_VERSION', '0.5.0');
1717
define('ZAMMAD_WP_URL', plugin_dir_url(__FILE__));
1818
define('ZAMMAD_WP_PATH', plugin_dir_path(__FILE__));
1919
define('ZAMMAD_WP_INC', ZAMMAD_WP_PATH . 'includes/');

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/ouun
44
Tags: zammad, live-chat, ticketing, forms, feedback
55
Requires at least: 4.5
66
Tested up to: 5.5
7-
Stable tag: 0.4.0
7+
Stable tag: 0.5.0
88

99
This plugin helps you embed Zammad Chats & Forms into your WordPress site and gives you access to the Zammad API if required.
1010

@@ -25,6 +25,9 @@ Use `composer require ouun/zammad-wp` to install
2525

2626
== Changelog ==
2727

28+
= 0.5.0 =
29+
* Adds more options to set custom messages
30+
2831
= 0.4.0 =
2932
* Various fixes
3033

0 commit comments

Comments
 (0)