-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquickchat.php
More file actions
119 lines (114 loc) · 4.95 KB
/
quickchat.php
File metadata and controls
119 lines (114 loc) · 4.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/**
* Plugin Name: QuickChat (Example)
* Description: WP Wireframe example — a SaaS-style chat plugin with its entire config in a single file.
* Version: 1.0.0
* Requires at least: 6.5
* Requires PHP: 8.1
* License: GPL-2.0-or-later
* Text Domain: quickchat
*/
declare(strict_types=1);
if (! defined('ABSPATH')) {
exit;
}
require_once __DIR__ . '/vendor/wp-wireframe/vendor/autoload.php';
add_action('init', function () {
Wireframe\App::boot([
'prefix' => 'quickchat',
'page_title' => __('QuickChat', 'quickchat'),
'option_key' => 'quickchat_settings',
'menu_icon' => 'dashicons-format-status',
'config' => [
'title' => __('QuickChat', 'quickchat'),
'subtitle' => __('Drop-in support chat for your site.', 'quickchat'),
'sections' => [
[
'id' => 'connection',
'title' => __('Connect your workspace', 'quickchat'),
'description' => __('Find these in your QuickChat dashboard under Settings → API.', 'quickchat'),
'fields' => [
[
'id' => 'workspace_id',
'type' => 'text',
'label' => __('Workspace ID', 'quickchat'),
'required' => true,
'columns' => 6,
'args' => ['placeholder' => 'ws_...'],
],
[
'id' => 'api_key',
'type' => 'password',
'label' => __('API key', 'quickchat'),
'required' => true,
'columns' => 6,
'args' => ['placeholder' => 'sk_...'],
],
],
],
[
'id' => 'appearance',
'title' => __('Appearance', 'quickchat'),
'fields' => [
[
'id' => 'accent_color',
'type' => 'color',
'label' => __('Accent color', 'quickchat'),
'default' => '#3858e9',
'columns' => 6,
],
[
'id' => 'position',
'type' => 'select',
'label' => __('Position', 'quickchat'),
'default' => 'bottom-right',
'columns' => 6,
'args' => [
'options' => [
'bottom-right' => __('Bottom right', 'quickchat'),
'bottom-left' => __('Bottom left', 'quickchat'),
],
],
],
[
'id' => 'greeting',
'type' => 'textarea',
'label' => __('Greeting message', 'quickchat'),
'description' => __('Shown when the widget opens.', 'quickchat'),
'default' => __('Hi! How can we help?', 'quickchat'),
'args' => ['rows' => 3],
],
],
],
[
'id' => 'behaviour',
'title' => __('Behaviour', 'quickchat'),
'fields' => [
[
'id' => 'show_on_mobile',
'type' => 'toggle',
'label' => __('Show on mobile', 'quickchat'),
'default' => true,
'columns' => 6,
],
[
'id' => 'hide_for_logged_in',
'type' => 'toggle',
'label' => __('Hide for logged-in users', 'quickchat'),
'default' => false,
'columns' => 6,
],
[
'id' => 'delay_seconds',
'type' => 'number',
'label' => __('Delay before showing (seconds)', 'quickchat'),
'default' => 3,
'columns' => 6,
'args' => ['min' => 0, 'max' => 60],
],
],
],
],
],
]);
});