| 1 |
<?php |
| 2 |
/** |
| 3 |
* URL links |
| 4 |
* |
| 5 |
* @package Lasso URL links |
| 6 |
*/ |
| 7 |
|
| 8 |
use LassoLite\Classes\Amazon_Api; |
| 9 |
use LassoLite\Classes\Config; |
| 10 |
use LassoLite\Classes\Helper; |
| 11 |
use LassoLite\Classes\License; |
| 12 |
use LassoLite\Classes\Setting; |
| 13 |
use LassoLite\Admin\Constant; |
| 14 |
|
| 15 |
$lasso_options = Setting::get_settings(); |
| 16 |
|
| 17 |
$amazon_default_tracking_country = ! empty( $lasso_options['amazon_default_tracking_country'] ) |
| 18 |
? $lasso_options['amazon_default_tracking_country'] : '1'; |
| 19 |
$countries_dd = Helper::get_countries_dd( $amazon_default_tracking_country ); |
| 20 |
|
| 21 |
$amazon_tracking_id = $lasso_options['amazon_tracking_id'] ?? ''; |
| 22 |
$amazon_access_key_id = $lasso_options['amazon_access_key_id'] ?? ''; |
| 23 |
$amazon_secret_key = $lasso_options['amazon_secret_key'] ?? ''; |
| 24 |
$amazon_creators_credential_id = $lasso_options['amazon_creators_credential_id'] ?? ''; |
| 25 |
$amazon_creators_secret = $lasso_options['amazon_creators_secret'] ?? ''; |
| 26 |
$amazon_creators_version = $lasso_options['amazon_creators_version'] ?? ''; |
| 27 |
$amazon_creators_partner_tag = $lasso_options['amazon_creators_partner_tag'] ?? ''; |
| 28 |
$auto_monetize_amazon = $lasso_options['auto_monetize_amazon'] ?? false; |
| 29 |
|
| 30 |
$is_valid_tracking_id = empty( $amazon_tracking_id ) ? true : Amazon_Api::validate_tracking_id( $amazon_tracking_id ); |
| 31 |
$tracking_id_class = $is_valid_tracking_id ? '' : ' invalid-field'; |
| 32 |
$tracking_id_invalid_class = $is_valid_tracking_id ? ' d-none' : ''; |
| 33 |
|
| 34 |
$amazon_pricing_daily = $lasso_options['amazon_pricing_daily'] ?? true; |
| 35 |
$update_price_checked = $amazon_pricing_daily ? 'checked' : ''; |
| 36 |
|
| 37 |
$license_active = License::get_license_status(); |
| 38 |
$class_license_active = $license_active ? '' : 'lasso-lite-disabled no-hint'; |
| 39 |
$class_license_display = !empty( $license_active ) ? 'd-none' : ''; |
| 40 |
$auto_upgrade_eligible_links = $lasso_options['auto_upgrade_eligible_links'] ?? true; |
| 41 |
|
| 42 |
$lite_account_cta_prefill_email = Helper::get_option( Constant::LASSO_ACCOUNT_EMAIL, '' ); |
| 43 |
?> |
| 44 |
|
| 45 |
<?php Config::get_header(); ?> |
| 46 |
|
| 47 |
<!-- GENERAL SETTINGS --> |
| 48 |
<section class="px-3 py-5"> |
| 49 |
<div class="container lite-container"> |
| 50 |
<!-- HEADER --> |
| 51 |
<?php require_once 'header.php'; ?> |
| 52 |
|
| 53 |
<form class="lasso-admin-settings-form" autocomplete="off" action=""> |
| 54 |
<!-- AMAZON --> |
| 55 |
<div class="row mb-5"> |
| 56 |
<div class="col-lg"> |
| 57 |
|
| 58 |
<div class="white-bg rounded shadow p-4 mb-4"> |
| 59 |
<!-- AMAZON TRACKING ID --> |
| 60 |
<section> |
| 61 |
<h3>Amazon Associates Accounts</h3> |
| 62 |
<p>Enter your primary tracking ID and make sure your international accounts are connected with OneLink. It'll automatically send visitors to their local store.</p> |
| 63 |
|
| 64 |
<div class="form-group mb-4"> |
| 65 |
<label><strong>Tracking ID for This Site</strong></label> |
| 66 |
<input type="text" name="amazon_tracking_id" id="amazon_tracking_id" class="form-control<?php echo $tracking_id_class; ?>" value="<?php echo esc_html( $amazon_tracking_id ) ?>" placeholder="tracking-20"> |
| 67 |
<div id="tracking-id-invalid-msg" class="red<?php echo $tracking_id_invalid_class; ?>">This is an invalid Tracking ID</div> |
| 68 |
</div> |
| 69 |
<div class="form-group"> |
| 70 |
<label class="toggle m-0 mr-1"> |
| 71 |
<input type="checkbox" name="amazon_pricing_daily" id="amazon_pricing_daily" <?php echo $update_price_checked; ?>> |
| 72 |
<span class="slider"></span> |
| 73 |
</label> |
| 74 |
<label class="m-0">Update Amazon pricing daily</label> |
| 75 |
</div> |
| 76 |
</section> |
| 77 |
</div> |
| 78 |
|
| 79 |
|
| 80 |
<!-- AUTO MONETIZE AMAZON --> |
| 81 |
<div class="white-bg rounded shadow p-4"> |
| 82 |
<section> |
| 83 |
<p class="<?php echo $class_license_display ?>">Auto-Monetize Amazon Links is available with the Pro plan. <a href="<?php echo Constant::LASSO_CHECKOUT_URL_DEFAULT; ?>" target="_blank" class="purple underline">Click here to upgrade</a>.</p> |
| 84 |
<h3 class="<?php echo $class_license_active ?>">Auto-Monetize Amazon Links</h3> |
| 85 |
<p class="<?php echo $class_license_active ?>">Automatically monetize all current and future Amazon links with your Tracking ID and and added to your affiliate dashboard.</p> |
| 86 |
|
| 87 |
<p> |
| 88 |
<label class="toggle m-0 mr-1"> |
| 89 |
<input type="checkbox" name="auto_monetize_amazon" id="auto_monetize_amazon" <?php echo $auto_monetize_amazon ? 'checked' : ''; ?>> |
| 90 |
<span class="slider"></span> |
| 91 |
</label> |
| 92 |
<label class="m-0">Enable Amazon Auto-Monetization</label> |
| 93 |
</p> |
| 94 |
<p class="text-danger amazon-error"></p> |
| 95 |
</section> |
| 96 |
<section> |
| 97 |
<p> |
| 98 |
<label class="toggle m-0 mr-1 lasso-lite-disabled no-hint"> |
| 99 |
<input type="checkbox" disabled="disabled"> |
| 100 |
<span class="slider"></span> |
| 101 |
</label> |
| 102 |
<label class="m-0 lasso-lite-disabled no-hint">Allow Multiple Tracking IDs</label> |
| 103 |
</p> |
| 104 |
<div class="form-group mb-4 lasso-lite-disabled"> |
| 105 |
<label><strong>Tracking ID Whitelist</strong></label> |
| 106 |
<input type="text" name="lasso-tracking-id-whitelist" class="form-control" value="" disabled="disabled" placeholder="Select Tracking IDs"> |
| 107 |
</div> |
| 108 |
</section> |
| 109 |
</div> |
| 110 |
</div> |
| 111 |
|
| 112 |
<div class="col-lg"> |
| 113 |
<div class="white-bg rounded shadow p-4 mb-lg-0 mb-5 amazon-api-card"> |
| 114 |
<section> |
| 115 |
<h3 class="d-inline-block align-middle mr-2">Amazon Product Data API</h3> |
| 116 |
<a href="https://support.getlasso.co/en/articles/3182308-how-to-set-up-amazon-creators-api-credentials-with-lasso" target="_blank" rel="noopener noreferrer" class="btn btn-sm learn-btn mb-2"> |
| 117 |
<i class="far fa-info-circle"></i> Learn |
| 118 |
</a> |
| 119 |
|
| 120 |
<div class="form-group"> |
| 121 |
<label data-tooltip="Select your Amazon Associates locale."><strong>Default Tracking ID</strong> <i class="far fa-info-circle light-purple"></i></label> |
| 122 |
<?php echo $countries_dd; ?> |
| 123 |
</div> |
| 124 |
|
| 125 |
<div class="amazon-paapi-fields"> |
| 126 |
<p>If you want to use the Amazon API for product data, here's how to get your <a href="https://support.getlasso.co/en/articles/3182308-how-to-get-your-amazon-product-api-keys" target="_blank" class="purple underline">API keys from Amazon</a>.</p> |
| 127 |
<p class="<?php echo $class_license_display; ?>">You can get Amazon product names, images, and pricing without an API key with the <a href="<?php echo Constant::LASSO_CHECKOUT_URL_DEFAULT; ?>" target="_blank" class="purple underline">Lasso Pro plan</a>.</p> |
| 128 |
|
| 129 |
<div class="form-group mb-4"> |
| 130 |
<label><strong>Access Key ID</strong></label> |
| 131 |
<input type="text" name="amazon_access_key_id" id="amazon_access_key_id" class="form-control" value="<?php echo esc_html( $amazon_access_key_id ); ?>" placeholder="Access Key ID"> |
| 132 |
</div> |
| 133 |
|
| 134 |
<div class="form-group mb-4"> |
| 135 |
<label><strong>Secret Key</strong></label> |
| 136 |
<input type="text" name="amazon_secret_key" id="amazon_secret_key" class="form-control" value="<?php echo esc_html( $amazon_secret_key ); ?>" placeholder="Secret Key"> |
| 137 |
</div> |
| 138 |
</div> |
| 139 |
|
| 140 |
<div class="amazon-creators-fields d-none"> |
| 141 |
<p>If you want to use the Amazon Creators API for product data, here's how to get your <a href="https://support.getlasso.co/en/articles/3182308-how-to-set-up-amazon-creators-api-credentials-with-lasso" target="_blank" class="purple underline">Creators API credentials from Amazon</a>.</p> |
| 142 |
<p class="<?php echo $class_license_display; ?>">You can get Amazon product names, images, and pricing without an API key with the <a href="<?php echo Constant::LASSO_CHECKOUT_URL_DEFAULT; ?>" target="_blank" class="purple underline">Lasso Pro plan</a>.</p> |
| 143 |
|
| 144 |
<div class="form-group mb-4"> |
| 145 |
<label><strong>Credential ID</strong></label> |
| 146 |
<input type="password" name="amazon_creators_credential_id" id="amazon_creators_credential_id" class="form-control" value="<?php echo esc_html( $amazon_creators_credential_id ); ?>" placeholder="amzn1.application-oa2-client.xxxxx"> |
| 147 |
</div> |
| 148 |
|
| 149 |
<div class="form-group mb-4"> |
| 150 |
<label><strong>Secret</strong></label> |
| 151 |
<input type="password" name="amazon_creators_secret" id="amazon_creators_secret" class="form-control" value="<?php echo esc_html( $amazon_creators_secret ); ?>" placeholder="client-secret"> |
| 152 |
</div> |
| 153 |
|
| 154 |
<div class="form-row"> |
| 155 |
<div class="form-group col-12 col-md-8 mb-4"> |
| 156 |
<label><strong>Partner tag</strong></label> |
| 157 |
<input type="text" name="amazon_creators_partner_tag" id="amazon_creators_partner_tag" class="form-control" value="<?php echo esc_html( $amazon_creators_partner_tag ); ?>" placeholder="yourtag-20"> |
| 158 |
</div> |
| 159 |
|
| 160 |
<div class="form-group col-12 col-md-4 mb-4"> |
| 161 |
<label><strong>Version</strong></label> |
| 162 |
<input type="text" name="amazon_creators_version" id="amazon_creators_version" class="form-control" value="<?php echo esc_html( $amazon_creators_version ); ?>" placeholder="3.1"> |
| 163 |
</div> |
| 164 |
</div> |
| 165 |
|
| 166 |
<div class="form-group mb-3 text-right"> |
| 167 |
<button type="button" class="btn btn-sm btn-lasso-lite-verify-amazon-creators">Validate</button> |
| 168 |
</div> |
| 169 |
</div> |
| 170 |
|
| 171 |
<div class="form-group"> |
| 172 |
<label class="toggle m-0 mr-1"> |
| 173 |
<input type="checkbox" id="lasso-amazon-api-use-creators" class="amazon-api-mode-toggle"> |
| 174 |
<span class="slider"></span> |
| 175 |
</label> |
| 176 |
<label class="m-0" for="lasso-amazon-api-use-creators">Use Creators API</label> |
| 177 |
</div> |
| 178 |
</section> |
| 179 |
|
| 180 |
<div class="form-group"> |
| 181 |
<label class="toggle m-0 mr-1 lasso-lite-disabled no-hint"> |
| 182 |
<input disabled type="checkbox" checked> |
| 183 |
<span class="slider"></span> |
| 184 |
</label> |
| 185 |
<label class="m-0 lasso-lite-disabled no-hint">Show Prime Logo In Displays</label> |
| 186 |
</div> |
| 187 |
|
| 188 |
<div class="form-group"> |
| 189 |
<label class="toggle m-0 mr-1 lasso-lite-disabled no-hint"> |
| 190 |
<input type="checkbox" disabled="disabled"> |
| 191 |
<span class="slider"></span> |
| 192 |
</label> |
| 193 |
<label class="m-0 lasso-lite-disabled no-hint">Show Discount Pricing</label> |
| 194 |
</div> |
| 195 |
|
| 196 |
<div class="form-group"> |
| 197 |
<label class="toggle m-0 mr-1"> |
| 198 |
<input type="checkbox" name="auto_upgrade_eligible_links" id="auto_upgrade_eligible_links" <?php echo $auto_upgrade_eligible_links ? 'checked' : ''; ?>> |
| 199 |
<span class="slider"></span> |
| 200 |
</label> |
| 201 |
<label class="m-0"> |
| 202 |
Auto-upgrade Eligible Links |
| 203 |
<a |
| 204 |
href="https://getlasso.co/features/affiliate-plus/" |
| 205 |
target="_blank" |
| 206 |
rel="noopener noreferrer" |
| 207 |
data-tooltip="Learn more" |
| 208 |
class="ml-1" |
| 209 |
><i class="far fa-info-circle light-purple"></i></a> |
| 210 |
</label> |
| 211 |
</div> |
| 212 |
</div> |
| 213 |
</div> |
| 214 |
|
| 215 |
</div> |
| 216 |
|
| 217 |
<!-- SAVE CHANGES --> |
| 218 |
<div class="row align-items-center"> |
| 219 |
<div class="col-lg text-lg-right text-center"> |
| 220 |
<button type="submit" class="btn btn-save-settings-amazon" >Save Changes</button> |
| 221 |
</div> |
| 222 |
</div> |
| 223 |
</form> |
| 224 |
</div> |
| 225 |
</section> |
| 226 |
<?php |
| 227 |
echo Helper::include_with_variables( |
| 228 |
SIMPLE_URLS_DIR . '/admin/views/modals/lite-account-existing-login.php', |
| 229 |
array( |
| 230 |
'prefill_email' => $lite_account_cta_prefill_email, |
| 231 |
) |
| 232 |
); |
| 233 |
?> |
| 234 |
<?php |
| 235 |
// Amazon notices: keep legacy banner UX (click row / X to dismiss) on default-template-jsrender.html. |
| 236 |
// Lite-account CTA only uses default-template-amz-html-jsrender.html (row is not a collapse trigger; link is real <a>). |
| 237 |
echo Helper::wrapper_js_render( 'default-template-notification-amz', Helper::get_path_views_folder() . '/notifications/default-template-jsrender.html' ); |
| 238 |
echo Helper::wrapper_js_render( 'default-template-notification-amz-html', Helper::get_path_views_folder() . '/notifications/default-template-amz-html-jsrender.html' ); |
| 239 |
?> |
| 240 |
<?php Config::get_footer(); ?> |
| 241 |
|