| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace RenzoJohnson\Blocks\Settings\Tabs; |
| 6 |
|
| 7 |
use RenzoJohnson\Blocks\Settings\FieldDefinition; |
| 8 |
use RenzoJohnson\Blocks\Settings\FieldType; |
| 9 |
use RenzoJohnson\Blocks\Settings\Requirement; |
| 10 |
use RenzoJohnson\Blocks\Settings\SanitizerType; |
| 11 |
use RenzoJohnson\Blocks\Settings\SectionDefinition; |
| 12 |
use RenzoJohnson\Blocks\Settings\SettingDefinition; |
| 13 |
use RenzoJohnson\Blocks\Settings\TabDefinition; |
| 14 |
use RenzoJohnson\Blocks\Settings\TabProvider; |
| 15 |
|
| 16 |
\defined( 'ABSPATH' ) || exit; |
| 17 |
|
| 18 |
final class SupportTab implements TabProvider { |
| 19 |
|
| 20 |
public function definition(): TabDefinition { |
| 21 |
return new TabDefinition( |
| 22 |
'support', |
| 23 |
\__( 'Support', 'blocks' ), |
| 24 |
array( |
| 25 |
new SectionDefinition( |
| 26 |
'blocks_support_hours_section', |
| 27 |
\__( 'Support Hours', 'blocks' ), |
| 28 |
array( |
| 29 |
\__( 'Set your business hours for support availability. Live chat only loads during these hours.', 'blocks' ), |
| 30 |
), |
| 31 |
array( |
| 32 |
new FieldDefinition( |
| 33 |
'blocks_support_hours', |
| 34 |
\__( 'Monday to Friday', 'blocks' ), |
| 35 |
'', |
| 36 |
FieldType::SupportHours, |
| 37 |
array( |
| 38 |
new SettingDefinition( 'blocks_support_hours_start', 'integer', 9, SanitizerType::Hour, sensitive: false, exportable: true, public_token: null ), |
| 39 |
new SettingDefinition( 'blocks_support_hours_end', 'integer', 17, SanitizerType::Hour, sensitive: false, exportable: true, public_token: null ), |
| 40 |
), |
| 41 |
array(), |
| 42 |
Requirement::Always, |
| 43 |
), |
| 44 |
), |
| 45 |
false, |
| 46 |
), |
| 47 |
new SectionDefinition( |
| 48 |
'blocks_livechat_section', |
| 49 |
\__( 'Live Chat', 'blocks' ), |
| 50 |
array( |
| 51 |
\__( 'Configure the live chat widget. Provider identifiers are public widget identifiers, not secret credentials.', 'blocks' ), |
| 52 |
), |
| 53 |
array( |
| 54 |
new FieldDefinition( |
| 55 |
'blocks_livechat_enabled', |
| 56 |
\__( 'Enable Live Chat', 'blocks' ), |
| 57 |
\__( 'Load the chat widget and register the REST endpoint.', 'blocks' ), |
| 58 |
FieldType::Checkbox, |
| 59 |
array( |
| 60 |
new SettingDefinition( 'blocks_livechat_enabled', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ), |
| 61 |
), |
| 62 |
array(), |
| 63 |
Requirement::Always, |
| 64 |
), |
| 65 |
new FieldDefinition( |
| 66 |
'blocks_livechat_tawk', |
| 67 |
\__( 'Tawk.to', 'blocks' ), |
| 68 |
\__( 'Load the Tawk.to chat widget.', 'blocks' ), |
| 69 |
FieldType::Checkbox, |
| 70 |
array( |
| 71 |
new SettingDefinition( 'blocks_livechat_tawk', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ), |
| 72 |
), |
| 73 |
array(), |
| 74 |
Requirement::Always, |
| 75 |
), |
| 76 |
new FieldDefinition( |
| 77 |
'blocks_livechat_tawk_id', |
| 78 |
\__( 'Tawk.to Property / Widget ID', 'blocks' ), |
| 79 |
\__( 'Enter the property and widget path shown in the Tawk.to embed URL.', 'blocks' ), |
| 80 |
FieldType::Text, |
| 81 |
array( |
| 82 |
new SettingDefinition( 'blocks_livechat_tawk_id', 'string', '', SanitizerType::LiveChatTawkId, sensitive: false, exportable: true, public_token: null ), |
| 83 |
), |
| 84 |
array( |
| 85 |
'placeholder' => '000000000000000000000000/0000000000', |
| 86 |
), |
| 87 |
Requirement::Always, |
| 88 |
), |
| 89 |
new FieldDefinition( |
| 90 |
'blocks_livechat_olark', |
| 91 |
\__( 'Olark', 'blocks' ), |
| 92 |
\__( 'Load the Olark chat widget.', 'blocks' ), |
| 93 |
FieldType::Checkbox, |
| 94 |
array( |
| 95 |
new SettingDefinition( 'blocks_livechat_olark', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ), |
| 96 |
), |
| 97 |
array(), |
| 98 |
Requirement::Always, |
| 99 |
), |
| 100 |
new FieldDefinition( |
| 101 |
'blocks_livechat_olark_id', |
| 102 |
\__( 'Olark Site ID', 'blocks' ), |
| 103 |
\__( 'Enter the site ID from the Olark installation code.', 'blocks' ), |
| 104 |
FieldType::Text, |
| 105 |
array( |
| 106 |
new SettingDefinition( 'blocks_livechat_olark_id', 'string', '', SanitizerType::LiveChatOlarkId, sensitive: false, exportable: true, public_token: null ), |
| 107 |
), |
| 108 |
array( |
| 109 |
'placeholder' => '0000-000-00-0000', |
| 110 |
), |
| 111 |
Requirement::Always, |
| 112 |
), |
| 113 |
new FieldDefinition( |
| 114 |
'blocks_livechat_crisp', |
| 115 |
\__( 'Crisp', 'blocks' ), |
| 116 |
\__( 'Load the Crisp chat widget.', 'blocks' ), |
| 117 |
FieldType::Checkbox, |
| 118 |
array( |
| 119 |
new SettingDefinition( 'blocks_livechat_crisp', 'boolean', false, SanitizerType::Boolean, sensitive: false, exportable: true, public_token: null ), |
| 120 |
), |
| 121 |
array(), |
| 122 |
Requirement::Always, |
| 123 |
), |
| 124 |
new FieldDefinition( |
| 125 |
'blocks_livechat_crisp_id', |
| 126 |
\__( 'Crisp Website ID', 'blocks' ), |
| 127 |
\__( 'Enter the website ID from the Crisp setup instructions.', 'blocks' ), |
| 128 |
FieldType::Text, |
| 129 |
array( |
| 130 |
new SettingDefinition( 'blocks_livechat_crisp_id', 'string', '', SanitizerType::LiveChatCrispId, sensitive: false, exportable: true, public_token: null ), |
| 131 |
), |
| 132 |
array( |
| 133 |
'placeholder' => '00000000-0000-0000-0000-000000000000', |
| 134 |
), |
| 135 |
Requirement::Always, |
| 136 |
), |
| 137 |
), |
| 138 |
false, |
| 139 |
), |
| 140 |
), |
| 141 |
Requirement::Always, |
| 142 |
); |
| 143 |
} |
| 144 |
} |
| 145 |
|