Add catalog sync trigger, metrics, and shipping label actions to integrations.
Deploy Ladill Woo Manager / deploy (push) Successful in 1m5s

Surfaces actionable controls in Ladill instead of status-only cards: sync catalogs via the plugin proxy, show channel metrics, and link to orders/labels for fulfillment.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-08 11:28:42 +00:00
co-authored by Cursor
parent 1e97f129e9
commit 644c3d9cde
7 changed files with 305 additions and 2 deletions
@@ -58,6 +58,60 @@ class IntegrationStatusService
Cache::forget($this->cacheKey($store));
}
/**
* @return array{success: bool, message: string}
*/
public function syncCatalog(?WooStore $store, string $key): array
{
$catalog = config('woo_integrations', []);
if (! $store) {
return [
'success' => false,
'message' => 'Connect a store before syncing catalogs.',
];
}
if (! isset($catalog[$key]) || ! ($catalog[$key]['supports_catalog_sync'] ?? false)) {
return [
'success' => false,
'message' => 'Catalog sync is not available for this integration.',
];
}
$response = $this->client->postWithDetails($store, 'integrations/'.$key.'/sync');
if (! $response['reachable']) {
return [
'success' => false,
'message' => 'Could not reach your store. Check that the Ladill plugin is active.',
];
}
$body = $response['body'] ?? [];
if (! $response['successful']) {
return [
'success' => false,
'message' => (string) ($body['message'] ?? 'Catalog sync could not be started.'),
];
}
if (! ($body['success'] ?? false)) {
return [
'success' => false,
'message' => (string) ($body['message'] ?? 'Catalog sync could not be started.'),
];
}
$this->forgetCache($store);
return [
'success' => true,
'message' => (string) ($body['message'] ?? 'Catalog sync started on your store.'),
];
}
/**
* @param array<string, array<string, mixed>> $catalog
* @return array{
@@ -113,6 +167,9 @@ class IntegrationStatusService
'category' => (string) ($meta['category'] ?? 'Integration'),
'install_url' => $meta['install_url'] ?? null,
'docs_url' => $meta['docs_url'] ?? null,
'supports_catalog_sync' => (bool) ($meta['supports_catalog_sync'] ?? false),
'supports_metrics' => (bool) ($meta['supports_metrics'] ?? false),
'supports_label_actions' => (bool) ($meta['supports_label_actions'] ?? false),
'state' => $state,
'installed' => (bool) ($remoteStatus['installed'] ?? false),
'connected' => (bool) ($remoteStatus['connected'] ?? false),
@@ -121,6 +178,7 @@ class IntegrationStatusService
: 'Could not reach your store. Check that the Ladill plugin is active.',
'manage_url' => is_string($manageUrl) && $manageUrl !== '' ? $manageUrl : null,
'details' => is_array($remoteStatus['details'] ?? null) ? $remoteStatus['details'] : [],
'metrics' => is_array($remoteStatus['metrics'] ?? null) ? $remoteStatus['metrics'] : [],
];
}
@@ -140,12 +198,16 @@ class IntegrationStatusService
'category' => (string) ($meta['category'] ?? 'Integration'),
'install_url' => $meta['install_url'] ?? null,
'docs_url' => $meta['docs_url'] ?? null,
'supports_catalog_sync' => (bool) ($meta['supports_catalog_sync'] ?? false),
'supports_metrics' => (bool) ($meta['supports_metrics'] ?? false),
'supports_label_actions' => (bool) ($meta['supports_label_actions'] ?? false),
'state' => 'no_store',
'installed' => false,
'connected' => false,
'summary' => 'Connect a WooCommerce store to see status.',
'manage_url' => null,
'details' => [],
'metrics' => [],
];
}