| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly! |
| 4 |
} |
| 5 |
|
| 6 |
if ( ! class_exists( 'WPSC_Onboarding_Step_Whats_Next' ) ) : |
| 7 |
|
| 8 |
/** |
| 9 |
* Onboarding step 8: What's Next - optional add-ons showcase. |
| 10 |
* |
| 11 |
* Visually similar to (and reuses the same images/links as) the existing |
| 12 |
* WPSC_Addons showcase page, curated down to a handful of add-ons most |
| 13 |
* relevant to a new install. Purely informational - nothing is activated |
| 14 |
* or purchased from here. |
| 15 |
* |
| 16 |
* The commerce and "SLA slot" cards adapt to what's already running on the |
| 17 |
* site, using the exact same base-plugin detection each of SupportCandy's |
| 18 |
* own integration add-ons already uses internally (see wpsc-woocommerce, |
| 19 |
* wpsc-edd, wpsc-gravity-forms, wpsc-lms), so it isn't duplicated here: |
| 20 |
* - WooCommerce is replaced by Easy Digital Downloads when EDD is present. |
| 21 |
* - SLA is replaced by LMS Integration when a supported LMS is present, |
| 22 |
* else by Gravity Forms Integration when Gravity Forms is present. |
| 23 |
* |
| 24 |
* Each card's "Learn More" goes to an external supportcandy.net URL, so it's |
| 25 |
* unaffected by every other SupportCandy submenu being hidden while setup is |
| 26 |
* pending - there's no "View all Pro Features" link into wpsc-add-ons here |
| 27 |
* for the same reason that link would use (see |
| 28 |
* WPSC_Onboarding::restrict_menu_during_setup()). |
| 29 |
*/ |
| 30 |
final class WPSC_Onboarding_Step_Whats_Next { |
| 31 |
|
| 32 |
const STEP_ID = 'whats-next'; |
| 33 |
|
| 34 |
/** |
| 35 |
* Render step body |
| 36 |
* |
| 37 |
* @param string $step_id - step id. |
| 38 |
* @return void |
| 39 |
*/ |
| 40 |
public static function render( $step_id ) { |
| 41 |
|
| 42 |
$addons = self::get_addons(); |
| 43 |
?> |
| 44 |
<div class="wpsc-onboarding-step"> |
| 45 |
<h2><?php esc_attr_e( "What's Next?", 'supportcandy' ); ?></h2> |
| 46 |
<p class="wpsc-onboarding-step-desc"><?php esc_attr_e( "You're all set! Here are some pro features you can explore whenever you're ready - nothing here is required.", 'supportcandy' ); ?></p> |
| 47 |
|
| 48 |
<div class="wpsc-onboarding-addon-grid"> |
| 49 |
<?php foreach ( $addons as $addon ) : ?> |
| 50 |
<div class="wpsc-onboarding-addon-card"> |
| 51 |
<img src="<?php echo esc_url( WPSC_PLUGIN_URL . 'asset/images/' . $addon['image'] ); ?>" alt="<?php echo esc_attr( $addon['title'] ); ?>"> |
| 52 |
<p><?php echo esc_html( $addon['desc'] ); ?></p> |
| 53 |
<a class="wpsc-button small secondary" href="<?php echo esc_url( $addon['url'] ); ?>" target="_blank"><?php esc_attr_e( 'Learn More', 'supportcandy' ); ?></a> |
| 54 |
</div> |
| 55 |
<?php endforeach; ?> |
| 56 |
</div> |
| 57 |
|
| 58 |
<?php WPSC_Onboarding::render_step_footer( $step_id, true ); ?> |
| 59 |
</div> |
| 60 |
<?php |
| 61 |
wp_die(); |
| 62 |
} |
| 63 |
|
| 64 |
/** |
| 65 |
* Curated add-on list, adapted to the site's existing plugins. |
| 66 |
* |
| 67 |
* @return array |
| 68 |
*/ |
| 69 |
private static function get_addons() { |
| 70 |
|
| 71 |
$addons = array( |
| 72 |
'email-piping' => array( |
| 73 |
'title' => esc_attr__( 'Email Piping', 'supportcandy' ), |
| 74 |
'desc' => esc_attr__( 'Let customers and agents create and reply to tickets directly from email.', 'supportcandy' ), |
| 75 |
'image' => 'email-piping.png', |
| 76 |
'url' => 'https://supportcandy.net/downloads/email-piping', |
| 77 |
), |
| 78 |
'survey' => array( |
| 79 |
'title' => esc_attr__( 'Satisfaction Survey', 'supportcandy' ), |
| 80 |
'desc' => esc_attr__( 'Collect customer feedback and ratings for each ticket to see how your team is doing.', 'supportcandy' ), |
| 81 |
'image' => 'satisfaction-survey.png', |
| 82 |
'url' => 'https://supportcandy.net/downloads/satisfaction-survey', |
| 83 |
), |
| 84 |
'workflow' => array( |
| 85 |
'title' => esc_attr__( 'Workflows', 'supportcandy' ), |
| 86 |
'desc' => esc_attr__( 'Automate repetitive ticket actions with rule-based workflows.', 'supportcandy' ), |
| 87 |
'image' => 'workflows.png', |
| 88 |
'url' => 'https://supportcandy.net/downloads/workflows', |
| 89 |
), |
| 90 |
'commerce' => array( |
| 91 |
'title' => esc_attr__( 'WooCommerce', 'supportcandy' ), |
| 92 |
'desc' => esc_attr__( 'Let customers pick their WooCommerce orders/products in the ticket form, and let agents view order details from the ticket.', 'supportcandy' ), |
| 93 |
'image' => 'woocommerce.png', |
| 94 |
'url' => 'https://supportcandy.net/downloads/woocommerce-integration', |
| 95 |
), |
| 96 |
'sla' => array( |
| 97 |
'title' => esc_attr__( 'SLA', 'supportcandy' ), |
| 98 |
'desc' => esc_attr__( 'Set and track response/resolution time targets for different ticket types.', 'supportcandy' ), |
| 99 |
'image' => 'sla.png', |
| 100 |
'url' => 'https://supportcandy.net/downloads/sla', |
| 101 |
), |
| 102 |
'reports' => array( |
| 103 |
'title' => esc_attr__( 'Reports', 'supportcandy' ), |
| 104 |
'desc' => esc_attr__( 'Measure and improve the efficiency of your support with advanced reporting.', 'supportcandy' ), |
| 105 |
'image' => 'reports.png', |
| 106 |
'url' => 'https://supportcandy.net/downloads/reports', |
| 107 |
), |
| 108 |
); |
| 109 |
|
| 110 |
// Easy Digital Downloads and WooCommerce are alternatives for selling |
| 111 |
// digital products - show whichever one the site actually runs. |
| 112 |
if ( class_exists( 'Easy_Digital_Downloads' ) ) { |
| 113 |
$addons['commerce'] = array( |
| 114 |
'title' => esc_attr__( 'Easy Digital Downloads', 'supportcandy' ), |
| 115 |
'desc' => esc_attr__( 'Let customers pick their EDD orders/products in the ticket form, and let agents view order details from the ticket.', 'supportcandy' ), |
| 116 |
'image' => 'edd.png', |
| 117 |
'url' => 'https://supportcandy.net/downloads/edd-integration', |
| 118 |
); |
| 119 |
} |
| 120 |
|
| 121 |
// If the site already runs a supported LMS or Gravity Forms, that |
| 122 |
// integration is more immediately useful than SLA tracking. |
| 123 |
$has_lms = class_exists( 'LifterLMS' ) || function_exists( 'Tutor' ) || class_exists( 'LearnPress' ); |
| 124 |
if ( $has_lms ) { |
| 125 |
$addons['sla'] = array( |
| 126 |
'title' => esc_attr__( 'LMS Integration', 'supportcandy' ), |
| 127 |
'desc' => esc_attr__( 'Let students raise tickets tied to their courses, and let agents see enrollment details from the ticket.', 'supportcandy' ), |
| 128 |
'image' => 'lms-integration.png', |
| 129 |
'url' => 'https://supportcandy.net/downloads/lms-integration', |
| 130 |
); |
| 131 |
} elseif ( class_exists( 'GFForms' ) ) { |
| 132 |
$addons['sla'] = array( |
| 133 |
'title' => esc_attr__( 'Gravity Forms Integration', 'supportcandy' ), |
| 134 |
'desc' => esc_attr__( 'Turn Gravity Forms submissions into SupportCandy tickets automatically.', 'supportcandy' ), |
| 135 |
'image' => 'gravity-forms.png', |
| 136 |
'url' => 'https://supportcandy.net/downloads/gravity-forms-integration', |
| 137 |
); |
| 138 |
} |
| 139 |
|
| 140 |
return apply_filters( 'wpsc_onboarding_whats_next_addons', array_values( $addons ) ); |
| 141 |
} |
| 142 |
} |
| 143 |
endif; |
| 144 |
|