Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Api_Fields extends Action_Field {
public static function get_name() {
return 'Field mapping';
}
public static function get_description() {
return 'Field mapping lets you add more contact information to your email service. If the name field receives two names separated by a space, they will automatically be split and saved as a first and last name.';
}
public static function get_placeholder() {
return 'Field mapping';
}
public static function get_id() {
return 'api_fields';
}
public static function get_type() {
return 'mapping_pair';
}
public static function get_preview_template() {
return '';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback( $action_id, $action_data ) {
$values = array(
0 => array(
'id' => 'name',
'label' => __( 'Name', 'thrive-dash' ),
),
1 => array(
'id' => 'phone',
'label' => __( 'Phone', 'thrive-dash' ),
),
);
if ( ! empty( $action_data ) ) {
if ( is_string( $action_data ) ) {
$api = $action_data;
} else if ( property_exists( $action_data, 'autoresponder' ) ) {
$api = $action_data->autoresponder->value;
}
}
if ( ! empty( $api ) ) {
$api_instance = \Thrive_Dash_List_Manager::connection_instance( $api );
if ( $api_instance && $api_instance->is_connected() && $api_instance->has_custom_fields() ) {
$mailing_list = empty( $action_data->autoresponder->subfield->mailing_list->value ) ? '' : $action_data->autoresponder->subfield->mailing_list->value;
$custom_fields = $api_instance->get_custom_fields_by_list( $mailing_list );
foreach ( $custom_fields as $key => $field ) {
array_push( $values, array(
'id' => $field['id'],
'label' => $field['label'] ?: $field['name'],
) );
}
}
}
return array_reverse( $values, true );
}
public static function get_validators() {
return array( 'key_value_pair' );
}
public static function allow_dynamic_data() {
return true;
}
}

View File

@@ -0,0 +1,102 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
use Thrive_Dash_List_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Autoresponder_Field
*/
class Autoresponder_Field extends Action_Field {
/**
* Field name
*/
public static function get_name() {
return 'Autoresponder';
}
/**
* Field description
*/
public static function get_description() {
return static::get_placeholder();
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return __( 'Choose service from your list of registered APIs to use', 'thrive-dash' );
}
/**
* $$value will be replaced by field value
* $$length will be replaced by value length
*
*
* @return string
*/
public static function get_preview_template() {
return 'Autoresponder: $$value';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback( $action_id, $action_data ) {
$is_tag_action = $action_id === Tag_User::get_id();
$apis = Thrive_Dash_List_Manager::get_available_apis( true, [
'exclude_types' => [
'email',
'webinar',
'other',
'recaptcha',
'social',
'sellings',
'integrations',
'storage',
'collaboration',
'testimonial',
],
] );
$values = array();
foreach ( $apis as $api ) {
//email is seen as autoresponder
$allow_tags = true;
if ( $is_tag_action ) {
$allow_tags = $api->has_tags();
}
if ( $allow_tags && ! in_array( $api->get_key(), array( 'email', 'wordpress' ) ) ) {
$values[ $api->get_key() ] = array(
'id' => $api->get_key(),
'label' => $api->get_title(),
);
}
}
return $values;
}
public static function get_id() {
return 'autoresponder';
}
public static function get_type() {
return 'select';
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
}

View File

@@ -0,0 +1,49 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
use Thrive\Automator\Items\Action_Field;
class Facebook_Custom_Options_Field extends Action_Field {
public static function get_id() {
return 'fb/custom_options';
}
public static function get_name() {
return __( 'Facebook custom options', 'thrive-dash' );
}
public static function get_description() {
return '';
}
public static function get_placeholder() {
return '';
}
public static function get_type() {
return 'key_value_pair';
}
public static function get_preview_template() {
return '';
}
public static function allow_dynamic_data() {
return true;
}
public static function get_validators() {
return [ 'key_value_pair' ];
}
}

View File

@@ -0,0 +1,49 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Facebook_Event_Field extends Action_Field {
public static function get_name() {
return __( 'Event', 'thrive-dash' );
}
public static function get_description() {
return '';
}
public static function get_placeholder() {
return __( 'Choose a standard event name', 'thrive-dash' );
}
public static function get_id() {
return 'fb/event';
}
public static function get_type() {
return 'select';
}
public static function get_field_values( $filters = [] ) {
return Facebook::get_event_types();
}
public static function get_preview_template() {
return 'Event: $$value';
}
public static function get_validators() {
return [ 'required' ];
}
}

View File

@@ -0,0 +1,49 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
use Thrive\Automator\Items\Action_Field;
class Facebook_Event_Name_Field extends Action_Field {
public static function get_id() {
return 'fb/event_name';
}
public static function get_name() {
return __( 'Custom event name', 'thrive-dash' );
}
public static function get_description() {
return '';
}
public static function get_placeholder() {
return __( 'Enter a name for your custom event', 'thrive-dash' );
}
public static function get_validators() {
return [ 'required' ];
}
public static function allow_dynamic_data() {
return true;
}
public static function get_type() {
return 'input';
}
public static function get_preview_template() {
return __( 'Custom event name: ', 'thrive-dash' ) . '$$value';
}
}

View File

@@ -0,0 +1,53 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
use Thrive\Automator\Items\Action_Field;
class Facebook_Standard_Options_Field extends Action_Field {
public static function get_id() {
return 'fb/standard_options';
}
public static function get_name() {
return __( 'Facebook standard options', 'thrive-dash' );
}
public static function get_description() {
return '';
}
public static function get_placeholder() {
return '';
}
public static function get_type() {
return 'mapping_pair';
}
public static function get_field_values( $filters = [] ) {
return array_merge( Facebook::get_standard_options(), Facebook::get_event_options(), Facebook::get_user_options() );
}
public static function allow_dynamic_data() {
return true;
}
public static function get_preview_template() {
return '';
}
public static function get_validators() {
return [ 'key_value_pair' ];
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
use Thrive_Dash_List_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Form_List_Field
*/
class Form_List_Field extends Action_Field {
/**
* Field name
*/
public static function get_name() {
return __( 'Select the form', 'thrive-dash' );
}
/**
* Field description
*/
public static function get_description() {
return static::get_placeholder();
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return __( 'Choose the form you want to use', 'thrive-dash' );
}
/**
* $$value will be replaced by field value
* $$length will be replaced by value length
*
*
* @return string
*/
public static function get_preview_template() {
return '';
}
public static function get_id() {
return 'form_list';
}
public static function get_type() {
return 'select';
}
public static function get_options_callback( $action_id, $action_data ) {
$values = array();
if ( ! empty( $action_data ) ) {
if ( is_string( $action_data ) ) {
$api = $action_data;
} else if ( property_exists( $action_data, 'autoresponder' ) ) {
$api = $action_data->autoresponder->value;
}
}
if ( ! empty( $api ) ) {
$api_instance = Thrive_Dash_List_Manager::connection_instance( $api );
if ( $api_instance && $api_instance->is_connected() && $api_instance->has_forms() ) {
$forms = $api_instance->get_forms();
if ( ! empty( $forms[ $action_data->autoresponder->subfield->mailing_list->value ] ) ) {
$values = $forms[ $action_data->autoresponder->subfield->mailing_list->value ];
}
}
}
return $values;
}
}

View File

@@ -0,0 +1,107 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Mailing_List_Field
*/
class Mailing_List_Field extends Action_Field {
/**
* Field name
*/
public static function get_name() {
return 'Add the user to the following list';
}
/**
* Field description
*/
public static function get_description() {
return static::get_placeholder();
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return __( 'Select an autoresponder mailing list to add the user to', 'thrive-dash' );
}
/**
* $$value will be replaced by field value
* $$length will be replaced by value length
*
*
* @return string
*/
public static function get_preview_template() {
return 'List: $$value';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback( $action_id, $action_data ) {
$lists = [];
if ( ! empty( $action_data ) ) {
if ( is_string( $action_data ) ) {
$api = $action_data;
} else if ( property_exists( $action_data, 'autoresponder' ) ) {
$api = $action_data->autoresponder->value;
}
}
if ( ! empty( $api ) ) {
$api_instance = \Thrive_Dash_List_Manager::connection_instance( $api );
if ( $api_instance && $api_instance->is_connected() ) {
$lists = $api_instance->get_lists( false );
if ( $api_instance->has_forms() ) {
$lists = static::add_form_data( $lists, $api_instance->get_forms() );
}
}
}
return $lists;
}
public static function get_id() {
return 'mailing_list';
}
public static function get_type() {
return 'select';
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
/**
* @param array $lists
* @param array $forms
*
* @return array
*/
public static function add_form_data( $lists, $forms ) {
foreach ( $lists as $key => $list ) {
if ( is_array( $list ) ) {
$lists[ $key ]['values'] = $forms[ $list['id'] ];
} else {
$lists[ $key ]->values = $forms[ $list->id ];
}
}
return $lists;
}
}

View File

@@ -0,0 +1,68 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Autoresponder_Field
*/
class Optin_Type_Field extends Action_Field {
/**
* Field name
*/
public static function get_name() {
return 'Optin';
}
/**
* Field description
*/
public static function get_description() {
return 'Choose the type of optin you would like. Double optin means your subscribers will need to confirm their email address before being added to your list';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return 'Choose autoresponder';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback( $action_id, $action_data ) {
return array(
's' => array(
'id' => 's',
'name' => 'Single',
),
'd' => array(
'id' => 'd',
'name' => 'Double',
),
);
}
public static function get_id() {
return 'optin';
}
public static function get_type() {
return 'select';
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
}

View File

@@ -0,0 +1,75 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
use Thrive_Dash_List_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Form_List_Field
*/
class Slack_Channel_Field extends Action_Field {
/**
* Field name
*/
public static function get_name() {
return __( 'Slack channel', 'thrive-dash' );
}
/**
* Field description
*/
public static function get_description() {
return __( 'Choose the slack channel you want to use', 'thrive-dash' );
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return __( 'Select a channel', 'thrive-dash' );
}
/**
* $$value will be replaced by field value
* $$length will be replaced by value length
*
*
* @return string
*/
public static function get_preview_template() {
return '';
}
public static function get_id() {
return 'slack_channel';
}
public static function get_type() {
return 'select';
}
public static function get_options_callback( $action_id, $action_data ) {
$values = array();
$api_instance = Thrive_Dash_List_Manager::connection_instance( 'slack' );
if ( $api_instance && $api_instance->is_connected() ) {
$channels = $api_instance->get_channel_list();
foreach ( $channels as $channel ) {
$values[ $channel->id ] = [ 'name' => $channel->name, 'id' => $channel->id ];
}
}
return $values;
}
public static function get_validators() {
return [ 'required' ];
}
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-automator
*/
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
use Thrive\Automator\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Slack_Message_Title_Field extends Action_Field {
public static function get_name() {
return __( 'Message title', 'thrive-dash' );
}
public static function get_description() {
return __( 'Message title', 'thrive-dash' );
}
public static function get_placeholder() {
return __( 'Enter the title of your notification', 'thrive-dash' );
}
public static function get_id() {
return 'slack_message_title';
}
public static function get_type() {
return Utils::FIELD_TYPE_TEXT;
}
public static function get_validators() {
return [ 'required' ];
}
public static function is_ajax_field() {
return false;
}
public static function get_preview_template() {
return __( 'Message title:', 'thrive-dash' ) . '$$value';
}
public static function allow_dynamic_data() {
return true;
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-automator
*/
namespace TVE\Dashboard\Automator;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
use Thrive\Automator\Items\Connection_Test;
class Slack_Test_Notification_Field extends Connection_Test {
public static function get_name() {
return '';
}
public static function get_description() {
return '';
}
public static function get_placeholder() {
return '';
}
public static function get_id() {
return 'slack_test_notification_button';
}
public static function get_type() {
return 'action_test';
}
public static function get_extra_options() {
return [
'success_message' => __( 'Slack notification sent successfully', 'thrive-automator' ),
];
}
}

View File

@@ -0,0 +1,74 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Tag_Input_Field
*/
class Tag_Input_Field extends Action_Field {
/**
* Field name
*/
public static function get_name() {
return 'Tags';
}
/**
* Field description
*/
public static function get_description() {
return 'Which tag(s) would you like to apply? Use a comma to add multiple tags. Example:- tag1, tag2';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
/**
* $$value will be replaced by field value
* $$length will be replaced by value length
*
*
* @return string
*/
public static function get_preview_template() {
return 'Send tags: $$value';
}
public static function get_id() {
return 'tag_input';
}
public static function get_type() {
return 'tags';
}
public static function get_validators() {
return array( 'required' );
}
public static function allow_dynamic_data() {
return true;
}
/**
* An array of extra options to be passed to the field which can affect the display of the field
*
* @return array
*/
public static function get_extra_options() {
return [
'message' => 'Type a tag and press Enter. Use a comma to add multiple tags',
];
}
}

View File

@@ -0,0 +1,90 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
use Thrive_Dash_List_Manager;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Tag_Select_Field
*/
class Tag_Select_Field extends Action_Field {
/**
* Field name
*/
public static function get_name() {
return 'Add the following tags to the user';
}
/**
* Field description
*/
public static function get_description() {
return 'Which tag(s) would you like to apply? Use a comma to add multiple tags. Example:- tag1, tag2';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return 'Choose tag';
}
/**
* $$value will be replaced by field value
* $$length will be replaced by value length
*
*
* @return string
*/
public static function get_preview_template() {
return '';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback( $action_id, $action_data ) {
$values = array();
if ( ! empty( $action_data ) ) {
if ( is_string( $action_data ) ) {
$api = $action_data;
} else if ( property_exists( $action_data, 'autoresponder' ) ) {
$api = $action_data->autoresponder->value;
}
}
if ( ! empty( $api ) ) {
$api_instance = Thrive_Dash_List_Manager::connection_instance( $api );
if ( $api_instance && $api_instance->is_connected() ) {
$tags = $api_instance->getTags();
foreach ( $tags as $key => $tag ) {
$values[ $key ] = [ 'name' => $tag, 'id' => $key ];
}
}
}
return $values;
}
public static function get_id() {
return 'tag_select';
}
public static function get_type() {
return 'select';
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
use function wc_get_order_statuses;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Status_Field
*/
class Woo_Order_Status_Field extends Action_Field {
/**
* Field name
*/
public static function get_name() {
return 'Change order to the following status';
}
/**
* Field description
*/
public static function get_description() {
return static::get_placeholder();
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return __( 'Select a status to set on the order', 'thrive-dash' );
}
/**
* $$value will be replaced by field value
* $$length will be replaced by value length
*
*
* @return string
*/
public static function get_preview_template() {
return 'Status: $$value';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback( $action_id, $action_data ) {
$statuses = array();
foreach ( wc_get_order_statuses() as $key => $status ) {
$statuses[ $key ] = array(
'label' => $status,
'id' => $key,
);
}
return $statuses;
}
public static function get_id() {
return 'woo_order_status';
}
public static function get_type() {
return 'select';
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Products_Field
*/
class Woo_Products_Field extends Action_Field {
/**
* Field name
*/
public static function get_name() {
return 'Which product should be added to the order?';
}
/**
* Field description
*/
public static function get_description() {
return static::get_placeholder();
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return __( 'Select products to add them to the order', 'thrive-dash' );
}
/**
* $$value will be replaced by field value
* $$length will be replaced by value length
*
*
* @return string
*/
public static function get_preview_template() {
return 'Product: $$value';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback( $action_id, $action_data ) {
$products = array();
foreach ( Woo::get_products() as $product ) {
$id = $product->get_id();
$products[ $id ] = array(
'label' => $product->get_name(),
'id' => $id,
);
}
return $products;
}
public static function get_id() {
return 'woo_products';
}
public static function get_type() {
return 'autocomplete';
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
}

View File

@@ -0,0 +1,254 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action;
use Thrive_Dash_List_Manager;
use function Thrive\Automator\tap_logger;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Tag_User
*/
class Add_User extends Action {
private $autoresponder;
private $additional = array();
/**
* Get the action identifier
*
* @return string
*/
public static function get_id() {
return 'thrive/adduser';
}
/**
* Get the action name/label
*
* @return string
*/
public static function get_name() {
return 'Add user in autoresponder';
}
/**
* Get the action description
*
* @return string
*/
public static function get_description() {
return 'Add user to autoresponder';
}
/**
* Get the action logo
*
* @return string
*/
public static function get_image() {
return 'tap-add-user';
}
public static function get_app_id() {
return 'email';
}
public static function get_required_data_objects() {
return array( 'user_data', 'form_data', 'email_data' );
}
/**
* Array of action-field keys, required for the action to be setup
*
* @return array
*/
public static function get_required_action_fields() {
return array( 'autoresponder' => array( 'mailing_list' ) );
}
public function prepare_data( $data = array() ) {
if ( ! empty( $data['extra_data'] ) ) {
$data = $data['extra_data'];
}
$this->autoresponder = $data['autoresponder']['value'];
$this->build_subfield( $data['autoresponder']['subfield'] );
}
/**
* Init all subfields
*
* @param $data
*/
public function build_subfield( $data ) {
foreach ( $data as $key => $subfield ) {
if ( ! empty( $subfield['value'] ) ) {
$this->additional[ $key ] = $subfield['value'];
}
if ( ! empty( $subfield['subfield'] ) ) {
$this->build_subfield( $subfield['subfield'] );
}
}
}
public function do_action( $data ) {
$email = '';
global $automation_data;
$data_sets = Main::get_email_data_sets();
/**
* Try to get email for available data objects
*/
while ( ! empty( $data_sets ) && empty( $email ) ) {
$set = array_shift( $data_sets );
$data_object = $automation_data->get( $set );
if ( ! empty( $data_object ) && $data_object->can_provide_email() ) {
$email = $data_object->get_provided_email();
}
}
if ( empty( $email ) ) {
return false;
}
$api_load = array( 'email' => $email );
$apis = Thrive_Dash_List_Manager::get_available_apis( true );
if ( empty( $apis[ $this->autoresponder ] ) ) {
return false;
}
$api = $apis[ $this->autoresponder ];
if ( ! empty( $this->additional['tag_input'] ) && $api->has_tags() ) {
$tags = $this->additional['tag_input'];
if ( is_array( $tags ) ) {
$tags = implode( ', ', $tags );
}
$api_load[ $api->get_tags_key() ] = $tags;
}
if ( ! empty( $this->additional['tag_select'] ) && $api->has_tags() ) {
$tags = $this->additional['tag_select'];
$api_load[ $api->get_tags_key() ] = $tags;
}
if ( ! empty( $this->additional['optin'] ) && $api->has_optin() ) {
$api_load[ $api->get_optin_key() ] = $this->additional['optin'];
}
if ( ! empty( $this->additional['form_list'] ) && $api->has_forms() ) {
$api_load[ $api->get_forms_key() ] = $this->additional['form_list'];
}
$list_identifier = ! empty( $this->additional['mailing_list'] ) ? $this->additional['mailing_list'] : null;
if ( ! empty( $this->additional['api_fields'] ) ) {
$name = $this->get_specific_field_value( 'name' );
if ( ! empty( $name ) ) {
$api_load['name'] = $name;
}
$phone = $this->get_specific_field_value( 'phone' );
if ( ! empty( $phone ) ) {
$api_load['phone'] = $phone;
}
}
if ( ! empty( $this->additional['api_fields'] ) && $api->has_custom_fields() ) {
$api_load['automator_custom_fields'] = $api->build_automation_custom_fields( $this->additional );
}
return $api->add_subscriber( $list_identifier, $api_load );
}
public function get_specific_field_value( $field, $unset = true ) {
$key = array_search( $field, array_column( $this->additional['api_fields'], 'key' ) );
$value = false;
if ( $key !== false ) {
$value = $this->additional['api_fields'][ $key ]['value'];
if ( $unset ) {
array_splice( $this->additional['api_fields'], $key, 1 );
}
}
return $value;
}
/**
* For APIs with forms add it as required field
*
* @param $data
*
* @return array|string[][]|string[][][]
*/
public static function get_action_mapped_fields( $data ) {
$fields = static::get_required_action_fields();
if ( property_exists( $data, 'autoresponder' ) ) {
$api_instance = \Thrive_Dash_List_Manager::connection_instance( $data->autoresponder->value );
if ( $api_instance !== null && $api_instance->is_connected() ) {
$fields = $api_instance->get_automator_add_autoresponder_mapping_fields();
}
}
return $fields;
}
public static function get_subfields( $subfields, $current_value, $action_data ) {
$fields = parent::get_subfields( $subfields, $current_value, $action_data );
/**
* Remove required validation for tags
*/
if ( isset( $fields[ Tag_Input_Field::get_id() ] ) ) {
$fields[ Tag_Input_Field::get_id() ]['validators'] = array();
}
return $fields;
}
/**
* Match all trigger that provice user/form data
*
* @param $trigger
*
* @return bool
*/
public static function is_compatible_with_trigger( $provided_data_objects ) {
$action_data_keys = static::get_required_data_objects() ?: array();
return count( array_intersect( $action_data_keys, $provided_data_objects ) ) > 0;
}
public function can_run( $data ) {
$valid = true;
$available_data = array();
global $automation_data;
foreach ( Main::get_email_data_sets() as $key ) {
$data_set = $automation_data->get( $key );
if ( ! empty( $data_set ) && $data_set->can_provide_email() && ! empty( $data_set->get_provided_email() ) ) {
$available_data[] = $key;
}
}
if ( empty( $available_data ) ) {
$valid = false;
tap_logger( $this->aut_id )->register( [
'key' => static::get_id(),
'id' => 'data-not-provided-to-action',
'message' => 'Data object required by ' . static::class . ' action is not provided by trigger',
'class-label' => tap_logger( $this->aut_id )->get_nice_class_name( static::class ),
] );
}
return $valid;
}
}

View File

@@ -0,0 +1,99 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Facebook_Event extends Action {
protected $event;
protected $standard_fields;
protected $custom_fields;
public static function get_id() {
return 'fb/standard_event';
}
public static function get_name() {
return __( 'Fire Facebook standard event', 'thrive-dash' );
}
public static function get_app_id() {
return Facebook_App::get_id();
}
public static function get_description() {
return __( 'Send a standard event to Facebook', 'thrive-dash' );
}
public static function get_image() {
return 'tap-facebook-logo';
}
public function prepare_data( $data = array() ) {
$this->event = $data[ Facebook_Event_Field::get_id() ]['value'];
$this->standard_fields = Main::extract_mapping( $data[ Facebook_Standard_Options_Field::get_id() ]['value'] );
$this->custom_fields = Main::extract_mapping( $data[ Facebook_Custom_Options_Field::get_id() ]['value'] );
}
public static function get_required_action_fields() {
return [
Facebook_Event_Field::get_id(),
Facebook_Standard_Options_Field::get_id(),
Facebook_Custom_Options_Field::get_id(),
];
}
public static function get_required_data_objects() {
return [];
}
public function do_action( $data ) {
/**
* @var \Thrive_Dash_Api_FacebookPixel $api_instance
*/
$api_instance = Facebook::get_api();
if ( $api_instance ) {
$user_fields = Facebook::extract_user_fields( $this->standard_fields );
$event_options = Facebook::extract_event_fields( $this->standard_fields );
$event_fields = [
'event_name' => $this->event,
];
if ( ! empty( $event_options ) ) {
$event_fields = array_merge( $event_fields, $event_options );
}
$event_fields['user_data'] = $api_instance->prepare_user_data( $user_fields );
$custom_data_details = array_diff( $this->standard_fields, $user_fields, $event_options );
$this->custom_fields = array_filter( $this->custom_fields );
if ( ! empty( $this->custom_fields ) ) {
$custom_data_details['custom_properties'] = $this->custom_fields;
}
if ( ! empty( $custom_data_details ) ) {
$event_fields['custom_data'] = $api_instance->prepare_custom_data( $custom_data_details );
}
$event = $api_instance->prepare_event_data( $event_fields );
$response = $api_instance->send_events( $event );
if ( $response['success'] !== true ) {
Facebook::log_error_request( $this->get_automation_id(), $response );
}
}
}
}

View File

@@ -0,0 +1,84 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Facebook_Event_Custom extends Action {
protected $event_name;
protected $custom_fields;
public static function get_id() {
return 'fb/custom_event';
}
public static function get_app_id() {
return Facebook_App::get_id();
}
public static function get_name() {
return __( 'Fire Facebook custom event', 'thrive-dash' );
}
public static function get_description() {
return __( 'Send a custom event to Facebook', 'thrive-dash' );
}
public static function get_image() {
return 'tap-facebook-logo';
}
public static function get_required_action_fields() {
return [
Facebook_Event_Name_Field::get_id(),
Facebook_Custom_Options_Field::get_id(),
];
}
public function prepare_data( $data = array() ) {
$this->event_name = $data[ Facebook_Event_Name_Field::get_id() ]['value'];
$this->custom_fields = Main::extract_mapping( $data[ Facebook_Custom_Options_Field::get_id() ]['value'] );
}
public static function get_required_data_objects() {
return [];
}
public function do_action( $data ) {
/**
* @var \Thrive_Dash_Api_FacebookPixel $api_instance
*/
$api_instance = Facebook::get_api();
if ( $api_instance ) {
$event_fields = [
'event_name' => $this->event_name,
];
$user_data = $api_instance->prepare_user_data();
$event_fields['user_data'] = $user_data;
$custom_properties = [];
if ( ! empty( $this->custom_fields ) ) {
$custom_properties['custom_properties'] = $this->custom_fields;
}
$event_fields['custom_data'] = $api_instance->prepare_custom_data( $custom_properties );
$event = $api_instance->prepare_event_data( $event_fields );
$response = $api_instance->send_events( $event );
if ( $response['success'] !== true ) {
Facebook::log_error_request( $this->get_automation_id(), $response );
}
}
}
}

View File

@@ -0,0 +1,118 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action;
use Thrive\Automator\Items\Action_Field;
use Thrive\Automator\Items\Connection_Test;
use Thrive\Automator\Items\Fields_Webhook;
use Thrive\Automator\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Slack_Send_Notification
*/
class Slack_Send_Notification extends Action {
protected $data;
/**
* Get the action identifier
*
* @return string
*/
public static function get_id() {
return 'slack/sendnotification';
}
/**
* Get the action name/label
*
* @return string
*/
public static function get_name() {
return __( 'Send notification', 'thrive-dash' );
}
/**
* Get the action description
*
* @return string
*/
public static function get_description() {
return __( 'Send a notification to a Slack channel', 'thrive-dash' );
}
/**
* Get the action logo
*
* @return string
*/
public static function get_image() {
return 'tap-slack-logo';
}
/**
* Get the name of app to which action belongs
*
* @return string
*/
public static function get_app_id() {
return Slack_App::get_id();
}
/**
* Array of action-field keys, required for the action to be setup
*
* @return array
*/
public static function get_required_action_fields() {
return [
Slack_Channel_Field::get_id(),
Slack_Message_Title_Field::get_id(),
Fields_Webhook::get_id(),
Slack_Test_Notification_Field::get_id(),
];
}
/**
* Get an array of keys with the required data-objects
*
* @return array
*/
public static function get_required_data_objects() {
return [];
}
public function do_action( $data = [] ) {
$channel = $this->get_automation_data_value( Slack_Channel_Field::get_id() );
$api_instance = \Thrive_Dash_List_Manager::connection_instance( 'slack' );
$response = false;
if ( $api_instance && $api_instance->is_connected() ) {
$args = array(
'fields' => $this->get_automation_data_value( 'fields_webhook', [] ),
'text' => $this->get_automation_data_value( Slack_Message_Title_Field::get_id() ),
);
$response = $api_instance->post_message( $channel, $args );
}
if ( empty( $response->ok ) ) {
$result = [
'status_code' => 400,
'message' => __( 'Request failed with error message', 'thrive-dash' ) . ': ' . $response->error
];
} else {
$result = [ 'status_code' => 200 ];
}
return $result;
}
public function prepare_data( $data = array() ) {
$this->data = $data;
}
}

View File

@@ -0,0 +1,193 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action;
use Thrive_Dash_List_Manager;
use function Thrive\Automator\tap_logger;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Tag_User
*/
class Tag_User extends Action {
private $autoresponder;
private $tags;
private $additional = array();
/**
* Get the action identifier
*
* @return string
*/
public static function get_id() {
return 'thrive/taguser';
}
/**
* Get the action name/label
*
* @return string
*/
public static function get_name() {
return 'Tag user in autoresponder';
}
/**
* Get the action description
*
* @return string
*/
public static function get_description() {
return 'Apply {num_items} tags to user in autoresponder';
}
/**
* Get the action logo
*
* @return string
*/
public static function get_image() {
return 'tap-tag-user';
}
public static function get_app_id() {
return 'email';
}
public static function get_required_data_objects() {
return array( 'user_data', 'form_data', 'email_data' );
}
/**
* Array of action-field keys, required for the action to be setup
*
* @return array
*/
public static function get_required_action_fields() {
return array( 'autoresponder' => 'tag_input' );
}
/**
* For APIs with forms add it as required field
*
* @param $data
*
* @return array|string[][]|string[][][]
*/
public static function get_action_mapped_fields( $data ) {
$fields = static::get_required_action_fields();
if ( property_exists( $data, 'autoresponder' ) ) {
$api_instance = \Thrive_Dash_List_Manager::connection_instance( $data->autoresponder->value );
if ( $api_instance !== null && $api_instance->is_connected() ) {
$fields = $api_instance->get_automator_tag_autoresponder_mapping_fields();
}
}
return $fields;
}
public function prepare_data( $data = array() ) {
if ( ! empty( $data['extra_data'] ) ) {
$data = $data['extra_data'];
}
foreach ( $data['autoresponder']['subfield'] as $key => $subfield ) {
$this->additional[ $key ] = $subfield['value'];
}
$this->autoresponder = $data['autoresponder']['value'];
if ( ! empty( $data['tag_input']['value'] ) ) {
$this->tags = $data['tag_input']['value'];
}//tags were moved as subfields of autoresponder
elseif ( ! empty( $this->additional['tag_input'] ) ) {
$this->tags = $this->additional['tag_input'];
} elseif ( ! empty( $this->additional['tag_select'] ) ) {
$this->tags = $this->additional['tag_select'];
}
}
public function do_action( $data ) {
$email = '';
$data_sets = Main::get_email_data_sets();
global $automation_data;
while ( ! empty( $data_sets ) && empty( $email ) ) {
$set = array_shift( $data_sets );
$data_object = $automation_data->get( $set );
if ( ! empty( $data_object ) && $data_object->can_provide_email() ) {
$email = $data_object->get_provided_email();
}
}
if ( empty( $email ) ) {
return false;
}
$apis = Thrive_Dash_List_Manager::get_available_apis( true );
$api = $apis[ $this->autoresponder ];
if ( empty( $api ) ) {
return false;
}
$extra = [];
$tags_value = $this->tags;
if ( is_array( $tags_value ) ) {
$tags_value = implode( ', ', $tags_value );
}
if ( ! empty( $this->additional['mailing_list'] ) ) {
$extra['list_identifier'] = $this->additional['mailing_list'];
}
$api->update_tags( $email, $tags_value, $extra );
}
/**
* Match all trigger that provice user/form data
*
* @param $trigger
*
* @return bool
*/
public static function is_compatible_with_trigger( $provided_data_objects ) {
$action_data_keys = static::get_required_data_objects() ?: array();
return count( array_intersect( $action_data_keys, $provided_data_objects ) ) > 0;
}
public function can_run( $data ) {
$valid = true;
$available_data = array();
global $automation_data;
foreach ( Main::get_email_data_sets() as $key ) {
if ( ! empty( $automation_data->get( $key ) ) ) {
$available_data[] = $key;
}
}
if ( empty( $available_data ) ) {
$valid = false;
tap_logger( $this->aut_id )->register( [
'key' => static::get_id(),
'id' => 'data-not-provided-to-action',
'message' => 'Data object required by ' . static::class . ' action is not provided by trigger',
'class-label' => tap_logger( $this->aut_id )->get_nice_class_name( static::class ),
] );
}
return $valid;
}
}

View File

@@ -0,0 +1,111 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action;
use function wc_get_order;
use function wc_get_product;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Add_Product_To_Order
*/
class Woo_Add_Product_To_Order extends Action {
private $products;
/**
* Get the action identifier
*
* @return string
*/
public static function get_id() {
return 'woo/producttoorder';
}
/**
* Get the action name/label
*
* @return string
*/
public static function get_name() {
return 'Add WooCommerce product to order';
}
/**
* Get the action description
*
* @return string
*/
public static function get_description() {
return 'Add a WooCommerce product to an existing order';
}
/**
* Get the action logo
*
* @return string
*/
public static function get_image() {
return 'woo-add-product-to-order';
}
/**
* Get the name of app to which action belongs
*
* @return string
*/
public static function get_app_id() {
return Woo_App::get_id();
}
/**
* Array of action-field keys, required for the action to be setup
*
* @return array
*/
public static function get_required_action_fields() {
return array( 'woo_products' );
}
/**
* Get an array of keys with the required data-objects
*
* @return array
*/
public static function get_required_data_objects() {
return array( 'woo_order_data' );
}
public function prepare_data( $data = array() ) {
if ( ! empty( $data['extra_data'] ) ) {
$data = $data['extra_data'];
}
$this->products = $data['woo_products']['value'];
}
public function do_action( $data ) {
global $automation_data;
$order_data = $automation_data->get( 'woo_order_data' );
if ( empty( $order_data ) ) {
return false;
}
$order = wc_get_order( $order_data->get_value( Woo_Order_Id::get_id() ) );
if ( empty( $order ) ) {
return false;
}
foreach ( $this->products as $product_id ) {
$product = wc_get_product( $product_id );
if ( $product ) {
$order->add_product( $product );
}
}
}
}

View File

@@ -0,0 +1,105 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action;
use function wc_get_order;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Status_Update
*/
class Woo_Order_Status_Update extends Action {
private $status;
/**
* Get the action identifier
*
* @return string
*/
public static function get_id() {
return 'woo/orderstatus';
}
/**
* Get the action name/label
*
* @return string
*/
public static function get_name() {
return 'Update WooCommerce order status';
}
/**
* Get the action description
*
* @return string
*/
public static function get_description() {
return 'Change the status of a WooCommerce order';
}
/**
* Get the action logo
*
* @return string
*/
public static function get_image() {
return 'woo-update-order-status';
}
/**
* Get the name of app to which action belongs
*
* @return string
*/
public static function get_app_id() {
return Woo_App::get_id();
}
/**
* Array of action-field keys, required for the action to be setup
*
* @return array
*/
public static function get_required_action_fields() {
return array( 'woo_order_status' );
}
/**
* Get an array of keys with the required data-objects
*
* @return array
*/
public static function get_required_data_objects() {
return array( 'woo_order_data' );
}
public function prepare_data( $data = array() ) {
if ( ! empty( $data['extra_data'] ) ) {
$data = $data['extra_data'];
}
$this->status = $data['woo_order_status']['value'];
}
public function do_action( $data ) {
global $automation_data;
$order_data = $automation_data->get( 'woo_order_data' );
if ( empty( $order_data ) ) {
return false;
}
$order = wc_get_order( $order_data->get_value( Woo_Order_Id::get_id() ) );
if ( empty( $order ) ) {
return false;
}
$order->update_status( $this->status, '', true );
}
}

View File

@@ -0,0 +1,94 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Action;
use function wc_create_refund;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Refund_Order
*/
class Woo_Refund_Order extends Action {
/**
* Get the action identifier
*
* @return string
*/
public static function get_id() {
return 'woo/refundorder';
}
/**
* Get the action name/label
*
* @return string
*/
public static function get_name() {
return 'Refund WooCommerce order';
}
/**
* Get the action description
*
* @return string
*/
public static function get_description() {
return 'Refund the WooCommerce order';
}
/**
* Get the action logo
*
* @return string
*/
public static function get_image() {
return 'woo-refund-order';
}
/**
* Get the name of app to which action belongs
*
* @return string
*/
public static function get_app_id() {
return Woo_App::get_id();
}
/**
* Array of action-field keys, required for the action to be setup
*
* @return array
*/
public static function get_required_action_fields() {
return array();
}
/**
* Get an array of keys with the required data-objects
*
* @return array
*/
public static function get_required_data_objects() {
return array( 'woo_order_data' );
}
public function do_action( $data ) {
global $automation_data;
$order_data = $automation_data->get( 'woo_order_data' );
if ( empty( $order_data ) ) {
return false;
}
$order = wc_get_order( $order_data->get_value( Woo_Order_Id::get_id() ) );
if ( empty( $order ) ) {
return false;
}
wc_create_refund( array( 'order_id' => $order_data->get_value( Woo_Order_Id::get_id() ) ) );
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-automator
*/
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\App;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Elementor_App extends App {
public static function get_id() {
return 'elementor';
}
public static function get_name() {
return 'Elementor';
}
public static function get_description() {
return __( 'Elementor integrations', 'thrive-dash' );
}
public static function get_logo() {
return 'tap-elementor-logo';
}
public static function has_access() {
return true;
}
public static function hidden() {
return ! Elementor::exists();
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\App;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
class Facebook_App extends App {
public static function get_id() {
return 'facebook';
}
public static function get_name() {
return 'Facebook';
}
public static function get_description() {
return __( 'Facebook integrations', 'thrive-dash' );
}
public static function get_logo() {
return 'tap-facebook-logo';
}
public static function has_access() {
return Facebook::exists();
}
public static function get_acccess_url() {
return admin_url( 'admin.php?page=tve_dash_api_connect' );
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
use Thrive\Automator\Items\App;
class Slack_App extends App {
public static function get_id() {
return 'slack';
}
public static function get_name() {
return 'Slack';
}
public static function get_description() {
return 'Slack';
}
public static function get_logo() {
return 'tap-slack-logo';
}
public static function has_access() {
$slack_instance = \Thrive_Dash_List_Manager::connection_instance( 'slack' );
return $slack_instance !== null && $slack_instance->is_connected();
}
public static function get_acccess_url() {
return admin_url( 'admin.php?page=tve_dash_api_connect' );
}
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
use Thrive\Automator\Items\App;
class Woo_App extends App {
public static function get_id() {
return 'woocommerce';
}
public static function get_name() {
return 'WooCommerce';
}
public static function get_description() {
return 'WooCommerce';
}
public static function get_logo() {
return 'tap-woocommerce-logo';
}
public static function has_access() {
return class_exists( 'WooCommerce' );
}
}

View File

@@ -0,0 +1,202 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-visual-editor
*/
namespace TVE\Dashboard\Automator;
use function thrive_automator_register_action;
use function thrive_automator_register_action_field;
use function thrive_automator_register_data_field;
use function thrive_automator_register_data_object;
use function thrive_automator_register_trigger;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Main
*
* @package TVE\Dashboard\Automator
*/
class Main {
public static function init() {
if ( defined( 'THRIVE_AUTOMATOR_RUNNING' )
&& ( ( defined( 'TVE_DEBUG' ) && TVE_DEBUG )
|| ( defined( 'TAP_VERSION' ) && version_compare( TAP_VERSION, '1.0', '>=' ) ) ) ) {
static::add_hooks();
}
}
/**
* @param string $subpath
*
* @return string
*/
public static function get_integration_path( $subpath = '' ) {
return TVE_DASH_PATH . '/inc/automator/' . $subpath;
}
public static function add_hooks() {
add_filter( 'td_automator_should_load_file', [ __CLASS__, 'should_load_slack_files' ], 10, 2 );
static::load_extra_classes();
static::load_apps();
static::load_data_objects();
static::load_fields();
static::load_action_fields();
static::load_actions();
static::load_trigger_fields();
static::load_triggers();
add_action( 'tap_output_extra_svg', array( 'TVE\Dashboard\Automator\Main', 'display_icons' ) );
}
/**
* Load additional classes needed for integrations
*
* @return void
*/
public static function load_extra_classes() {
require_once TVE_DASH_PATH . '/inc/automator/class-tap-elementor.php';
Elementor::init();
require_once TVE_DASH_PATH . '/inc/automator/class-tap-woo.php';
Woo::init();
require_once TVE_DASH_PATH . '/inc/automator/class-tap-facebook.php';
Facebook::init();
}
public static function load_triggers() {
foreach ( static::load_files( 'triggers' ) as $trigger ) {
thrive_automator_register_trigger( new $trigger() );
}
}
public static function load_trigger_fields() {
foreach ( static::load_files( 'trigger-fields' ) as $trigger ) {
thrive_automator_register_trigger_field( new $trigger() );
}
}
public static function load_actions() {
foreach ( static::load_files( 'actions' ) as $action ) {
thrive_automator_register_action( new $action() );
}
}
public static function load_action_fields() {
foreach ( static::load_files( 'action-fields' ) as $field ) {
thrive_automator_register_action_field( new $field() );
}
}
public static function load_fields() {
foreach ( static::load_files( 'fields' ) as $field ) {
thrive_automator_register_data_field( new $field() );
}
}
public static function load_data_objects() {
foreach ( static::load_files( 'data-objects' ) as $data_object ) {
thrive_automator_register_data_object( new $data_object() );
}
}
public static function load_apps() {
foreach ( static::load_files( 'apps' ) as $app ) {
thrive_automator_register_app( new $app() );
}
}
public static function load_files( $type ) {
$integration_path = static::get_integration_path( $type );
$local_classes = array();
foreach ( glob( $integration_path . '/*.php' ) as $file ) {
if ( static::should_load( $file ) ) {
require_once $file;
$class = 'TVE\Dashboard\Automator\\' . static::get_class_name_from_filename( $file );
if ( class_exists( $class ) && ! $class::hidden() ) {
$local_classes[] = $class;
}
}
}
return $local_classes;
}
public static function get_class_name_from_filename( $filename ) {
$name = str_replace( array( 'class-', '-action', '-trigger' ), '', basename( $filename, '.php' ) );
return str_replace( '-', '_', ucwords( $name, '-' ) );
}
public static function display_icons() {
include static::get_integration_path( 'icons.svg' );
}
public static function should_load( $filename ) {
return apply_filters( 'td_automator_should_load_file', true, $filename );
}
/**
* Filter the data objects that might provide user data
*/
public static function get_email_data_sets() {
$data_sets = apply_filters( 'tvd_automator_api_data_sets', [] );
/**
* Make sure that user_data is always the last item
*/
$data_sets = array_diff( $data_sets, [ 'email_data', 'user_data' ] );
$data_sets[] = 'email_data';
$data_sets[] = 'user_data';
return $data_sets;
}
public static function should_load_slack_files( $load, $filename ) {
if ( strpos( basename( $filename, '.php' ), '-slack-' ) !== false && ! static::slack_exists() ) {
$load = false;
}
return $load;
}
/**
* ['key','value'] => ['key' => 'value']
*
*
* @param $data
*
* @return array
*/
public static function extract_mapping( $data ) {
$mapping = [];
foreach ( $data as $content ) {
$mapping[ $content['key'] ] = $content['value'];
}
return $mapping;
}
public static function slack_exists() {
$slack_instance = \Thrive_Dash_List_Manager::connection_instance( 'slack' );
return $slack_instance !== null && $slack_instance->is_connected();
}
}
add_action( 'thrive_automator_init', array( 'TVE\Dashboard\Automator\Main', 'init' ) );

View File

@@ -0,0 +1,79 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-automator
*/
namespace TVE\Dashboard\Automator;
use WP_Query;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Elementor
*/
class Elementor {
const FORM_SUBMIT_HOOK = 'elementor_pro/forms/process';
public static function init() {
if ( static::exists() ) {
static::hooks();
}
}
public static function hooks() {
add_action( static::FORM_SUBMIT_HOOK, static function ( $form_record ) {
if ( ! empty( $_POST['form_id'] ) ) {
do_action( static::create_dynamic_trigger( static::FORM_SUBMIT_HOOK, strtolower( trim( preg_replace( '/[^A-Za-z0-9-]+/', '-', $_POST['form_id'] ) ) ) ), [ $form_record ] );
}
} );
add_filter( 'td_automator_should_load_file', [ __CLASS__, 'should_load_elementor_files' ], 10, 2 );
add_filter( 'tvd_automator_api_data_sets', [ __CLASS__, 'add_api_data_sets' ], 10, 2 );
}
public static function add_api_data_sets( $sets ) {
$data_sets[] = Elementor_Form_Data::get_id();
return $sets;
}
public static function exists() {
return class_exists( 'ElementorPro\Plugin', false );
}
public static function get_elementor_posts() {
$args = array(
'post_type' => [ 'page', 'elementor_library', 'post' ],
'meta_query' => array(
array(
'key' => '_elementor_data',
'value' => 'form',
'compare' => 'LIKE',
),
),
);
header( 'Content-type: text/html' );
return ( new WP_Query( $args ) )->get_posts();
}
public static function should_load_elementor_files( $load, $filename ) {
if ( strpos( basename( $filename, '.php' ), '-elementor-' ) !== false && ! static::exists() ) {
$load = false;
}
return $load;
}
public static function create_dynamic_trigger( $prefix, $id ) {
return $prefix . '_' . $id;
}
}

View File

@@ -0,0 +1,303 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
use function Thrive\Automator\tap_logger;
class Facebook {
const ADD_TO_CART = 'AddToCart';
const ADD_TO_WISHLIST = 'AddToWishlist';
const ADD_PAYMENT_INFO = 'AddPaymentInfo';
const CONTACT = 'Contact';
const COMPLETE_REGISTRATION = 'CompleteRegistration';
const CUSTOMIZE_PRODUCT = 'CustomizeProduct';
const DONATE = 'Donate';
const FIND_LOCATION = 'FindLocation';
const INITIATE_CHECKOUT = 'InitiateCheckout';
const LEAD = 'Lead';
const PURCHASE = 'Purchase';
const SEARCH = 'Search';
const SUBSCRIBE = 'Subscribe';
const START_TRIAL = 'StartTrial';
const SUBMIT_APPLICATION = 'SubmitApplication';
const SUBMIT_CONTACT = 'SubmitContact';
const SCHEDULE = 'Schedule';
const VIEW_CONTENT = 'ViewContent';
const CONTENT_CATEGORY = 'content_category';
const CONTENT_IDS = 'content_ids';
const CONTENT_NAME = 'content_name';
const CONTENT_TYPE = 'content_type';
const CONTENTS = 'contents';
const CURRENCY = 'currency';
const VALUE = 'value';
const STATUS = 'status';
const NUM_ITEMS = 'num_items';
const SEARCH_STRING = 'search_string';
const PREDICTED_LTV = 'predicted_ltv';
const ORDER_ID = 'order_id';
const DELIVERY_CATEGORY = 'delivery_category';
const USER_CITY = 'city';
const USER_COUNTRY = 'country';
const USER_GENDER = 'gender';
const USER_EMAIL = 'email';
const USER_PHONE = 'phone';
const USER_ZIP = 'zip_code';
const USER_DOB = 'date_of_birth';
const USER_FN = 'first_name';
const USER_LN = 'last_name';
const USER_LEAD_ID = 'lead_id';
const USER_FB_LOGIN_ID = 'fb_login_id';
const USER_SUBSCRIPTION_ID = 'subscription_id';
const USER_EXTERNAL_ID = 'external_id';
const USER_STATE = 'state';
const EVENT_ID = 'event_id';
const EVENT_SOURCE_URL = 'event_source_url';
public static function init() {
static::hooks();
}
public static function hooks() {
add_filter( 'td_automator_should_load_file', [ __CLASS__, 'should_load_files' ], 10, 2 );
}
public static function should_load_files( $load, $filename ) {
if ( strpos( basename( $filename, '.php' ), '-facebook-' ) !== false && ! static::exists() ) {
$load = false;
}
return $load;
}
public static function exists() {
return static::get_connection() !== null;
}
/**
* @return \Thrive_Dash_List_Connection_Abstract|null
*/
public static function get_connection() {
$facebook_instance = \Thrive_Dash_List_Manager::connection_instance( 'facebookpixel' );
return $facebook_instance !== null && $facebook_instance->is_connected() ? $facebook_instance : null;
}
/**
*
* @return \Thrive_Dash_Api_FacebookPixel|null
*/
public static function get_api() {
$facebook_instance = static::get_connection();
return $facebook_instance ? $facebook_instance->get_api() : null;
}
public static function map_data( $data ) {
return [
'id' => $data,
'label' => $data,
];
}
public static function get_event_types() {
return array_map( [ __CLASS__, 'map_data' ], [
static::ADD_TO_CART,
static::ADD_TO_WISHLIST,
static::ADD_PAYMENT_INFO,
static::CONTACT,
static::COMPLETE_REGISTRATION,
static::CUSTOMIZE_PRODUCT,
static::DONATE,
static::FIND_LOCATION,
static::INITIATE_CHECKOUT,
static::LEAD,
static::PURCHASE,
static::SEARCH,
static::SUBSCRIBE,
static::START_TRIAL,
static::SUBMIT_APPLICATION,
static::SUBMIT_CONTACT,
static::SCHEDULE,
static::VIEW_CONTENT,
] );
}
public static function get_event_keys() {
return [ static::EVENT_ID, static::EVENT_SOURCE_URL ];
}
public static function get_standard_keys() {
return [
static::CONTENT_CATEGORY,
static::CONTENT_IDS,
static::CONTENT_NAME,
static::CONTENT_TYPE,
static::CONTENTS,
static::CURRENCY,
static::VALUE,
static::STATUS,
static::NUM_ITEMS,
static::SEARCH_STRING,
static::PREDICTED_LTV,
static::ORDER_ID,
static::DELIVERY_CATEGORY,
];
}
public static function get_standard_options() {
return array_map( [ __CLASS__, 'map_data' ], static::get_standard_keys() );
}
public static function get_event_options() {
return array_map( [ __CLASS__, 'map_data' ], static::get_event_keys() );
}
public static function extract_event_fields( $args ) {
$allowed_keys = static::get_event_keys();
return array_filter(
$args,
static function ( $key ) use ( $allowed_keys ) {
return in_array( $key, $allowed_keys, true );
},
ARRAY_FILTER_USE_KEY
);
}
public static function get_user_options() {
return [
[
'id' => static::USER_CITY,
'label' => __( 'City', 'thrive-dash' ),
],
[
'id' => static::USER_COUNTRY,
'label' => __( 'Country', 'thrive-dash' ),
],
[
'id' => static::USER_GENDER,
'label' => __( 'Gender', 'thrive-dash' ),
],
[
'id' => static::USER_EMAIL,
'label' => __( 'Email', 'thrive-dash' ),
],
[
'id' => static::USER_PHONE,
'label' => __( 'Phone', 'thrive-dash' ),
],
[
'id' => static::USER_ZIP,
'label' => __( 'Zip', 'thrive-dash' ),
],
[
'id' => static::USER_DOB,
'label' => __( 'Date of Birth', 'thrive-dash' ),
],
[
'id' => static::USER_FN,
'label' => __( 'First Name', 'thrive-dash' ),
],
[
'id' => static::USER_LN,
'label' => __( 'Last Name', 'thrive-dash' ),
],
[
'id' => static::USER_LEAD_ID,
'label' => __( 'Lead ID', 'thrive-dash' ),
],
[
'id' => static::USER_FB_LOGIN_ID,
'label' => __( 'Facebook Login ID', 'thrive-dash' ),
],
[
'id' => static::USER_SUBSCRIPTION_ID,
'label' => __( 'Subscription ID', 'thrive-dash' ),
],
[
'id' => static::USER_EXTERNAL_ID,
'label' => __( 'External ID', 'thrive-dash' ),
],
[
'id' => static::USER_STATE,
'label' => __( 'State', 'thrive-dash' ),
],
];
}
public static function get_user_keys() {
return [
static::USER_CITY,
static::USER_COUNTRY,
static::USER_EMAIL,
static::USER_PHONE,
static::USER_GENDER,
static::USER_ZIP,
static::USER_DOB,
static::USER_FN,
static::USER_LN,
static::USER_LEAD_ID,
static::USER_FB_LOGIN_ID,
static::USER_SUBSCRIPTION_ID,
static::USER_EXTERNAL_ID,
static::USER_STATE,
];
}
/**
* Get only user specific entries
*
* @param $args
*
* @return array
*/
public static function extract_user_fields( $args ) {
$allowed_keys = static::get_user_keys();
return array_filter(
$args,
static function ( $key ) use ( $allowed_keys ) {
return in_array( $key, $allowed_keys, true );
},
ARRAY_FILTER_USE_KEY
);
}
/**
* Use Automator logger so insert additional messages
*
* @param $automation_id
* @param $response
*
* @return void
*/
public static function log_error_request( $automation_id, $response ) {
tap_logger( $automation_id )->insert_log(
[
'facebook_webhook' => [
'data-webhook-fail' => [
'message' => __( 'Facebook fire event failed', 'thrive-dash' ),
'label' => __( 'Facebook event response', 'thrive-dash' ),
'is_success' => false,
],
],
],
[
'request_body' => $response['message'],
]
);
}
}

View File

@@ -0,0 +1,106 @@
<?php
/**
* Thrive Themes - https://thrivethemes.com
*
* @package thrive-dashboard
*/
namespace TVE\Dashboard\Automator;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
use function get_user_by;
use function wc_get_order;
use function wc_get_products;
class Woo {
public static function init() {
static::hooks();
}
public static function hooks() {
add_filter( 'td_automator_should_load_file', [ __CLASS__, 'should_load_files' ], 10, 2 );
if ( static::exists() ) {
add_action( 'woocommerce_order_refunded', array(
__CLASS__,
'do_woocommerce_refund_product_action',
) );
add_action( 'woocommerce_order_status_completed', array(
__CLASS__,
'do_woocommerce_product_purchase_completed',
) );
add_action( 'woocommerce_order_status_processing', array(
__CLASS__,
'do_woocommerce_product_purchase_processing',
) );
}
}
public static function should_load_files( $load, $filename ) {
if ( strpos( basename( $filename, '.php' ), '-woo-' ) !== false && ! static::exists() ) {
$load = false;
}
return $load;
}
/**
* Get all products with variations included
*
* @return array
*/
public static function get_products() {
$products = [];
foreach ( wc_get_products( array( 'limit' => - 1 ) ) as $product ) {
$products[] = $product;
if ( $product->get_type() === 'variable' ) {
foreach ( $product->get_children() as $variation_id ) {
$products[] = wc_get_product( $variation_id );
}
}
}
return $products;
}
public static function exists() {
return class_exists( 'WooCommerce', false );
}
public static function do_woocommerce_refund_product_action( $order_id ) {
$order = wc_get_order( $order_id );
$user = get_user_by( 'id', $order->get_report_customer_id() );
$billing_email = $order->get_billing_email();
foreach ( $order->get_items() as $product ) {
if ( $product->get_quantity() != 0 ) {
do_action( 'thrive_woo_product_refund', $product, $user, $billing_email );
}
}
}
public static function do_woocommerce_product_purchase_completed( $order_id ) {
$order = wc_get_order( $order_id );
$user = get_user_by( 'id', $order->get_customer_id() );
$billing_email = $order->get_billing_email();
foreach ( $order->get_items() as $product ) {
do_action( 'thrive_woo_product_purchase_completed', $product, $user, $billing_email );
}
}
public static function do_woocommerce_product_purchase_processing( $order_id ) {
$order = wc_get_order( $order_id );
$user = get_user_by( 'id', $order->get_customer_id() );
$billing_email = $order->get_billing_email();
foreach ( $order->get_items() as $product ) {
do_action( 'thrive_woo_product_purchase_processing', $product, $user, $billing_email );
}
}
}

View File

@@ -0,0 +1,103 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Object;
use Thrive\Automator\Items\Form_Email_Data_Field;
use Thrive\Automator\Items\Form_Name_Data_Field;
use Thrive\Automator\Utils;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Elementor_Form_Data
*/
class Elementor_Form_Data extends Data_Object {
/**
* Get the data-object identifier
*
* @return string
*/
public static function get_id() {
return 'elementor_form_data';
}
public static function get_nice_name() {
return __( 'Elementor form data', 'thrive-dash' );
}
/**
* Array of field object keys that are contained by this data-object
*
* @return array
*/
public static function get_fields() {
return [
Form_Email_Data_Field::get_id(),
Form_Name_Data_Field::get_id(),
];
}
public static function create_object( $param ) {
$post_data = [];
if ( is_array( $param ) ) {
$allowed_keys = [
'name',
'email',
'message',
'url',
];
/**
* Fields that can be set for WP connection
*/
$extra_mapped_keys = [ 'nickname', 'description', 'user_url', 'url' ];
$extra_keys_regex = implode( '|', $extra_mapped_keys );
foreach ( $param as $key => $value ) {
if ( in_array( $key, $allowed_keys, true ) || strpos( $key, 'field_' ) !== false || preg_match( "/^($extra_keys_regex)/", $key ) ) {
$post_data[ $key ] = $value;
}
}
} elseif ( is_email( $param ) ) {
$post_data['email'] = $param;
}
return $post_data;
}
public function replace_dynamic_data( $value ) {
$value = parent::replace_dynamic_data( $value );
$value = Utils::replace_additional_data_shortcodes( $value, $this->data );
// replace shortcodes if values are not provided by the form
if ( is_array( $value ) ) {
foreach ( $value as &$field ) {
if ( $field['value'] ) {
preg_match_all( '/%+field_[a-zA-Z0-9]{7}%/', $field['value'], $matches );
foreach ( $matches as $shortcode ) {
$field['value'] = str_replace( $shortcode, '', $field['value'] );
}
}
}
}
return $value;
}
public function can_provide_email() {
return true;
}
public function get_provided_email() {
return $this->get_value( 'email' );
}
}

View File

@@ -0,0 +1,166 @@
<?php
namespace TVE\Dashboard\Automator;
use Exception;
use Thrive\Automator\Items\Data_Object;
use function wc_get_order;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Data
*/
class Woo_Order_Data extends Data_Object {
/**
* Get the data-object identifier
*
* @return string
*/
public static function get_id() {
return 'woo_order_data';
}
public static function get_nice_name() {
return 'WooCommerce order';
}
/**
* Array of field object keys that are contained by this data-object
*
* @return array
*/
public static function get_fields() {
return array(
'woo_order_id',
'order_number',
'order_key',
'customer_id',
'billing_first_name',
'billing_last_name',
'billing_company',
'billing_address_1',
'billing_address_2',
'billing_city',
'billing_state',
'billing_postcode',
'billing_country',
'billing_email',
'billing_phone',
'shipping_first_name',
'shipping_last_name',
'shipping_company',
'shipping_address_1',
'shipping_address_2',
'shipping_city',
'shipping_state',
'shipping_postcode',
'shipping_country',
'payment_method',
'payment_method_title',
'transaction_id',
'customer_ip_address',
'customer_user_agent',
'created_via',
'customer_note',
'date_completed',
'date_paid',
'cart_hash',
'get_parent_id',
'order_currency',
'order_version',
'prices_include_tax',
'date_created',
'date_modified',
'order_status',
'discount_total',
'shipping_total',
'shipping_tax',
'cart_tax',
'grand_total',
'total_tax',
'coupon_used',
'item_count',
'has_free_item',
);
}
public static function create_object( $param ) {
if ( empty( $param ) ) {
throw new Exception( 'No parameter provided for Woo_Order_Data object' );
}
$order = null;
if ( is_a( $param, 'WC_Order' ) ) {
$order = $param;
} elseif ( is_numeric( $param ) ) {
$order = wc_get_order( $param );
}
if ( $order ) {
return array(
'woo_order_id' => $order->get_id(),
'order_number' => $order->get_order_number(),
'order_key' => $order->get_order_key(),
'customer_id' => $order->get_customer_id(),
'billing_first_name' => $order->get_billing_first_name(),
'billing_last_name' => $order->get_billing_last_name(),
'billing_company' => $order->get_billing_company(),
'billing_address_1' => $order->get_billing_address_1(),
'billing_address_2' => $order->get_billing_address_2(),
'billing_city' => $order->get_billing_city(),
'billing_state' => $order->get_billing_state(),
'billing_postcode' => $order->get_billing_postcode(),
'billing_country' => $order->get_billing_country(),
'billing_email' => $order->get_billing_email(),
'billing_phone' => $order->get_billing_phone(),
'shipping_first_name' => $order->get_shipping_first_name(),
'shipping_last_name' => $order->get_shipping_last_name(),
'shipping_company' => $order->get_shipping_company(),
'shipping_address_1' => $order->get_shipping_address_1(),
'shipping_address_2' => $order->get_shipping_address_2(),
'shipping_city' => $order->get_shipping_city(),
'shipping_state' => $order->get_shipping_state(),
'shipping_postcode' => $order->get_shipping_postcode(),
'shipping_country' => $order->get_shipping_country(),
'payment_method' => $order->get_payment_method(),
'payment_method_title' => $order->get_payment_method_title(),
'transaction_id' => $order->get_transaction_id(),
'customer_ip_address' => $order->get_customer_ip_address(),
'customer_user_agent' => $order->get_customer_user_agent(),
'created_via' => $order->get_created_via(),
'customer_note' => $order->get_customer_note(),
'date_completed' => $order->get_date_completed(),
'date_paid' => $order->get_date_paid(),
'cart_hash' => $order->get_cart_hash(),
'parent_id' => $order->get_parent_id(),
'order_currency' => $order->get_currency(),
'order_version' => $order->get_version(),
'prices_include_tax' => $order->get_prices_include_tax(),
'date_created' => $order->get_date_created(),
'date_modified' => $order->get_date_modified(),
'order_status' => $order->get_status(),
'discount_total' => $order->get_discount_total(),
'shipping_total' => $order->get_shipping_total(),
'shipping_tax' => $order->get_shipping_tax(),
'cart_tax' => $order->get_cart_tax(),
'grand_total' => $order->get_total(),
'total_tax' => $order->get_total_tax(),
'coupon_used' => $order->get_coupon_codes(),
'item_count' => $order->get_item_count(),
'has_free_item' => $order->has_free_item(),
);
}
return $order;
}
}

View File

@@ -0,0 +1,167 @@
<?php
namespace TVE\Dashboard\Automator;
use Exception;
use Thrive\Automator\Items\Data_Object;
use function wc_get_product;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Data
*/
class Woo_Product_Data extends Data_Object {
/**
* Get the data-object identifier
*
* @return string
*/
public static function get_id() {
return 'woo_product_data';
}
public static function get_nice_name() {
return 'WooCommerce product';
}
/**
* Array of field object keys that are contained by this data-object
*
* @return array
*/
public static function get_fields() {
return array(
'woo_product_id',
'product_type',
'woo_product_name',
'product_slug',
'product_created_date',
'product_modified_date',
'product_status',
'product_featured',
'product_catalog_visibility',
'product_description',
'product_short_description',
'product_sku',
'product_active_price',
'product_regular_price',
'product_sale_price',
'product_date_on_sale_from',
'product_date_on_sale_to',
'product_total_number_sales',
'product_tax_status',
'product_tax_class',
'product_manage_stock',
'product_sale_quantity',
'product_stock_status',
'product_backorders',
'product_low_stock_amount',
'product_sold_individually',
'product_weight',
'product_length',
'product_width',
'product_height',
'product_upsell_ids',
'product_cross_sell_ids',
'product_parent_id',
'product_reviews_allowed',
'product_purchase_note',
'product_attributes',
'product_default_attributes',
'product_category_ids',
'product_tag_ids',
'product_get_virtual',
'product_gallery_ids',
'product_shipping_class_id',
'product_rating_count',
'product_average_rating',
'product_review_count',
);
}
public static function create_object( $param ) {
if ( empty( $param ) ) {
throw new Exception( 'No parameter provided for Woo_Product_Data object' );
}
$product = null;
if ( is_a( $param, 'WC_Order_Item_Product' ) ) {
$product = $param->get_product();
} elseif ( is_a( $param, 'WC_Product' ) ) {
$product = $param;
} elseif ( is_numeric( $param ) ) {
$product = wc_get_product( $param );
}
if ( $product ) {
return array(
'woo_product_id' => $product->get_id(),
'product_type' => $product->get_type(),
'woo_product_name' => $product->get_name(),
'product_slug' => $product->get_slug(),
'product_created_date' => $product->get_date_created(),
'product_modified_date' => $product->get_date_modified(),
'product_status' => $product->get_status(),
'product_featured' => $product->get_featured(),
'product_catalog_visibility' => $product->get_catalog_visibility(),
'product_description' => $product->get_description(),
'product_short_description' => $product->get_short_description(),
'product_sku' => $product->get_sku(),
'product_active_price' => $product->get_price(),
'product_regular_price' => $product->get_regular_price(),
'product_sale_price' => $product->get_sale_price(),
'product_date_on_sale_from' => $product->get_date_on_sale_from(),
'product_date_on_sale_to' => $product->get_date_on_sale_to(),
'product_total_number_sales' => $product->get_total_sales(),
'product_tax_status' => $product->get_tax_status(),
'product_tax_class' => $product->get_tax_class(),
'product_manage_stock' => $product->get_manage_stock(),
'product_sale_quantity' => $product->get_stock_quantity(),
'product_stock_status' => $product->get_stock_status(),
'product_backorders' => $product->get_backorders(),
'product_low_stock_amount' => $product->get_low_stock_amount(),
'product_sold_individually' => $product->get_sold_individually(),
'product_weight' => $product->get_weight(),
'product_length' => $product->get_length(),
'product_width' => $product->get_width(),
'product_height' => $product->get_height(),
'product_upsell_ids' => $product->get_upsell_ids(),
'product_cross_sell_ids' => $product->get_cross_sell_ids(),
'product_parent_id' => $product->get_parent_id(),
'product_reviews_allowed' => $product->get_reviews_allowed(),
'product_purchase_note' => $product->get_purchase_note(),
'product_attributes' => $product->get_attributes(),
'product_default_attributes' => $product->get_default_attributes(),
'product_category_ids' => $product->get_category_ids(),
'product_tag_ids' => $product->get_tag_ids(),
'product_get_virtual' => $product->get_virtual(),
'product_gallery_ids' => $product->get_gallery_image_ids(),
'product_shipping_class_id' => $product->get_shipping_class_id(),
'product_rating_count' => $product->get_rating_counts(),
'product_average_rating' => $product->get_average_rating(),
'product_review_count' => $product->get_review_count(),
);
}
return $product;
}
public static function get_data_object_options() {
$options = [];
foreach ( Woo::get_products() as $product ) {
$name = $product->get_name();
$id = $product->get_id();
$options[ $id ] = array(
'id' => $id,
'label' => $name,
);
}
return $options;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_Address_1
*/
class Woo_Order_Billing_Address_1 extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing address line 1';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing address line 1';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '1176 Poe Lane';
}
public static function get_id() {
return 'billing_address_1';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_Address_2
*/
class Woo_Order_Billing_Address_2 extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing address line 2';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing address line 2';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Lighthouse District';
}
public static function get_id() {
return 'billing_address_2';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_Country
*/
class Woo_Order_Billing_City extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing city';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing city';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'New York';
}
public static function get_id() {
return 'billing_city';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_Company
*/
class Woo_Order_Billing_Company extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing company';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing company';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'RedSquare';
}
public static function get_id() {
return 'billing_company';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
use function WC;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_Country
*/
class Woo_Order_Billing_Country extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing country';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing country';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'United States';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback() {
$countries = array();
foreach ( WC()->countries->get_allowed_countries() as $key => $country ) {
if ( ! empty( $country ) ) {
$countries[ $key ] = array(
'label' => $country,
'id' => $key,
);
}
}
return $countries;
}
public static function get_id() {
return 'billing_country';
}
public static function get_supported_filters() {
return array( 'autocomplete' );
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_Email
*/
class Woo_Order_Billing_Email extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing email';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing email';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'john_doe@fakemail.com';
}
public static function get_id() {
return 'billing_email';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required', 'email' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_First_Name
*/
class Woo_Order_Billing_First_Name extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing first name';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing first name';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Joe';
}
public static function get_id() {
return 'billing_first_name';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_Last_Name
*/
class Woo_Order_Billing_Last_Name extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing last name';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing last name';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Bloggs';
}
public static function get_id() {
return 'billing_last_name';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_Phone
*/
class Woo_Order_Billing_Phone extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing phone';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing phone';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '913-410-3410';
}
public static function get_id() {
return 'billing_phone';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_Postcode
*/
class Woo_Order_Billing_Postcode extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing postcode';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing postcode';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '66215';
}
public static function get_id() {
return 'billing_postcode';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Billing_State
*/
class Woo_Order_Billing_State extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Billing state';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by billing state';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Kansas';
}
public static function get_id() {
return 'billing_state';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Cart_Hash
*/
class Woo_Order_Cart_Hash extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Cart hash';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by cart hash';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '63cc7e2c30ae121035bbf0115b8b4c72bbdb39b8c708d943bc1961700131243c9a41fa2cb44947d762bf8ff5076782733a446c7a97fb8889515d8559802ea64bb2c4f3fabc43e2549afd12c8acbbedaffd58e69368bbdf9f5b17e83a9f048d54e47a19efc88235e54680bb0f715566b9308c49e67dbc53727273d28f767493cfc13fd8241cd1c7f02cd84b2a358434560f919d5d086aa053be6e96739051a1';
}
public static function get_id() {
return 'cart_hash';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Cart_Tax
*/
class Woo_Order_Cart_Tax extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Cart Tax';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the cart tax';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 5.00;
}
public static function get_id() {
return 'cart_tax';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
}

View File

@@ -0,0 +1,87 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
use WP_Query;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Coupon_Used
*/
class Woo_Order_Coupon_Used extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Coupon used';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by coupon used';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'XMAS2021';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback() {
$coupons = array();
// set base query arguments
$query_args = array(
'post_type' => 'shop_coupon',
'post_status' => 'publish',
);
$query = new WP_Query( $query_args );
foreach ( $query->posts as $post ) {
if ( ! empty( $post ) ) {
$code = \wc_format_coupon_code( $post->post_title );
$coupons[ $code ] = array(
'label' => $post->post_title,
'id' => $code,
);
}
}
return $coupons;
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
public static function get_id() {
return 'coupon_used';
}
public static function get_supported_filters() {
return array( 'autocomplete' );
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Created_Via
*/
class Woo_Order_Created_Via extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Created Via';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by method of creation';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Web';
}
public static function get_id() {
return 'created_via';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,78 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Currency
*/
class Woo_Order_Currency extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Order Currency';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by order currency';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'USD';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback() {
$currencies = array();
foreach ( get_woocommerce_currencies() as $code => $name ) {
if ( ! empty( $name ) ) {
$currencies[ $code ] = array(
'label' => $name,
'id' => $code,
);
}
}
return $currencies;
}
public static function get_id() {
return 'order_currency';
}
public static function get_supported_filters() {
return array( 'autocomplete' );
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Customer_Id
*/
class Woo_Order_Customer_Id extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Customer ID';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by customer ID';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 1;
}
public static function get_id() {
return 'customer_id';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Customer_Ip_Address
*/
class Woo_Order_Customer_Ip_Address extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Customer IP address';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by customer IP address';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '26.103.134.169';
}
public static function get_id() {
return 'customer_ip_address';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Customer_Note
*/
class Woo_Order_Customer_Note extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Customer note';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by customer note';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'This is an example customer note';
}
public static function get_id() {
return 'customer_note';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
public static function get_validators() {
return array( 'required' );
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Customer_User_Agent
*/
class Woo_Order_Customer_User_Agent extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Customer user agent';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by customer user agent';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Mozilla/5.0';
}
public static function get_id() {
return 'customer_user_agent';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Date_Completed
*/
class Woo_Order_Date_Completed extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Date completed';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by date completed';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '2021-09-06';
}
public static function get_id() {
return 'date_completed';
}
public static function get_supported_filters() {
return array( 'date' );
}
public static function get_field_value_type() {
return static::TYPE_DATE;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Date_Created
*/
class Woo_Order_Date_Created extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Date created';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by date created';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '2021-09-06';
}
public static function get_id() {
return 'date_created';
}
public static function get_supported_filters() {
return array( 'date' );
}
public static function get_field_value_type() {
return static::TYPE_DATE;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Date_Modified
*/
class Woo_Order_Date_Modified extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Date modified';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by date modified';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '2021-09-06';
}
public static function get_id() {
return 'date_modified';
}
public static function get_supported_filters() {
return array( 'date' );
}
public static function get_field_value_type() {
return static::TYPE_DATE;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Date_Paid
*/
class Woo_Order_Date_Paid extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Date paid';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by date paid';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '2021-09-06';
}
public static function get_id() {
return 'date_paid';
}
public static function get_supported_filters() {
return array( 'date' );
}
public static function get_field_value_type() {
return static::TYPE_DATE;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Discount_Total
*/
class Woo_Order_Discount_Total extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Discount total';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the total discount';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 10;
}
public static function get_id() {
return 'discount_total';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Grand_Total
*/
class Woo_Order_Grand_Total extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Grand total';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the grand total';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 65;
}
public static function get_id() {
return 'grand_total';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Has_Free_Item
*/
class Woo_Order_Has_Free_Item extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Has free item';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by whether the order contains a free item or not';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'FALSE';
}
public static function get_id() {
return 'has_free_item';
}
public static function get_supported_filters() {
return array( 'boolean' );
}
public static function get_field_value_type() {
return static::TYPE_BOOLEAN;
}
}

View File

@@ -0,0 +1,59 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Number
*/
class Woo_Order_Id extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Order id';
}
/**
* Field description
*/
public static function get_description() {
return 'Target an individual order id';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 113099351;
}
public static function get_id() {
return 'woo_order_id';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
public static function primary_key() {
return Woo_Order_Data::get_id();
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Item_Count
*/
class Woo_Order_Item_Count extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Item count';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the item count';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 3;
}
public static function get_id() {
return 'item_count';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Key
*/
class Woo_Order_Key extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Order key';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by order key';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '1234';
}
public static function get_id() {
return 'order_key';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Number
*/
class Woo_Order_Number extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Order number';
}
/**
* Field description
*/
public static function get_description() {
return 'Target an individual order number';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '113099351';
}
public static function get_id() {
return 'order_number';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Parent_Id
*/
class Woo_Order_Parent_Id extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Parent ID';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by parent ID';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '41';
}
public static function get_id() {
return 'parent_id';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Payment_Method_Title
*/
class Woo_Order_Payment_Method_Title extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Payment method title';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by payment method title';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'PayPal';
}
public static function get_id() {
return 'payment_method_title';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
use function WC;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Payment_Method
*/
class Woo_Order_Payment_Method extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Payment method';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by payment method';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'PayPal';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback() {
$methods = array();
foreach ( WC()->payment_gateways->get_available_payment_gateways() as $method ) {
if ( ! empty( $method ) ) {
$methods[ $method->id ] = array(
'label' => $method->get_method_title(),
'id' => $method->id,
);
}
}
return $methods;
}
public static function get_id() {
return 'payment_method';
}
public static function get_supported_filters() {
return array( 'checkbox' );
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Prices_Include_Tax
*/
class Woo_Order_Prices_Include_Tax extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Price includes tax';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by whether the price includes tax or not';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'TRUE';
}
public static function get_id() {
return 'prices_include_tax';
}
public static function get_supported_filters() {
return array( 'boolean' );
}
public static function get_field_value_type() {
return static::TYPE_BOOLEAN;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_Address_1
*/
class Woo_Order_Shipping_Address_1 extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping address line 1';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by shipping address line 1';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '3953 Tetrick Road';
}
public static function get_id() {
return 'shipping_address_1';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_Address_2
*/
class Woo_Order_Shipping_Address_2 extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping address line 2';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by shipping address line 2';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Monkey District';
}
public static function get_id() {
return 'shipping_address_2';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_City
*/
class Woo_Order_Shipping_City extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping city';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by shipping city';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Milwaukee';
}
public static function get_id() {
return 'shipping_city';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_Company
*/
class Woo_Order_Shipping_Company extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping company';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by shipping company';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Example Shipping Company';
}
public static function get_id() {
return 'shipping_company';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
use function WC;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_Country
*/
class Woo_Order_Shipping_Country extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping country';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by shipping country';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'United States';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback() {
$countries = array();
foreach ( WC()->countries->get_shipping_countries() as $key => $country ) {
if ( ! empty( $country ) ) {
$countries[ $key ] = array(
'label' => $country,
'id' => $key,
);
}
}
return $countries;
}
public static function get_id() {
return 'shipping_country';
}
public static function get_supported_filters() {
return array( 'autocomplete' );
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_First_Name
*/
class Woo_Order_Shipping_First_Name extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping first name';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by shipping first name';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Joe';
}
public static function get_id() {
return 'shipping_first_name';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
public static function get_validators() {
return array( 'required' );
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_Last_Name
*/
class Woo_Order_Shipping_Last_Name extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping last name';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by shipping last name';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Bloggs';
}
public static function get_id() {
return 'shipping_last_name';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_Postcode
*/
class Woo_Order_Shipping_Postcode extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping postcode';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by shipping postcode';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '66215';
}
public static function get_id() {
return 'shipping_postcode';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_State
*/
class Woo_Order_Shipping_State extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping state';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by shipping state';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Wisconsin';
}
public static function get_id() {
return 'shipping_state';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_Tax
*/
class Woo_Order_Shipping_Tax extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping tax';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the shipping tax';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 5;
}
public static function get_id() {
return 'shipping_tax';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Shipping_Total
*/
class Woo_Order_Shipping_Total extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Shipping total';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the shipping total';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 5;
}
public static function get_id() {
return 'shipping_total';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
use function wc_get_order_statuses;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Status_Field
*/
class Woo_Order_Status_Filter extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Order status';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the status of the order';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'COMPLETED';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback() {
$statuses = array();
foreach ( wc_get_order_statuses() as $key => $label ) {
$status = strpos( $key, 'wc-' ) === 0 ? substr( $key, 3 ) : $key;
$statuses[ $status ] = array(
'label' => $label,
'id' => $status,
);
}
return $statuses;
}
public static function get_id() {
return 'order_status';
}
public static function get_supported_filters() {
return array( 'checkbox' );
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Total_Tax
*/
class Woo_Order_Total_Tax extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Total tax';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the total tax';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 10;
}
public static function get_id() {
return 'total_tax';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Transaction_Id
*/
class Woo_Order_Transaction_Id extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Transaction ID';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by transaction ID';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '9AV935856B373272B';
}
public static function get_id() {
return 'transaction_id';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Order_Version
*/
class Woo_Order_Version extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Order version';
}
/**
* Field description
*/
public static function get_description() {
return 'Target an individual order version';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '1';
}
public static function get_id() {
return 'order_version';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Active_Price
*/
class Woo_Product_Active_Price extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Product active price';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the product active price';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 30;
}
public static function get_id() {
return 'product_active_price';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Average_Rating
*/
class Woo_Product_Average_Rating extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Product average rating';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the product average rating';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 25;
}
public static function get_id() {
return 'product_average_rating';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
}

View File

@@ -0,0 +1,79 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Product_Backorders
*/
class Woo_Product_Backorders extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Product backorders';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the backorders';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'no';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback() {
return array(
'yes' => array(
'id' => 'yes',
'label' => 'Yes',
),
'no' => array(
'id' => 'no',
'label' => 'No',
),
'notify' => array(
'id' => 'notify',
'label' => 'Notify',
),
);
}
public static function get_id() {
return 'product_backorders';
}
public static function get_supported_filters() {
return array( 'dropdown' );
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Catalog_Visibility
*/
class Woo_Product_Catalog_Visibility extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Catalog visibility';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by catalog visibility';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'visible';
}
public static function get_id() {
return 'product_catalog_visibility';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Category_Ids
*/
class Woo_Product_Category_Ids extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Category ID';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by specific product category';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'Example';
}
/**
* For multiple option inputs, name of the callback function called through ajax to get the options
*/
public static function get_options_callback() {
$categories = array();
$cat_args = array(
'orderby' => 'name',
'order' => 'asc',
);
$product_categories = get_terms( 'product_cat', $cat_args );
foreach ( $product_categories as $category ) {
if ( ! empty( $category ) ) {
$categories[ $category->term_id ] = array(
'label' => $category->name,
'id' => $category->term_id,
);
}
}
return $categories;
}
public static function get_id() {
return 'product_category_ids';
}
public static function get_supported_filters() {
return array( 'autocomplete' );
}
public static function is_ajax_field() {
return true;
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_ARRAY;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Created_Date
*/
class Woo_Product_Created_Date extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Product created date';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by product created date';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '2021-09-06';
}
public static function get_id() {
return 'product_created_date';
}
public static function get_supported_filters() {
return array( 'date' );
}
public static function get_field_value_type() {
return static::TYPE_CLASS;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Cross_Sell_Ids
*/
class Woo_Product_Cross_Sell_Ids extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Product cross sell IDs';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by product cross sell IDs';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '45';
}
public static function get_dummy_value() {
return 'Example';
}
public static function get_id() {
return 'product_cross_sell_ids';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_ARRAY;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Date_On_Sale_From
*/
class Woo_Product_Date_On_Sale_From extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Date on sale from';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the date on sale from';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '2021-09-06';
}
public static function get_id() {
return 'product_date_on_sale_from';
}
public static function get_supported_filters() {
return array( 'date' );
}
public static function get_field_value_type() {
return static::TYPE_DATE;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Date_On_Sale_To
*/
class Woo_Product_Date_On_Sale_To extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Date on sale to';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the date on sale to';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '2021-09-06';
}
public static function get_id() {
return 'product_date_on_sale_to';
}
public static function get_supported_filters() {
return array( 'date' );
}
public static function get_field_value_type() {
return static::TYPE_DATE;
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Description
*/
class Woo_Product_Description extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Product description';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by product description';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'This is an example long description';
}
public static function get_id() {
return 'product_description';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_STRING;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Featured
*/
class Woo_Product_Featured extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Product featured';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by whether the product is featured or not';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'FALSE';
}
public static function get_id() {
return 'product_featured';
}
public static function get_supported_filters() {
return array( 'boolean' );
}
public static function get_field_value_type() {
return static::TYPE_BOOLEAN;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Gallery_Ids
*/
class Woo_Product_Gallery_Ids extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Product attachment ID';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by picture ID';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return '';
}
public static function get_id() {
return 'product_gallery_ids';
}
public static function get_supported_filters() {
return array( 'string_ec' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_ARRAY;
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Get_Virtual
*/
class Woo_Product_Get_Virtual extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Is the product virtual?';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by whether the product is virtual or not';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 'TRUE';
}
public static function get_id() {
return 'product_get_virtual';
}
public static function get_supported_filters() {
return array( 'boolean' );
}
public static function get_field_value_type() {
return static::TYPE_BOOLEAN;
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Height
*/
class Woo_Product_Height extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Product height';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by the product height';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 1.5;
}
public static function get_id() {
return 'product_height';
}
public static function get_supported_filters() {
return array( 'number_comparison' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
}

View File

@@ -0,0 +1,76 @@
<?php
namespace TVE\Dashboard\Automator;
use Thrive\Automator\Items\Data_Field;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Silence is golden!
}
/**
* Class Woo_Product_Sku
*/
class Woo_Product_Id extends Data_Field {
/**
* Field name
*/
public static function get_name() {
return 'Product ID';
}
/**
* Field description
*/
public static function get_description() {
return 'Filter by product id';
}
/**
* Field input placeholder
*/
public static function get_placeholder() {
return '';
}
public static function get_dummy_value() {
return 5;
}
public static function get_id() {
return 'woo_product_id';
}
public static function get_supported_filters() {
return array( 'autocomplete' );
}
public static function get_validators() {
return array( 'required' );
}
public static function get_field_value_type() {
return static::TYPE_NUMBER;
}
public static function primary_key() {
return Woo_Product_Data::get_id();
}
public static function is_ajax_field() {
return true;
}
public static function get_options_callback() {
$products = array();
foreach ( Woo::get_products() as $product ) {
$id = $product->get_id();
$products[ $id ] = array(
'id' => $id,
'label' => $product->get_name(),
);
}
return $products;
}
}

Some files were not shown because too many files have changed in this diff Show More