From 0113d2e9c9ff34a6ffb10707cc76d34b67a0c367 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 19 Jan 2026 16:29:41 +0000
Subject: [PATCH] =Refactored window.getTemplate into a full templating class window.jvbTemplates. Refactored CRUD.js, UploadManager.js, FormController.js, PopulateForm.js with that in mind

---
 inc/integrations/Square.php |   32 +++++++++++++-------------------
 1 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/inc/integrations/Square.php b/inc/integrations/Square.php
index ca3a7aa..121a74f 100644
--- a/inc/integrations/Square.php
+++ b/inc/integrations/Square.php
@@ -379,8 +379,6 @@
 	 */
 	protected function exchangeOAuthCode(string $code): ?array
 	{
-		error_log('Exchanging tokens with credentials: '.print_r($this->credentials, true));
-
 		$this->ensureInitialized();
 
 		// Prepare the request body as an array
@@ -406,7 +404,6 @@
 		}
 
 		$data = json_decode(wp_remote_retrieve_body($response), true);
-		error_log('OAuth Response: '.print_r($data, true));
 		if (isset($data['access_token'])) {
 			return [
 				'access_token' => $data['access_token'],
@@ -468,7 +465,6 @@
 
 		$data = json_decode(wp_remote_retrieve_body($response), true);
 
-		error_log('RefreshAccessToken Response: '.print_r($data, true));
 		if (isset($data['access_token'])) {
 			$this->credentials['access_token'] = $data['access_token'];
 			$this->credentials['expires_at'] = time() + ($data['expires_in'] ?? 2592000); // 30 days
@@ -491,7 +487,6 @@
 	{
 		// Skip if we don't have credentials yet (during OAuth flow)
 		if (empty($this->credentials['access_token'])) {
-			error_log('[Square] Skipping loadLocations - no access token yet');
 			return;
 		}
 		try {
@@ -863,7 +858,7 @@
 			return $actions;
 		}
 		$meta = new MetaForm();
-		$form = '<aside id="cart" class="right">
+		$form = '<aside id="cart" class="right main">
 			<form id="checkout" data-form-id="checkout" data-save="checkout">';
 
 				$tabs = [
@@ -949,11 +944,11 @@
 					<label for="quantity"></label>
 					<div class="quantity field" data-min="0" data-max="50" data-step="1" data-price="17" data-id="">
 
-						<button type="button" class="decrease"aria-label="Decrease Add to Order">'.jvbIcon('minus').'</button>
+						<button type="button" class="decrease"aria-label="Decrease Add to Order">'.jvbIcon('minus-square').'</button>
 
 						<input type="number" id="quantity" name="quantity" value="0" min="0" max="50" step="1" class="quantity-input">
 
-						<button type="button" class="increase" aria-label="Increase Add to Order">'.jvbIcon('add').'</button>
+						<button type="button" class="increase" aria-label="Increase Add to Order">'.jvbIcon('plus-square').'</button>
 					</div>
 				</td>
 				<td class="price">
@@ -977,7 +972,7 @@
 
 		$actions[] = [
 			'button' => 	'<button type="button" class="toggle-cart row" title="Your Cart" data-action="toggle-cart" aria-label="Open Cart" aria-controls="checkout" aria-expanded="false">
-					'.jvbIcon('cart').'<span class="abs"></span><span class="abs count"></span>
+					'.jvbIcon('shopping-cart').'<span class="abs"></span><span class="abs count"></span>
 				</button>',
 			'content' =>	$form
 		];
@@ -1083,7 +1078,6 @@
 	 */
 	protected function handleTheSavePost(int $postID, \WP_Post $post, bool $update, array $settings): void
 	{
-		error_log('Queuing Sync to Square');
 		// Queue the sync operation
 		$this->queueOperation('sync_to_square', [
 			'items' => [$postID],
@@ -1849,20 +1843,22 @@
 
 		$message = sprintf(
 			"Welcome to %s!\n\n" .
-			"Your account has been created. Please click the link below to set your password:\n\n" .
+			"Your account has been created. Please click the button below to set your password:\n\n" .
 			"%s\n\n" .
-			"Once you've set your password, you can log in to:\n" .
+			"Or, copy and paste the link below:\n\n".
+			"%s\n\n" .
+			"Once you've set your password, you can:\n" .
 			"- View your order history\n" .
 			"- Save your favorite items\n" .
 			"- Speed up checkout with saved payment methods\n\n" .
 			"If you didn't create this account, please ignore this email.\n\n" .
-			"Thanks,\n%s",
+			"Thanks,\n",
 			$site_name,
-			$reset_url,
-			$site_name
+			JVB()->email()->button('Reset Password', $reset_url),
+			JVB()->email()->link($reset_url),
 		);
 
-		jvbMail(
+		JVB()->email()->sendEmail(
 			$user->user_email,
 			sprintf('[%s] Welcome! Set Your Password', $site_name),
 			$message
@@ -1906,11 +1902,10 @@
 		// Send notification
 		$user = get_user_by('ID', $user_id);
 		if ($user) {
-			wp_mail(
+			JVB()->email()->sendEmail(
 				$user->user_email,
 				'['.get_bloginfo('name').'] Security Code',
 				'For your security, enter this code to continue accessing your account and saved payment methods.',
-				['Content-Type: text/html; charset=UTF-8']
 			);
 		}
 	}
@@ -2808,7 +2803,6 @@
 
 			// Validate environment setting
 			if (isset($credentials['environment'])) {
-				error_log('Environment: '.print_r($credentials['environment'], true));
 				$validEnvironments = ['sandbox', 'production'];
 				if (!in_array($credentials['environment'], $validEnvironments)) {
 					$this->logError('Invalid environment setting', [

--
Gitblit v1.10.0