@velaro/cli 1.4.137 → 1.4.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/magento.js +4 -3
- package/package.json +1 -1
package/lib/commands/magento.js
CHANGED
|
@@ -78,7 +78,7 @@ ${RED}✗ Connection failed: ${e.message}${RST}
|
|
|
78
78
|
async function resolveConfigId(argv) {
|
|
79
79
|
if (argv.configId) return argv.configId;
|
|
80
80
|
const stores = await request('GET', '/Magento/Configs');
|
|
81
|
-
const active = (Array.isArray(stores) ? stores : []).find((s) => s.isActive);
|
|
81
|
+
const active = (Array.isArray(stores) ? stores : []).find((s) => s.isActive && s.enabled !== false);
|
|
82
82
|
if (!active) throw new Error('No active Magento store connected for this site.');
|
|
83
83
|
return active.id;
|
|
84
84
|
}
|
|
@@ -92,14 +92,15 @@ async function customersHandler(argv) {
|
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
const configId = await resolveConfigId(argv);
|
|
95
|
-
const
|
|
95
|
+
const found = await request('GET', `/Magento/Customers/Search?configId=${configId}&query=${encodeURIComponent(argv.email)}`);
|
|
96
|
+
const r = Array.isArray(found) ? found[0] : found;
|
|
96
97
|
if (!r || !r.id) {
|
|
97
98
|
console.log(`\nNo customer found for ${argv.email}.\n`);
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
101
|
console.log(`\n${BOLD}Magento Customer${RST}\n`);
|
|
101
102
|
console.log(` ID: ${r.id}`);
|
|
102
|
-
console.log(` Name: ${r.name ?? '(none)'}`);
|
|
103
|
+
console.log(` Name: ${r.name ?? ([r.firstName, r.lastName].filter(Boolean).join(' ') || '(none)')}`);
|
|
103
104
|
console.log(` Email: ${CYN}${r.email}${RST}`);
|
|
104
105
|
console.log(` Group: ${r.group ?? r.groupId ?? 'General'}`);
|
|
105
106
|
console.log('');
|
package/package.json
CHANGED