@myapihq/cli 2.19.0 → 2.19.1
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/dist/commands/feedback.js +40 -3
- package/package.json +2 -2
|
@@ -240,13 +240,14 @@ export async function widget(sub, arg, flags) {
|
|
|
240
240
|
const origins = typeof flags.origins === 'string'
|
|
241
241
|
? flags.origins.split(',').map(s => s.trim()).filter(Boolean)
|
|
242
242
|
: undefined;
|
|
243
|
-
const w = await sdkFeedback.createWidget(config.api_key, orgId, arg, origins);
|
|
243
|
+
const w = await sdkFeedback.createWidget(config.api_key, orgId, arg, origins, _captureFrom(flags));
|
|
244
244
|
if (flags.json) {
|
|
245
245
|
printJson(w);
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
248
|
success(`Widget created: ${w.id}`);
|
|
249
249
|
info(`Key: ${w.key}`);
|
|
250
|
+
info(`Capture: ${captureLine(w.capture)}`);
|
|
250
251
|
info('');
|
|
251
252
|
// Saying this plainly matters: a value that looks like a credential and is
|
|
252
253
|
// not one gets treated as a secret, and then nobody puts it in the page.
|
|
@@ -282,6 +283,10 @@ export async function widget(sub, arg, flags) {
|
|
|
282
283
|
.filter(Boolean).join(' · ')}`);
|
|
283
284
|
}
|
|
284
285
|
info(` origins: ${w.allowed_origins?.length ? w.allowed_origins.join(', ') : '(any — anyone can post with this key)'}`);
|
|
286
|
+
// Listed for the same reason position and label are: the only other way
|
|
287
|
+
// to read it back was to fetch widget.js and read the JavaScript, which
|
|
288
|
+
// ImmoPilot reported once already.
|
|
289
|
+
info(` capture: ${captureLine(w.capture)}`);
|
|
285
290
|
info('');
|
|
286
291
|
}
|
|
287
292
|
return;
|
|
@@ -303,8 +308,36 @@ export async function widget(sub, arg, flags) {
|
|
|
303
308
|
}
|
|
304
309
|
if (Object.keys(theme).length)
|
|
305
310
|
patch.theme = theme;
|
|
311
|
+
// Read-modify-write, because the backend REPLACES `capture` rather than
|
|
312
|
+
// merging it. Verified against production 2026-08-20: set
|
|
313
|
+
// {screenshot:false, text:false}, PATCH {text:true}, and screenshot comes
|
|
314
|
+
// back TRUE. Only the capture object behaves this way — a name-only PATCH
|
|
315
|
+
// leaves it untouched — so the request as a whole merges and this field
|
|
316
|
+
// does not.
|
|
317
|
+
//
|
|
318
|
+
// --help and the skill both promise "omitted flags are left alone". Sending
|
|
319
|
+
// the partial object would make `--no-text` silently switch screenshots
|
|
320
|
+
// back ON for a widget that had them off: the exact harm this feature
|
|
321
|
+
// exists to prevent, on the pages it was built for.
|
|
322
|
+
//
|
|
323
|
+
// Remove once the backend merges (cross-repo prompt, 2026-08-20): then
|
|
324
|
+
// `patch.capture = capture` stands alone and the extra read disappears.
|
|
325
|
+
const capture = _captureFrom(flags);
|
|
326
|
+
if (capture) {
|
|
327
|
+
patch.capture = capture;
|
|
328
|
+
try {
|
|
329
|
+
const current = (await sdkFeedback.listWidgets(config.api_key, orgId)).find(x => x.id === arg);
|
|
330
|
+
if (current?.capture)
|
|
331
|
+
patch.capture = { ...current.capture, ...capture };
|
|
332
|
+
}
|
|
333
|
+
catch {
|
|
334
|
+
// A failed read must not block the change that was asked for. The
|
|
335
|
+
// operator still gets what they typed, and the resolved state printed
|
|
336
|
+
// after the call is the truth either way.
|
|
337
|
+
}
|
|
338
|
+
}
|
|
306
339
|
if (Object.keys(patch).length === 0) {
|
|
307
|
-
error('Nothing to change. Pass at least one of --routes, --origins, --name, --accent, --position, --label.');
|
|
340
|
+
error('Nothing to change. Pass at least one of --routes, --origins, --name, --accent, --position, --label, --screenshot/--no-screenshot, --text/--no-text.');
|
|
308
341
|
}
|
|
309
342
|
const w = await sdkFeedback.updateWidget(config.api_key, orgId, arg, patch);
|
|
310
343
|
if (flags.json) {
|
|
@@ -312,9 +345,13 @@ export async function widget(sub, arg, flags) {
|
|
|
312
345
|
return;
|
|
313
346
|
}
|
|
314
347
|
success(`Widget ${arg} updated`);
|
|
348
|
+
// Resolved by the server: both fields, whatever was sent. Print it so the
|
|
349
|
+
// operator sees what the widget will DO, not what they happened to type.
|
|
350
|
+
if (w.capture)
|
|
351
|
+
info(` capture: ${captureLine(w.capture)}`);
|
|
315
352
|
// The key is unchanged, which is the reason to use this instead of
|
|
316
353
|
// revoke + create — the customer's page does not need editing.
|
|
317
|
-
info('Same key, so your page needs no change. Route changes reach browsers within ~5 minutes.');
|
|
354
|
+
info('Same key, so your page needs no change. Route and capture changes reach browsers within ~5 minutes, with no redeploy of your site.');
|
|
318
355
|
return;
|
|
319
356
|
}
|
|
320
357
|
if (sub === 'revoke') {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myapihq/cli",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.19.
|
|
4
|
+
"version": "2.19.1",
|
|
5
5
|
"description": "MyAPI command-line interface",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"lint:skills:strict": "node scripts/copy-skills.js && node scripts/lint-skills.js --strict"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@myapihq/sdk": "^2.19.
|
|
49
|
+
"@myapihq/sdk": "^2.19.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^25.6.0",
|