Skip to content

Commit

Permalink
Merge pull request #62 from UVLabs/development
Browse files Browse the repository at this point in the history
chore: syncing
  • Loading branch information
UVLabs authored Apr 3, 2023
2 parents 6c5c3a3 + a7c1a2e commit 2f16b90
Show file tree
Hide file tree
Showing 37 changed files with 867 additions and 501 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ todo.txt
vendor
.DS_Store
dist
artifact
artifact-kikote
lpac.zip
logs
.vscode
Expand Down
22 changes: 2 additions & 20 deletions admin-pointers.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,11 @@ function create_onboarding_pointers( $pointers, $prefix ) {

$pointers_list = array_merge(
$pointers,
array(
$prefix . '_woocommerce_settings' => array(
'selector' => '#toplevel_page_woocommerce',
'title' => __( 'Thanks for Installing LPAC!', 'map-location-picker-at-checkout-for-woocommerce' ),
'text' => sprintf( __( 'Lets point you to the plugin settings page. Start by going to %1$sWooCommerce->Settings%2$s.', 'map-location-picker-at-checkout-for-woocommerce' ), '<strong>', '</strong>', '<br/>' ),
'icon_class' => 'dashicons-plugins-checked',
'width' => 350,
),
),
array(
$prefix . '_lpac_tab' => array(
'selector' => '.woo-nav-tab-wrapper',
'title' => __( 'Plugin Settings Tab', 'map-location-picker-at-checkout-for-woocommerce' ),
'text' => sprintf( __( 'Click on %1$sLocation Picker at Checkout%2$s to access the plugin settings.', 'map-location-picker-at-checkout-for-woocommerce' ), '<strong>', '</strong>', '<br/>' ),
'icon_class' => 'dashicons-admin-generic',
'width' => 250,
),
),
array(
$prefix . '_lpac_submenu' => array(
'selector' => '#lpac-submenu',
'title' => __( 'Plugin Settings Menus', 'map-location-picker-at-checkout-for-woocommerce' ),
'text' => sprintf( __( 'These are the different setting menus for the plugin. You can check them out %1$slater%2$s, to first get started with LPAC, you need to enter a %1$sGoogle Maps API Key%2$s on this %1$sGeneral Settings%2$s page.', 'map-location-picker-at-checkout-for-woocommerce' ), '<strong>', '</strong>', '<br/>' ),
'text' => sprintf( __( 'These are the different setting menus for the plugin. You can check them out %1$slater%2$s, to first get started with Kikote, you need to enter a %1$sGoogle Maps API Key%2$s on this %1$sGeneral Settings%2$s page.', 'map-location-picker-at-checkout-for-woocommerce' ), '<strong>', '</strong>', '<br/>' ),
'icon_class' => 'dashicons-menu-alt3',
'width' => 350,
'next' => $prefix . '_google_maps_api_key',
Expand All @@ -69,7 +51,7 @@ function create_onboarding_pointers( $pointers, $prefix ) {
$prefix . '_google_maps_api_key' => array(
'selector' => '#lpac_google_maps_api_key',
'title' => __( 'Enter Your API Key', 'map-location-picker-at-checkout-for-woocommerce' ),
'text' => sprintf( __( "The documentation for acquiring your Google Maps API Key can be found %1\$sHERE%2\$s. Once you've entered and saved your API Key; feel free to fine-tune LPAC's settings.%3\$s%3\$s %4\$sNOTE:%5\$s The plugin will NOT work without an API key.", 'map-location-picker-at-checkout-for-woocommerce' ), '<a href="https://lpacwp.com/docs/getting-started/google-cloud-console/getting-your-google-maps-api-key/?utm_source=generaltab&utm_medium=lpacdashboard&utm_campaign=freedocs" target="_blank" style="font-weight:bold;">', '<span style="text-decoration: none" class="dashicons dashicons-external"></span></a>', '</br>', '<strong>', '</strong>' ),
'text' => sprintf( __( "The documentation for acquiring your Google Maps API Key can be found %1\$sHERE%2\$s. Once you've entered and saved your API Key; feel free to fine-tune Kikote's settings.%3\$s%3\$s %4\$sNOTE:%5\$s The plugin will NOT work without an API key.", 'map-location-picker-at-checkout-for-woocommerce' ), '<a href="https://lpacwp.com/docs/getting-started/google-cloud-console/getting-your-google-maps-api-key/?utm_source=generaltab&utm_medium=lpacdashboard&utm_campaign=freedocs" target="_blank" style="font-weight:bold;">', '<span style="text-decoration: none" class="dashicons dashicons-external"></span></a>', '</br>', '<strong>', '</strong>' ),
'icon_class' => 'dashicons-post-status',
'width' => 400,
'jsnext' => "button = jQuery('<a id=\"pointer-close\" class=\"button action\">" . __( 'Finish' ) . "</a>');
Expand Down
22 changes: 12 additions & 10 deletions assets/admin/css/notices.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

.lpac-admin-notice {
background: #fff;
border: 1px solid #fca503;
border-left-width: 4px;
box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
box-shadow: 0 10px 10px rgb(0 0 0 / 4%);
display: block;
margin-bottom: 20px;
margin-top: 30px;
Expand All @@ -21,14 +19,13 @@
content: "";
display: block;
background-image: url("../../img/logo.png");
background-size: 110px 110px;
background-repeat: no-repeat;
background-position: 0 45%;
background-size: contain;
background-position: 0 50%;
width: 130px;
position: absolute;
top: 0;
bottom: 0;
left: 5px;
left: 0;
}

.lpac-notice-title {
Expand All @@ -38,9 +35,8 @@
}

.lpac-notice-body {
font-size: 14px;
font-weight: 500;
margin: 10px 0 30px 0;
font-size: 16px;
font-weight: 400;
}

li#lpac-notice-cta a {
Expand Down Expand Up @@ -74,3 +70,9 @@ li#lpac-notice-dismiss a {
margin-top: 25px;
}
}

@media screen and (max-width: 782px) {
.lpac-notice-logo {
background-repeat: no-repeat;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/admin/img/delivery-and-pickup-scheduling.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions assets/admin/js/lpac-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,18 @@
"select[name^=lpac_places_autocomplete_country_restrictions]"
);
const placesAutoCompleteType = $("#lpac_places_autocomplete_type");
const placesAutoCompleteSearchbox = $(
"#lpac_places_autocomplete_searchbox_in_map"
);
const placesAutoCompleteForced = $("#lpac_force_places_autocomplete");

if (!placesAutoCompleteChecked) {
placesAllowedFields.closest("tr").hide();
placesAutoCompleteHideMap.closest("tr").hide();
placesAutoCompleteCountryRestrictions.closest("tr").hide();
placesAutoCompleteType.closest("tr").hide();
placesAutoCompleteSearchbox.closest("tr").hide();
placesAutoCompleteForced.closest("tr").hide();
}

placesAutoComplete.on("click", () => {
Expand All @@ -163,11 +169,15 @@
placesAutoCompleteHideMap.closest("tr").show();
placesAutoCompleteCountryRestrictions.closest("tr").show();
placesAutoCompleteType.closest("tr").show();
placesAutoCompleteSearchbox.closest("tr").show();
placesAutoCompleteForced.closest("tr").show();
} else {
placesAllowedFields.closest("tr").hide();
placesAutoCompleteHideMap.closest("tr").hide();
placesAutoCompleteCountryRestrictions.closest("tr").hide();
placesAutoCompleteType.closest("tr").hide();
placesAutoCompleteSearchbox.closest("tr").hide();
placesAutoCompleteForced.closest("tr").hide();
}
});
}
Expand Down
Binary file modified assets/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 16 additions & 5 deletions assets/js-modules/set-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,37 @@ export function getNavigatorCoordinates() {
/**
* Bootstrap the functionality of the map.
*
* @param mapOptions the Map options
* @param mapData the data for manipulating the map.
* @returns latLng The latitude and longitude.
* @since 1.7.0
*/
export async function bootstrapMapFunctionality(mapOptions) {
export async function bootstrapMapFunctionality(mapData) {
const position = await getNavigatorCoordinates();
let latLng = "";

if (position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
} else {
console.log(
"Location Picker At Checkout Plugin: Position object is empty. Navigator might be disabled or this site might be detected as insecure."
);
var latitude = mapOptions.lpac_map_default_latitude;
var longitude = mapOptions.lpac_map_default_longitude;

const currentZoom = mapData.map.getZoom();
if (currentZoom < 13) {
mapData.map.setZoom(13);
}

// Make sure a user is able to select their location on the map when they have blocked access to their location.
listenToMapClicks(mapData);
listenToMapDrag(mapData);

/**
* We're setting this to '' so that we can force the user to make use of the map if the option is enabled.
* So that if we do not receive a location, the user can enter one manually.
*
* Note that doing this means we have to be sure to add the event listeners for drag and click to the map when
*
*/
return (latLng = {
lat: "",
Expand All @@ -94,7 +105,7 @@ export async function bootstrapMapFunctionality(mapOptions) {
* @param {object} mapData
*/
export async function bootstrapMapFunctionalityJQuery(mapData) {
const latLng = await bootstrapMapFunctionality();
const latLng = await bootstrapMapFunctionality(mapData);

if (latLng.lat !== "" && latLng.lng !== "") {
const map = mapData.map;
Expand Down
10 changes: 10 additions & 0 deletions assets/public/js/maps/base-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ if (
clickableIcons: mapOptions.lpac_map_clickable_icons,
backgroundColor: mapOptions.lpac_map_background_color, //loading background color
mapId: google_map_id,
// If the option is in the array then that means we want to hide it. So we need to negate the outcome to get the correct behaviour.
mapTypeControl: mapOptions.disabled_map_controls
? !mapOptions.disabled_map_controls.includes("maptype")
: true,
zoomControl: mapOptions.disabled_map_controls
? !mapOptions.disabled_map_controls.includes("zoom")
: true,
fullscreenControl: mapOptions.disabled_map_controls
? !mapOptions.disabled_map_controls.includes("fullscreen")
: true,
};

/**
Expand Down
20 changes: 10 additions & 10 deletions assets/public/js/maps/checkout-page-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ const find_location_btn = document.querySelector("#lpac-find-location-btn");
const places_autocomplete_used = document.querySelector(
"#lpac_places_autocomplete"
);

if (typeof find_location_btn !== "undefined" && find_location_btn !== null) {
find_location_btn.addEventListener("click", async () => {
const latLng = await bootstrapMapFunctionality(mapOptions);
let mapData = {
map,
mapOptions,
marker,
infowindow,
};

const latLng = await bootstrapMapFunctionality(mapData);

if (latLng.lat !== "" && latLng.lng !== "") {
const geocodeResults = await geocodeCoordinates(latLng, map);
const mapData = {
map,
mapOptions,
marker,
latLng,
infowindow,
geocodeResults,
};
mapData["latLng"] = latLng;
mapData["geocodeResults"] = geocodeResults;
setupMap(mapData);
fillAllAddressFields(geocodeResults);
}
Expand Down
7 changes: 3 additions & 4 deletions bin/freemius-prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

# Start fresh
rm -rf dist
rm -rf artifact
rm lpac.zip
rm -rf artifact-kikote

# Make our directories
mkdir -p dist
mkdir -p artifact
mkdir -p artifact-kikote

# Remove vendor folder so we can redownload without dev dependencies.
rm -rf vendor
Expand All @@ -32,7 +31,7 @@ npm run build
rsync -acvP --delete --exclude-from=".distignore" ./ "./dist"

#Change to our dist folder and zip to artifact folder
(cd dist && zip -r ../artifact/lpac.zip .)
(cd dist && zip -r ../artifact-kikote/map-location-picker-at-checkout-for-woocommerce.zip .)

# Delete dist folder
rm -rf dist
Expand Down
6 changes: 3 additions & 3 deletions bin/github-lite-prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

# Start fresh
rm -rf dist
rm -rf artifact
rm -rf artifact-kikote
rm lpac.zip

# Make our directories
mkdir -p dist
mkdir -p artifact
mkdir -p artifact-kikote

# Remove dev dependencies
composer install --no-dev
Expand All @@ -26,7 +26,7 @@ npm run format
rsync -acvP --delete --exclude-from=".distignore-github-lite" ./ "./dist"

#Change to our dist folder and zip to artifact folder
(cd dist && zip -r ../artifact/lpac.zip .)
(cd dist && zip -r ../artifact-kikote/lpac.zip .)

# Delete dist folder
rm -rf dist
Expand Down
1 change: 1 addition & 0 deletions class-lpac-uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public static function remove_plugin_settings() {
'lpac_view_order_page_map_id',
'lpac_checkout_page_map_id',
'lpac_checkout_page_map_default_view',
'kikote_disabled_map_controls',
// Store Locations
'lpac_store_locations_cords',
'lpac_store_locations_labels',
Expand Down
4 changes: 2 additions & 2 deletions includes/Bootstrap/Frontend_Enqueues.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public function enqueue_scripts()
// -------------
// Output plugin version to console
// -------------
$plugin_type = ( defined( 'LPAC_PLUGIN_PATH_URL_PRO' ) ? 'PRO' : 'Free' );
wp_add_inline_script( $this->plugin_name, "\n\t\t\tconsole.log('Location Picker at Checkout version {$plugin_type}: {$this->version}');\n\t\t\t" );
$plugin_type = ( LPAC_IS_PREMIUM_VERSION ? 'PRO' : 'Free' );
wp_add_inline_script( $this->plugin_name, "\n\t\t\tconsole.log('Kikote - Location Picker at Checkout for WooCommerce {$plugin_type}: v{$this->version}');\n\t\t\t" );
// --------------
// --------------
/**
Expand Down
2 changes: 0 additions & 2 deletions includes/Bootstrap/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class Loader {
* The array of actions registered with WordPress.
*
* @since 1.0.0
* @access protected
* @var array $actions The actions registered with WordPress to fire when the plugin loads.
*/
protected $actions;
Expand All @@ -36,7 +35,6 @@ class Loader {
* The array of filters registered with WordPress.
*
* @since 1.0.0
* @access protected
* @var array $filters The filters registered with WordPress to fire when the plugin loads.
*/
protected $filters;
Expand Down
18 changes: 11 additions & 7 deletions includes/Bootstrap/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,13 @@ private function define_public_hooks()
/*
* Output map on checkout page
*/
$checkout_page_map_location = get_option( 'lpac_checkout_map_orientation', 'woocommerce_before_checkout_billing_form' );
$checkout_page_map_location = apply_filters( 'lpac_checkout_map_orientation', $checkout_page_map_location );
$this->loader->add_action( $checkout_page_map_location, $plugin_public_display, 'output_map_on_checkout_page' );
add_action( 'plugins_loaded', function () {
$checkout_page_map_location = get_option( 'lpac_checkout_map_orientation', 'woocommerce_checkout_before_customer_details' );
$checkout_page_map_location = apply_filters( 'lpac_checkout_map_orientation', $checkout_page_map_location );
$class = new \Lpac\Views\Frontend\Frontend();
$priority = apply_filters( 'kikote_checkout_map_orientation_filter_priority', 9 );
add_action( $checkout_page_map_location, array( $class, 'output_map_on_checkout_page' ), $priority );
} );
/*
* Translated alert strings for checkout page.
*/
Expand Down Expand Up @@ -502,7 +506,7 @@ public function create_admin_menu() : void

add_menu_page(
__( 'SoaringLeads Plugins', 'map-location-picker-at-checkout-for-woocommerce' ),
'SL Plugins',
'SoaringLeads',
'manage_options',
'sl-plugins-menu',
array( $this, 'output_root_submenu_upsells' ),
Expand All @@ -521,8 +525,8 @@ public function create_submenu() : void
{
add_submenu_page(
'sl-plugins-menu',
'Kikote- Location Picker at Checkout',
'Kikote- Location Picker at Checkout',
'Kikote - Location Picker at Checkout',
'Kikote - Location Picker at Checkout',
'manage_options',
'lpac-menu',
array( $this, 'menu_item_html' ),
Expand All @@ -544,7 +548,7 @@ public function menu_item_html()
}

/**
* HTML for root SL Plugins page.
* HTML for root SoaringLeads page.
*
* Populate with upsell content.
*
Expand Down
Loading

0 comments on commit 2f16b90

Please sign in to comment.