| 1 |
<?php |
| 2 |
|
| 3 |
namespace Booktics\Admin; |
| 4 |
|
| 5 |
use Booktics\Contracts\Hookable_Service_Contract; |
| 6 |
use ENS\Core\SDK; |
| 7 |
|
| 8 |
class Notification implements Hookable_Service_Contract { |
| 9 |
|
| 10 |
/** |
| 11 |
* Register notification |
| 12 |
* |
| 13 |
* @return void |
| 14 |
*/ |
| 15 |
public function register() { |
| 16 |
if ( class_exists( SDK::class ) ) { |
| 17 |
SDK::get_instance() |
| 18 |
->setup( |
| 19 |
array( |
| 20 |
'plugin_name' => 'Booktics', |
| 21 |
'plugin_slug' => 'booktics', |
| 22 |
'general_prefix' => 'bt', |
| 23 |
'text_domain' => 'booktics', |
| 24 |
'admin_script_handler' => 'booktics-dashboard-scripts', |
| 25 |
'sub_menu_filter_hook' => 'booktics_menu', |
| 26 |
'sub_menu_details' => |
| 27 |
array( |
| 28 |
'id' => 'booktics-automation', |
| 29 |
'title' => __( 'Automation', 'booktics' ), |
| 30 |
'link' => '/automation', |
| 31 |
'capability' => apply_filters( 'booktics_menu_permission_automation_dashboard', 'manage_options' ), |
| 32 |
'position' => apply_filters( 'booktics_menu_position_automation', 11 ), |
| 33 |
), |
| 34 |
) |
| 35 |
) |
| 36 |
->init(); |
| 37 |
|
| 38 |
add_filter( |
| 39 |
'ens_available_actions', function ( $actions ) { |
| 40 |
$actions = array( |
| 41 |
array( |
| 42 |
'trigger_label' => 'Order Created', |
| 43 |
'trigger_value' => 'order_created', |
| 44 |
'trigger_data' => array( |
| 45 |
array( |
| 46 |
'label' => 'Order No', |
| 47 |
'value' => 'order_no', |
| 48 |
'type' => 'string', |
| 49 |
), |
| 50 |
array( |
| 51 |
'label' => 'Order Date', |
| 52 |
'value' => 'order_date', |
| 53 |
'type' => 'date', |
| 54 |
), |
| 55 |
array( |
| 56 |
'label' => 'Order Total', |
| 57 |
'value' => 'order_total', |
| 58 |
'type' => 'string', |
| 59 |
), |
| 60 |
array( |
| 61 |
'label' => 'User Email', |
| 62 |
'value' => 'user_email', |
| 63 |
'type' => 'string', |
| 64 |
), |
| 65 |
), |
| 66 |
'delay_dependencies' => array( |
| 67 |
array( |
| 68 |
'label' => 'Order Date', |
| 69 |
'value' => 'order_date', |
| 70 |
), |
| 71 |
), |
| 72 |
'email_receivers' => array( |
| 73 |
array( |
| 74 |
'label' => 'User Email', |
| 75 |
'value' => 'user_email', |
| 76 |
), |
| 77 |
), |
| 78 |
), |
| 79 |
array( |
| 80 |
'trigger_label' => 'Appointment Rescheduled', |
| 81 |
'trigger_value' => 'appointment_rescheduled', |
| 82 |
'trigger_data' => array( |
| 83 |
array( |
| 84 |
'label' => 'Service Name', |
| 85 |
'value' => 'appointment_service', |
| 86 |
'type' => 'string', |
| 87 |
), |
| 88 |
array( |
| 89 |
'label' => 'Date', |
| 90 |
'value' => 'date', |
| 91 |
'type' => 'date', |
| 92 |
), |
| 93 |
array( |
| 94 |
'label' => 'Team Member Name', |
| 95 |
'value' => 'appointment_team_member', |
| 96 |
'type' => 'string', |
| 97 |
), |
| 98 |
array( |
| 99 |
'label' => 'Start Time', |
| 100 |
'value' => 'start_time', |
| 101 |
'type' => 'string', |
| 102 |
), |
| 103 |
array( |
| 104 |
'label' => 'End Time', |
| 105 |
'value' => 'end_time', |
| 106 |
'type' => 'string', |
| 107 |
), |
| 108 |
array( |
| 109 |
'label' => 'User Email', |
| 110 |
'value' => 'user_email', |
| 111 |
'type' => 'string', |
| 112 |
), |
| 113 |
), |
| 114 |
'delay_dependencies' => array( |
| 115 |
array( |
| 116 |
'label' => 'Date', |
| 117 |
'value' => 'date', |
| 118 |
), |
| 119 |
), |
| 120 |
'email_receivers' => array( |
| 121 |
array( |
| 122 |
'label' => 'User Email', |
| 123 |
'value' => 'user_email', |
| 124 |
), |
| 125 |
), |
| 126 |
), |
| 127 |
array( |
| 128 |
'trigger_label' => 'Appointment Cancelled', |
| 129 |
'trigger_value' => 'appointment_cancelled', |
| 130 |
'trigger_data' => array( |
| 131 |
array( |
| 132 |
'label' => 'Service Name', |
| 133 |
'value' => 'appointment_service', |
| 134 |
'type' => 'string', |
| 135 |
), |
| 136 |
array( |
| 137 |
'label' => 'Date', |
| 138 |
'value' => 'date', |
| 139 |
'type' => 'date', |
| 140 |
), |
| 141 |
array( |
| 142 |
'label' => 'Team Member Name', |
| 143 |
'value' => 'appointment_team_member', |
| 144 |
'type' => 'string', |
| 145 |
), |
| 146 |
array( |
| 147 |
'label' => 'Start Time', |
| 148 |
'value' => 'start_time', |
| 149 |
'type' => 'string', |
| 150 |
), |
| 151 |
array( |
| 152 |
'label' => 'End Time', |
| 153 |
'value' => 'end_time', |
| 154 |
'type' => 'string', |
| 155 |
), |
| 156 |
array( |
| 157 |
'label' => 'User Email', |
| 158 |
'value' => 'user_email', |
| 159 |
'type' => 'string', |
| 160 |
), |
| 161 |
), |
| 162 |
'delay_dependencies' => array( |
| 163 |
array( |
| 164 |
'label' => 'Date', |
| 165 |
'value' => 'date', |
| 166 |
), |
| 167 |
), |
| 168 |
'email_receivers' => array( |
| 169 |
array( |
| 170 |
'label' => 'User Email', |
| 171 |
'value' => 'user_email', |
| 172 |
), |
| 173 |
), |
| 174 |
), |
| 175 |
array( |
| 176 |
'trigger_label' => 'Team Member Created', |
| 177 |
'trigger_value' => 'team_member_created', |
| 178 |
'trigger_data' => array( |
| 179 |
array( |
| 180 |
'label' => 'Team Member Name', |
| 181 |
'value' => 'team_member_name', |
| 182 |
'type' => 'string', |
| 183 |
), |
| 184 |
array( |
| 185 |
'label' => 'Team Member Email', |
| 186 |
'value' => 'team_member_email', |
| 187 |
'type' => 'string', |
| 188 |
), |
| 189 |
array( |
| 190 |
'label' => 'Password Reset URL', |
| 191 |
'value' => 'password_reset_url', |
| 192 |
'type' => 'string', |
| 193 |
), |
| 194 |
), |
| 195 |
'delay_dependencies' => array(), |
| 196 |
'email_receivers' => array( |
| 197 |
array( |
| 198 |
'label' => 'Team Member Email', |
| 199 |
'value' => 'team_member_email', |
| 200 |
), |
| 201 |
), |
| 202 |
), |
| 203 |
); |
| 204 |
|
| 205 |
return $actions; |
| 206 |
} |
| 207 |
); |
| 208 |
} |
| 209 |
} |
| 210 |
} |
| 211 |
|