@algolia/wizard 0.35.0-rc.126.250 → 0.36.0
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/main.js +106 -19
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -3275,7 +3275,7 @@ async function runAnalysis(mode, extraInstructions = []) {
|
|
|
3275
3275
|
// package.json
|
|
3276
3276
|
var package_default = {
|
|
3277
3277
|
name: "@algolia/wizard",
|
|
3278
|
-
version: "0.
|
|
3278
|
+
version: "0.36.0",
|
|
3279
3279
|
description: "Magically implement Algolia functionality in your codebase",
|
|
3280
3280
|
type: "module",
|
|
3281
3281
|
engines: {
|
|
@@ -4529,7 +4529,12 @@ var defaultWorkflow = {
|
|
|
4529
4529
|
id: "project-scan",
|
|
4530
4530
|
title: "project scan",
|
|
4531
4531
|
outputSchema: projectScanSchema,
|
|
4532
|
-
tips: [
|
|
4532
|
+
tips: [
|
|
4533
|
+
"apps-and-indices",
|
|
4534
|
+
"records-are-json",
|
|
4535
|
+
"speed",
|
|
4536
|
+
"searchable-attributes"
|
|
4537
|
+
],
|
|
4533
4538
|
run: (ctx) => {
|
|
4534
4539
|
ctx.notify({
|
|
4535
4540
|
messages: [
|
|
@@ -4565,7 +4570,7 @@ var defaultWorkflow = {
|
|
|
4565
4570
|
id: "ingestion",
|
|
4566
4571
|
title: "ingest records",
|
|
4567
4572
|
outputSchema: implementSchema,
|
|
4568
|
-
tips: ["
|
|
4573
|
+
tips: ["facets", "test-relevance", "search-analytics", "recommend"],
|
|
4569
4574
|
run: (ctx) => {
|
|
4570
4575
|
ctx.notify({
|
|
4571
4576
|
messages: [
|
|
@@ -4586,13 +4591,7 @@ var defaultWorkflow = {
|
|
|
4586
4591
|
id: "search",
|
|
4587
4592
|
title: "create search ui",
|
|
4588
4593
|
outputSchema: implementSchema,
|
|
4589
|
-
tips: [
|
|
4590
|
-
"test-relevance",
|
|
4591
|
-
"search-analytics",
|
|
4592
|
-
"recommend",
|
|
4593
|
-
"searchable-attributes",
|
|
4594
|
-
"facets"
|
|
4595
|
-
],
|
|
4594
|
+
tips: ["typo-tolerance", "synonyms", "multi-index-search", "rules"],
|
|
4596
4595
|
run: (ctx) => {
|
|
4597
4596
|
ctx.notify({
|
|
4598
4597
|
messages: ["Building your Algolia search experience\u2026"]
|
|
@@ -5096,7 +5095,7 @@ function Logs() {
|
|
|
5096
5095
|
}
|
|
5097
5096
|
|
|
5098
5097
|
// src/ui/Tips.tsx
|
|
5099
|
-
import { useEffect as useEffect3, useState as useState8 } from "react";
|
|
5098
|
+
import { useEffect as useEffect3, useRef as useRef4, useState as useState8 } from "react";
|
|
5100
5099
|
import { Box as Box18, Text as Text18 } from "ink";
|
|
5101
5100
|
import terminalLink from "terminal-link";
|
|
5102
5101
|
|
|
@@ -5120,7 +5119,7 @@ function highlightJson(json) {
|
|
|
5120
5119
|
return /* @__PURE__ */ jsx15(Text17, { color: "yellow", children: part }, i);
|
|
5121
5120
|
}
|
|
5122
5121
|
if (/^[{}[\]:,]$/.test(part)) {
|
|
5123
|
-
return /* @__PURE__ */ jsx15(Text17, {
|
|
5122
|
+
return /* @__PURE__ */ jsx15(Text17, { color: COLORS.dim, children: part }, i);
|
|
5124
5123
|
}
|
|
5125
5124
|
return /* @__PURE__ */ jsx15(Text17, { children: part }, i);
|
|
5126
5125
|
});
|
|
@@ -5253,6 +5252,70 @@ var tips = [
|
|
|
5253
5252
|
}
|
|
5254
5253
|
]
|
|
5255
5254
|
},
|
|
5255
|
+
{
|
|
5256
|
+
id: "typo-tolerance",
|
|
5257
|
+
title: "Your users will misspell things. Algolia already handles it.",
|
|
5258
|
+
chunks: [
|
|
5259
|
+
{
|
|
5260
|
+
type: "text",
|
|
5261
|
+
value: 'Typo tolerance is on out of the box. Someone searching "rstaurnt" still gets restaurants.'
|
|
5262
|
+
},
|
|
5263
|
+
{
|
|
5264
|
+
type: "text",
|
|
5265
|
+
value: "Exact matches always rank above one-typo matches, which rank above two."
|
|
5266
|
+
}
|
|
5267
|
+
]
|
|
5268
|
+
},
|
|
5269
|
+
{
|
|
5270
|
+
id: "synonyms",
|
|
5271
|
+
title: "Synonyms teach the engine your words",
|
|
5272
|
+
chunks: [
|
|
5273
|
+
{
|
|
5274
|
+
type: "text",
|
|
5275
|
+
value: "Pants, trousers, slacks: one synonym entry and all three find each other."
|
|
5276
|
+
},
|
|
5277
|
+
{
|
|
5278
|
+
type: "text",
|
|
5279
|
+
value: 'One-way synonyms go further. "tablet" can find iPad without iPad returning every tablet.'
|
|
5280
|
+
},
|
|
5281
|
+
{
|
|
5282
|
+
type: "text",
|
|
5283
|
+
value: 'And a placeholder like "Case for iPhone <model>" covers a whole product line without duplicating records.'
|
|
5284
|
+
}
|
|
5285
|
+
]
|
|
5286
|
+
},
|
|
5287
|
+
{
|
|
5288
|
+
id: "multi-index-search",
|
|
5289
|
+
title: "One search box, many indices",
|
|
5290
|
+
chunks: [
|
|
5291
|
+
{
|
|
5292
|
+
type: "text",
|
|
5293
|
+
value: "Federated search queries several indices at once, so a single dropdown can show products, categories and articles side by side."
|
|
5294
|
+
},
|
|
5295
|
+
{
|
|
5296
|
+
type: "text",
|
|
5297
|
+
value: "Each source gets its own layout and its own hit count: 4 categories, 8 products, whatever fits."
|
|
5298
|
+
}
|
|
5299
|
+
]
|
|
5300
|
+
},
|
|
5301
|
+
{
|
|
5302
|
+
id: "rules",
|
|
5303
|
+
title: "Rules let you put a thumb on the scale",
|
|
5304
|
+
chunks: [
|
|
5305
|
+
{
|
|
5306
|
+
type: "text",
|
|
5307
|
+
value: "When a query matches a condition, a Rule can pin a result to the top, hide one, boost a brand or attach a banner."
|
|
5308
|
+
},
|
|
5309
|
+
{
|
|
5310
|
+
type: "text",
|
|
5311
|
+
value: 'A search for "sale" can filter to discounted items. A search for "iphone" can pin your best-selling case.'
|
|
5312
|
+
},
|
|
5313
|
+
{
|
|
5314
|
+
type: "text",
|
|
5315
|
+
value: "The Visual Editor in the dashboard does all of it by drag and drop, no reindex needed."
|
|
5316
|
+
}
|
|
5317
|
+
]
|
|
5318
|
+
},
|
|
5256
5319
|
{
|
|
5257
5320
|
id: "recommend",
|
|
5258
5321
|
title: "Let Algolia act as your recommendation engine",
|
|
@@ -5279,7 +5342,7 @@ function tipsByIds(ids) {
|
|
|
5279
5342
|
import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5280
5343
|
var TICK_MS = 16;
|
|
5281
5344
|
var CHUNK_HOLD_MS = 2e3;
|
|
5282
|
-
var HOLD_MS =
|
|
5345
|
+
var HOLD_MS = 12e3;
|
|
5283
5346
|
function TipTitle({ children }) {
|
|
5284
5347
|
return /* @__PURE__ */ jsxs16(Box18, { gap: 1, children: [
|
|
5285
5348
|
/* @__PURE__ */ jsx16(Text18, { color: "cyan", children: "\u2726" }),
|
|
@@ -5337,7 +5400,11 @@ function TipContent({
|
|
|
5337
5400
|
) });
|
|
5338
5401
|
}
|
|
5339
5402
|
var progress = { stepId: null, tipIndex: 0, revealed: 0 };
|
|
5340
|
-
function Tips({
|
|
5403
|
+
function Tips({
|
|
5404
|
+
stepId,
|
|
5405
|
+
ids,
|
|
5406
|
+
onRevealStateChange
|
|
5407
|
+
}) {
|
|
5341
5408
|
const tips2 = tipsByIds(ids);
|
|
5342
5409
|
const resuming = progress.stepId === stepId;
|
|
5343
5410
|
if (!resuming) {
|
|
@@ -5368,6 +5435,16 @@ function Tips({ stepId, ids }) {
|
|
|
5368
5435
|
);
|
|
5369
5436
|
if (!skipPause) chunkBoundaries.push(cumulative);
|
|
5370
5437
|
}
|
|
5438
|
+
const revealState = tips2.length === 0 ? "idle" : revealed < totalLength ? "revealing" : "revealed";
|
|
5439
|
+
const onRevealStateChangeRef = useRef4(onRevealStateChange);
|
|
5440
|
+
onRevealStateChangeRef.current = onRevealStateChange;
|
|
5441
|
+
const reportedRef = useRef4(null);
|
|
5442
|
+
useEffect3(() => {
|
|
5443
|
+
if (reportedRef.current === revealState) return;
|
|
5444
|
+
reportedRef.current = revealState;
|
|
5445
|
+
onRevealStateChangeRef.current?.(revealState);
|
|
5446
|
+
}, [revealState]);
|
|
5447
|
+
useEffect3(() => () => onRevealStateChangeRef.current?.("idle"), []);
|
|
5371
5448
|
useEffect3(() => {
|
|
5372
5449
|
if (tips2.length === 0) return;
|
|
5373
5450
|
if (revealed < totalLength) {
|
|
@@ -5417,6 +5494,7 @@ function App() {
|
|
|
5417
5494
|
const { exit } = useApp();
|
|
5418
5495
|
const { columns, rows } = useWindowSize7();
|
|
5419
5496
|
const [showLogs, setShowLogs] = useState9(false);
|
|
5497
|
+
const [tipState, setTipState] = useState9("idle");
|
|
5420
5498
|
const finished = phase === "done" || phase === "error";
|
|
5421
5499
|
const currentStep = steps[currentStepIndex];
|
|
5422
5500
|
const stepDef = workflow ? getWorkflow(workflow.id)?.steps.find((s) => s.id === currentStep?.id) : void 0;
|
|
@@ -5424,9 +5502,11 @@ function App() {
|
|
|
5424
5502
|
const stepHasTips = tipIds.length > 0;
|
|
5425
5503
|
const isAwaitingUserInput = phase === "awaitingInput" && !!inputReq;
|
|
5426
5504
|
const isCommandApprovalPrompt = isAwaitingUserInput && inputReq?.promptType === "commandApproval";
|
|
5427
|
-
const
|
|
5505
|
+
const promptPending = isAwaitingUserInput && !isCommandApprovalPrompt;
|
|
5506
|
+
const holdForTip = stepHasTips && promptPending && tipState === "revealing";
|
|
5507
|
+
const showTips = stepHasTips && (phase === "running" || isCommandApprovalPrompt || holdForTip);
|
|
5428
5508
|
const showNoticesInMain = !stepHasTips;
|
|
5429
|
-
const showNotices = !isAwaitingUserInput;
|
|
5509
|
+
const showNotices = !isAwaitingUserInput || holdForTip;
|
|
5430
5510
|
useInput6(
|
|
5431
5511
|
(_input, key) => {
|
|
5432
5512
|
if (key.return) {
|
|
@@ -5446,7 +5526,7 @@ function App() {
|
|
|
5446
5526
|
});
|
|
5447
5527
|
}
|
|
5448
5528
|
});
|
|
5449
|
-
const escOwnedElsewhere = phase === "idle" || phase === "authenticating" || phase === "awaitingInput" && (inputReq?.promptType === "enterToContinue" || inputReq?.promptType === "commandApproval");
|
|
5529
|
+
const escOwnedElsewhere = phase === "idle" || phase === "authenticating" || phase === "awaitingInput" && !holdForTip && (inputReq?.promptType === "enterToContinue" || inputReq?.promptType === "commandApproval");
|
|
5450
5530
|
useInput6((_input, key) => {
|
|
5451
5531
|
if (escOwnedElsewhere) return;
|
|
5452
5532
|
if (key.escape) {
|
|
@@ -5510,7 +5590,14 @@ function App() {
|
|
|
5510
5590
|
/* @__PURE__ */ jsx17(Text19, { color: COLORS.muted, children: "A browser window will open \u2014 complete sign-in there." })
|
|
5511
5591
|
] }),
|
|
5512
5592
|
/* @__PURE__ */ jsx17(CliOutput, {}),
|
|
5513
|
-
showTips && currentStep && /* @__PURE__ */ jsx17(
|
|
5593
|
+
showTips && currentStep && /* @__PURE__ */ jsx17(
|
|
5594
|
+
Tips,
|
|
5595
|
+
{
|
|
5596
|
+
stepId: currentStep.id,
|
|
5597
|
+
ids: tipIds,
|
|
5598
|
+
onRevealStateChange: setTipState
|
|
5599
|
+
}
|
|
5600
|
+
),
|
|
5514
5601
|
showNoticesInMain && showNotices && /* @__PURE__ */ jsx17(Notices, { showAll: true, border: false }),
|
|
5515
5602
|
!showTips && /* @__PURE__ */ jsx17(PromptInput, {}),
|
|
5516
5603
|
phase === "error" && error && /* @__PURE__ */ jsx17(Box19, { marginTop: 1, children: /* @__PURE__ */ jsxs17(Text19, { color: COLORS.status.error, children: [
|
|
@@ -5519,7 +5606,7 @@ function App() {
|
|
|
5519
5606
|
] }) })
|
|
5520
5607
|
] }),
|
|
5521
5608
|
!showNoticesInMain && showNotices && /* @__PURE__ */ jsx17(Notices, {}),
|
|
5522
|
-
showTips && /* @__PURE__ */ jsx17(PromptInput, {})
|
|
5609
|
+
showTips && !holdForTip && /* @__PURE__ */ jsx17(PromptInput, {})
|
|
5523
5610
|
]
|
|
5524
5611
|
}
|
|
5525
5612
|
),
|