| 1 |
<?php |
| 2 |
$has_wc = spoki_has_woocommerce(); |
| 3 |
$has_phone = isset($this->options['telephone']) && $this->options['telephone'] != ''; |
| 4 |
$has_spoki_keys = (isset($this->options['secret']) && trim($this->options['secret']) != '') && (isset($this->options['delivery_url']) && trim($this->options['delivery_url']) != ''); |
| 5 |
|
| 6 |
/** Spoki Without WooCommerce Onboarding */ |
| 7 |
if (!$has_wc && !$has_phone) : ?> |
| 8 |
<div class="spoki-onboarding"> |
| 9 |
<h2><?php _e("Welcome on Spoki!", "spoki") ?></h2> |
| 10 |
<p><?php _e("Insert your WhatsApp phone number and start using <b>Free WhatsApp buttons</b> on your website!", "spoki") ?></p> |
| 11 |
<table class="form-table"> |
| 12 |
<tr> |
| 13 |
<th scope="row"> |
| 14 |
<label for="<?php echo SPOKI_OPTIONS ?>[onboarding][telephone]"> |
| 15 |
<?php _e('Your WhatsApp Telephone', "spoki") ?> |
| 16 |
</label> |
| 17 |
</th> |
| 18 |
<td> |
| 19 |
<div class="spoki-phone-container"> |
| 20 |
<input type="text" class="regular-text spoki-phone-prefix" |
| 21 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][prefix]" |
| 22 |
required |
| 23 |
value="<?php echo (isset($this->options['onboarding']['prefix']) && trim($this->options['onboarding']['prefix']) != '') ? $this->options['onboarding']['prefix'] : (isset($this->options['prefix']) ? $this->options['prefix'] : '') ?>" |
| 24 |
placeholder="+39" |
| 25 |
/> |
| 26 |
<input type="tel" class="regular-text" required |
| 27 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][telephone]" |
| 28 |
placeholder="3331234567" |
| 29 |
value="<?php echo (isset($this->options['onboarding']['telephone']) && $this->options['onboarding']['telephone'] != '') ? ($this->options['onboarding']['telephone']) : (isset($this->options['telephone']) ? $this->options['telephone'] : '') ?>" |
| 30 |
/> |
| 31 |
</div> |
| 32 |
<p class="description"> |
| 33 |
<b><?php _e("Note", "spoki") ?></b>: <?php _e("Your customers will send messages to this WhatsApp number.", "spoki") ?> |
| 34 |
</p> |
| 35 |
</td> |
| 36 |
</tr> |
| 37 |
</table> |
| 38 |
<input type="hidden" name="<?php echo SPOKI_OPTIONS ?>[onboarding][without_wc]" value="1"> |
| 39 |
<?php submit_button() ?> |
| 40 |
</div> |
| 41 |
<?php endif; |
| 42 |
|
| 43 |
/** Spoki WooCommerce Onboarding */ |
| 44 |
if ($has_wc && !$has_spoki_keys) : ?> |
| 45 |
<div class="spoki-onboarding"> |
| 46 |
<h2><?php _e("Welcome on Spoki!", "spoki") ?></h2> |
| 47 |
<p><?php _e("Confirm your shop info and start sending <b>WhatsApp Notifications</b> to your customers about Orders and Abandoned Carts!", "spoki") ?></p> |
| 48 |
|
| 49 |
<table class="form-table"> |
| 50 |
<tr> |
| 51 |
<th scope="row"> |
| 52 |
<label for="<?php echo SPOKI_OPTIONS ?>[onboarding][email]"> |
| 53 |
<?php _e('Email Spoki', "spoki") ?> |
| 54 |
</label> |
| 55 |
</th> |
| 56 |
<td> |
| 57 |
<input type="email" class="regular-text" required |
| 58 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][email]" |
| 59 |
placeholder="<?php echo Spoki()->shop['email'] ?>" |
| 60 |
value="<?php if (isset($this->options['onboarding']['email']) && $this->options['onboarding']['email'] !== '') { |
| 61 |
echo esc_html($this->options['onboarding']['email']); |
| 62 |
} else { |
| 63 |
echo Spoki()->shop['email']; |
| 64 |
} ?>" |
| 65 |
/> |
| 66 |
<p class="description"> |
| 67 |
<b><?php _e("Don't you have a Spoki account?", "spoki") ?></b><br/> |
| 68 |
<a href="https://app.spoki.com/register" target="_blank"><?php _e('Create a Spoki account', "spoki") ?></a> |
| 69 |
<?php _e("and start sending WhatsApp Notifications to your customers.", "spoki") ?> |
| 70 |
</p> |
| 71 |
</td> |
| 72 |
</tr> |
| 73 |
<tr> |
| 74 |
<th scope="row"> |
| 75 |
<label for="<?php echo SPOKI_OPTIONS ?>[onboarding][telephone]"> |
| 76 |
<?php _e('Your WhatsApp Telephone', "spoki") ?> |
| 77 |
</label> |
| 78 |
</th> |
| 79 |
<td> |
| 80 |
<div class="spoki-phone-container"> |
| 81 |
<input type="text" class="regular-text spoki-phone-prefix" |
| 82 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][prefix]" |
| 83 |
required |
| 84 |
value="<?php echo (isset($this->options['onboarding']['prefix']) && trim($this->options['onboarding']['prefix']) != '') ? $this->options['onboarding']['prefix'] : (isset($this->options['prefix']) ? $this->options['prefix'] : '') ?>" |
| 85 |
placeholder="+39" |
| 86 |
/> |
| 87 |
<input type="tel" class="regular-text" required |
| 88 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][telephone]" |
| 89 |
placeholder="3331234567" |
| 90 |
value="<?php echo (isset($this->options['onboarding']['telephone']) && $this->options['onboarding']['telephone'] != '') ? ($this->options['onboarding']['telephone']) : (isset($this->options['telephone']) ? $this->options['telephone'] : '') ?>" |
| 91 |
/> |
| 92 |
</div> |
| 93 |
|
| 94 |
<p class="description"> |
| 95 |
<b><?php _e("Note", "spoki") ?></b>: <?php _e("Your customers will send messages to this WhatsApp number.", "spoki") ?> |
| 96 |
</p> |
| 97 |
</td> |
| 98 |
</tr> |
| 99 |
<tr> |
| 100 |
<th scope="row"> |
| 101 |
<label for="<?php echo SPOKI_OPTIONS ?>[onboarding][shop_name]"> |
| 102 |
<?php _e('Shop Name', "spoki") ?> |
| 103 |
</label> |
| 104 |
</th> |
| 105 |
<td> |
| 106 |
<input type="text" class="regular-text" required |
| 107 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][shop_name]" |
| 108 |
placeholder="<?php echo Spoki()->shop['name'] ?>" |
| 109 |
value="<?php if (isset($this->options['onboarding']['shop_name']) && $this->options['onboarding']['shop_name'] !== '') { |
| 110 |
echo esc_html($this->options['onboarding']['shop_name']); |
| 111 |
} else { |
| 112 |
echo Spoki()->shop['name']; |
| 113 |
} ?>" |
| 114 |
/> |
| 115 |
<p class="description"> |
| 116 |
<b><?php _e("Note", "spoki") ?></b>: <?php _e("Insert the name of your shop.", "spoki") ?> |
| 117 |
</p> |
| 118 |
</td> |
| 119 |
</tr> |
| 120 |
</table> |
| 121 |
<br/> |
| 122 |
<div> |
| 123 |
<input type="checkbox" id="terms_check" required |
| 124 |
name="<?php echo SPOKI_OPTIONS ?>[onboarding][terms_check]" |
| 125 |
value="1" <?php if (isset($this->options['onboarding']['terms_check'])) echo checked(1, $this->options['onboarding']['terms_check'], false) ?>> |
| 126 |
<label for="terms_check"> |
| 127 |
<?php _e("I accept", "spoki") ?> |
| 128 |
<a href="https://api.spoki.com/static/terms_conditions_spoki_flex.pdf" target="_blank"><?php _e('general terms and conditions', "spoki") ?></a> |
| 129 |
<?php _e("for using the Spoki service and the", "spoki") ?> |
| 130 |
<a href="https://api.spoki.com/static/privacy.pdf" target="_blank"><?php _e('privacy policy', "spoki") ?></a>. |
| 131 |
</label> |
| 132 |
</div> |
| 133 |
<input type="hidden" name="<?php echo SPOKI_OPTIONS ?>[onboarding][with_wc]" value="1"> |
| 134 |
<input type="hidden" name="spoki_enable_url" value="<?php echo Spoki()->api_enable_flex ?>"> |
| 135 |
<input type="hidden" name="spoki_plan_url" value="<?php echo Spoki()->api_plan ?>"> |
| 136 |
<input type="hidden" name="<?php echo SPOKI_OPTIONS ?>[onboarding][spoki_onboarding_delivery_url]" value=""> |
| 137 |
<input type="hidden" name="<?php echo SPOKI_OPTIONS ?>[onboarding][spoki_onboarding_secret]" value=""> |
| 138 |
<input type="hidden" name="<?php echo SPOKI_OPTIONS ?>[account_info][response_json]" value=""> |
| 139 |
<div class="enable-spoki-section"> |
| 140 |
<?php submit_button(__("Enable Spoki", "spoki"), 'primary', 'submit', true, 'enable-spoki-btn="1"') ?> |
| 141 |
<!-- <a href="--><?php //echo Spoki()->get_pro_plan_link() ?><!--" target="_blank">--> |
| 142 |
<!-- --><?php //_e("Discover the free features of Spoki Free!", "spoki") ?> |
| 143 |
<!-- </a>--> |
| 144 |
</div> |
| 145 |
<!-- <p class="already-have-spoki">--> |
| 146 |
<!-- --><?php //_e("Do you already have Spoki?", "spoki") ?> |
| 147 |
<!-- <a href="?page=--><?php //echo urlencode(SPOKI_PLUGIN_NAME) ?><!--&tab=settings">--><?php //_e("Insert your Spoki keys", "spoki") ?><!--</a>.--> |
| 148 |
<!-- </p>--> |
| 149 |
</div> |
| 150 |
<?php endif; |
| 151 |
|