From b0194e10a87e16797a568d8a30d53ebecd27d8a4 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sat, 18 Oct 2025 15:04:51 +0000
Subject: [PATCH] =DataStore.js and UploaderManager.js overhaul

---
 inc/integrations/Square.php |   79 ++++++++++++++++++++-------------------
 1 files changed, 41 insertions(+), 38 deletions(-)

diff --git a/inc/integrations/Square.php b/inc/integrations/Square.php
index a7b5451..4eb7b1c 100644
--- a/inc/integrations/Square.php
+++ b/inc/integrations/Square.php
@@ -717,24 +717,21 @@
 		// User login tracking for security
 		add_action('wp_login', [$this, 'trackUserLogin'], 10, 2);
 
-		add_action('wp_footer', [$this, 'outputCheckout']);
+		add_action('jvbAdditionalActions', [$this, 'outputCheckout']);
 
 		// Enqueue checkout scripts
 		add_action('wp_enqueue_scripts', [$this, 'enqueueScripts']);
 	}
 
 
-	public function outputCheckout():void {
+	public function outputCheckout(array $actions):array {
 		if (is_singular(BASE.'dash') || is_post_type_archive(BASE.'dash')) {
-			return;
+			return $actions;
 		}
-		?>
-		<button type="button" class="toggle-cart row" title="Your Cart" data-action="toggle-cart" aria-label="Open Cart" aria-controls="checkout" aria-expanded="false" hidden>
-			<?= jvbIcon('cart')?><span class="abs"></span><span class="abs count"></span>
-		</button>
-		<aside id="cart">
-			<form id="checkout" data-form-id="checkout" data-save="checkout">
-				<?php
+
+		$form = '<aside id="cart" class="right">
+			<form id="checkout" data-form-id="checkout" data-save="checkout">';
+
 				$tabs = [
 					'cartItems' => [
 						'title'	=> 'Your Order',
@@ -743,10 +740,10 @@
 						'content'	=> $this->cartContent()
 					],
 					'checkout'	=> [
-						'title'	=> 'Checkout',
-						'icon'	=> 'checkout',
-						'description' => 'Securely checkout with your name, email, and payments processed by Square.',
-						'content'	=> '<div class="checkout-section">
+			'title'	=> 'Checkout',
+			'icon'	=> 'checkout',
+			'description' => 'Securely checkout with your name, email, and payments processed by Square.',
+			'content'	=> '<div class="checkout-section">
 								<h3>Customer Information</h3>
 
 								<input type="text" name="name" placeholder="Full Name" required autocomplete="name">
@@ -762,29 +759,28 @@
 								<div id="saved-cards"></div>
 								<div id="square-card-container"></div>
 							</div>'
-					],
+		],
 					'order'	=> [
-						'title'	=> 'Your Order',
-						'icon' => 'truck',
-						'hidden'	=> true,
-						'description' => '',
-						'content'	=> $this->renderOrderStatus()
-					]
+			'title'	=> 'Your Order',
+			'icon' => 'truck',
+			'hidden'	=> true,
+			'description' => '',
+			'content'	=> $this->renderOrderStatus()
+		]
 				];
-				jvbRenderTabs($tabs);
-				?>
+		$form .= jvbRenderTabs($tabs);
 
-				<div class="cart-total row end"><p class="tax">Tax: <span></span></p><p class="total">GRAND TOTAL: <span></span></p></div>
-			</form>
+		$form .= '<div class="cart-total row end"><p class="tax">Tax: <span></span></p><p class="total">GRAND TOTAL: <span></span></p></div>
+		</form>
 		</aside>
 		<template class="restoredCart">
 			<div class="restored">
 				<h3>Looks like we left things hanging</h3>
-				<p>We've restored your cart from your last session below.</p>
-				<p>If you'd rather start over, click the button below.</p>
+				<p>We\'ve restored your cart from your last session below.</p>
+				<p>If you\'d rather start over, click the button below.</p>
 				<div class="row btw">
-					<button type="button" onclick="window.squareCheckout.clearCart();this.closest('.restored').remove()"><?=jvbIcon('trash')?>Clear Cart</button>
-					<button type="button" onclick="this.closest('.restored').remove()"><?= jvbIcon('x')?>Dismiss</button>
+					<button type="button" onclick="window.squareCheckout.clearCart();this.closest(\'.restored\').remove()">'.jvbIcon('trash').'Clear Cart</button>
+					<button type="button" onclick="this.closest(\'.restored\').remove()">'.jvbIcon('x').'Dismiss</button>
 				</div>
 			</div>
 		</template>
@@ -794,13 +790,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">
-							<i class="icon minus"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36Zm4,172a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-40-80a4,4,0,0,1-4,4H88a4,4,0,0,1,0-8h80A4,4,0,0,1,172,128Z"></path></svg></i>				 </button>
+						<button type="button" class="decrease"aria-label="Decrease Add to Order">'.jvbIcon('minus').'</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">
-							<i class="icon add"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M208,36H48A12,12,0,0,0,36,48V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V48A12,12,0,0,0,208,36Zm4,172a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Zm-40-80a4,4,0,0,1-4,4H132v36a4,4,0,0,1-8,0V132H88a4,4,0,0,1,0-8h36V88a4,4,0,0,1,8,0v36h36A4,4,0,0,1,172,128Z"></path></svg></i>				 </button>
+						<button type="button" class="increase" aria-label="Increase Add to Order">'.jvbIcon('add').'</button>
 					</div>
 				</td>
 				<td class="price">
@@ -810,17 +804,25 @@
 					<span class="total"></span>
 				</td>
 				<td>
-					<button type="button" data-remove-from-cart><?= jvbIcon('trash')?></button>
+					<button type="button" data-remove-from-cart>'.jvbIcon('trash').'</button>
 				</td>
 			</tr>
 		</template>
 		<template class="emptyCart">
 			<div class="empty">
 				<p><i><b>No items in cart.</b></i></p>
-				<p>You can <a href="<?= get_post_type_archive_link(BASE.'menu_item')?>" title="Browse our menu">browse our menu</a> to order.</p>
+				<p>You can <a href="'.get_post_type_archive_link(BASE.'menu_item').'" title="Browse our menu">browse our menu</a> to order.</p>
 			</div>
-		</template>
-		<?php
+		</template>';
+
+
+		$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" hidden>
+					'.jvbIcon('cart').'<span class="abs"></span><span class="abs count"></span>
+				</button>',
+			'content' =>	$form
+		];
+		return $actions;
 	}
 
 	private function cartContent():string
@@ -1684,7 +1686,7 @@
 	private function sendWelcomeEmail(\WP_User $user, string $reset_key): void
 	{
 		$site_name = get_bloginfo('name');
-		$reset_url = get_home_url(2, "wp-login.php?action=rp&key=$reset_key&login=" . rawurlencode($user->user_login), 'login');
+		$reset_url = get_home_url(null, "wp-login.php?action=rp&key=$reset_key&login=" . rawurlencode($user->user_login), 'login');
 
 		$message = sprintf(
 			"Welcome to %s!\n\n" .
@@ -1939,6 +1941,7 @@
 				'jvb-cache',
 				'jvb-tabs',
 				'jvb-modal',
+				'jvb-popup'
 			],
 			'1.0.0',
 			[

--
Gitblit v1.10.0