@algolia/wizard 0.88.0 → 0.90.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 +27 -4
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2358,7 +2358,7 @@ async function ensureApplication(resumeAppId) {
|
|
|
2358
2358
|
// package.json
|
|
2359
2359
|
var package_default = {
|
|
2360
2360
|
name: "@algolia/wizard",
|
|
2361
|
-
version: "0.
|
|
2361
|
+
version: "0.90.0",
|
|
2362
2362
|
description: "Magically implement Algolia functionality in your codebase",
|
|
2363
2363
|
type: "module",
|
|
2364
2364
|
engines: {
|
|
@@ -6490,6 +6490,27 @@ function packageSearchInstructions(input) {
|
|
|
6490
6490
|
"Install any Algolia packages you import with the project's own package manager via runShell, and declare them in the project's dependency manifest."
|
|
6491
6491
|
];
|
|
6492
6492
|
}
|
|
6493
|
+
function cdnAutocompleteShape(placeholder) {
|
|
6494
|
+
return `Use this shape for the autocomplete call. Replace the item fields and the getURL route with the real record fields and an existing route:
|
|
6495
|
+
\`\`\`js
|
|
6496
|
+
window.instantsearch.widgets.autocomplete({
|
|
6497
|
+
container: '#autocomplete',
|
|
6498
|
+
placeholder: ${JSON.stringify(placeholder)},
|
|
6499
|
+
indices: [
|
|
6500
|
+
{
|
|
6501
|
+
indexName: window.${SEARCH_CONFIG_INDEX_NAME},
|
|
6502
|
+
getURL: (item) => '/existing-route/' + item.slug,
|
|
6503
|
+
templates: {
|
|
6504
|
+
item: ({ item, onSelect }, { html, components }) =>
|
|
6505
|
+
html\`<div onClick=\${onSelect}>\${components.Highlight({ hit: item, attribute: 'name' })}</div>\`,
|
|
6506
|
+
noResults: (_, { html }) => html\`<span>No results</span>\`,
|
|
6507
|
+
},
|
|
6508
|
+
},
|
|
6509
|
+
],
|
|
6510
|
+
})
|
|
6511
|
+
\`\`\`
|
|
6512
|
+
The widget reads the item and noResults templates only from each indices entry. Its own top-level templates option accepts only panel. If item is not inside indices[].templates, the widget throws "Template must be 'string' or 'function', was 'undefined' (key: item)" on the first search and shows no results.`;
|
|
6513
|
+
}
|
|
6493
6514
|
function cdnSearchInstructions(input) {
|
|
6494
6515
|
const entityName = input.findings.confirmedEntities?.[0]?.name;
|
|
6495
6516
|
const placeholder = entityName ? `Search ${entityName} records...` : "Search indexed content...";
|
|
@@ -6499,7 +6520,8 @@ function cdnSearchInstructions(input) {
|
|
|
6499
6520
|
input.searchKey ? `Set window.${SEARCH_CONFIG_SEARCH_KEY} to "${input.searchKey}".` : `A real search-only key could not be provisioned${input.searchKeyError ? ` (${input.searchKeyError})` : ""} \u2014 set window.${SEARCH_CONFIG_SEARCH_KEY} to the placeholder "${SEARCH_KEY_PLACEHOLDER}" and add a prominent TODO for the developer to fill in a real one.`,
|
|
6500
6521
|
'Load these exact pinned tags in order before the config and search scripts: <script src="https://cdn.jsdelivr.net/npm/algoliasearch@5.59.0/dist/lite/builds/browser.umd.js" integrity="sha256-pduQHl1jn0IaN/BIpSotQm7Y5THdpKcX3Bw6xdRteRw=" crossorigin="anonymous"></script> then <script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4.117.0/dist/instantsearch.production.min.js" integrity="sha256-5zhKxAGeH7ThWfnmdD4pS1gsmafE2b8aWRsq8set/dc=" crossorigin="anonymous"></script>.',
|
|
6501
6522
|
'When using the InstantSearch theme, load this exact tag before the application styles: <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/instantsearch.css@8.22.1/themes/satellite-min.css" integrity="sha256-5/eHPZl63VYJSDVOKrOgGe/5+owUkX3uPAW6+XYeLNc=" crossorigin="anonymous">. Never use an unversioned or differently versioned theme URL, and never omit its integrity attribute.',
|
|
6502
|
-
`In that classic search script, use window['algoliasearch/lite'].liteClient and window.instantsearch. Add window.instantsearch.widgets.autocomplete as the only search widget. Configure it with container '#autocomplete', the content-specific placeholder ${JSON.stringify(placeholder)}, and an indices array containing one object whose indexName is window.${SEARCH_CONFIG_INDEX_NAME}
|
|
6523
|
+
`In that classic search script, use window['algoliasearch/lite'].liteClient and window.instantsearch. Add window.instantsearch.widgets.autocomplete as the only search widget. Configure it with container '#autocomplete', the content-specific placeholder ${JSON.stringify(placeholder)}, and an indices array containing one object whose indexName is window.${SEARCH_CONFIG_INDEX_NAME}. Put the item and noResults functions in the templates option of that indices entry, implement getURL only for an existing route, and match the item template to the entity schema. Keep insights: true and call search.start(). Do not substitute searchBox or hits, omit indices, use imports or exports, or use type="module".`,
|
|
6524
|
+
cdnAutocompleteShape(placeholder)
|
|
6503
6525
|
];
|
|
6504
6526
|
}
|
|
6505
6527
|
function validationInstructions(input) {
|
|
@@ -6522,7 +6544,8 @@ function validationInstructions(input) {
|
|
|
6522
6544
|
"Do not modify files. Report each implementation issue as a concrete instruction for the next implementation pass.",
|
|
6523
6545
|
`Detected verification tools: ${JSON.stringify(input.findings.verification ?? [])}. Use only a type checker; ignore any linter or formatter in this list.`,
|
|
6524
6546
|
...!input.frontendHasPackageJson ? [
|
|
6525
|
-
"The frontend has no package.json: never create one or run npm, pnpm, yarn, or bun. Validate the CDN implementation by inspecting its HTML or template and classic scripts for the search container, Algolia \u2192 InstantSearch \u2192 config \u2192 search load order, browser globals, autocomplete widget configuration, search.start(), and exact pinned CDN URLs and integrity attributes for every Algolia script or stylesheet. Source inspection is required even when the project has no automated checks. window.instantsearch.widgets.autocomplete is a real widget in the pinned InstantSearch build; do not report its use as an error, and do not fetch a remote bundle or URL to verify it."
|
|
6547
|
+
"The frontend has no package.json: never create one or run npm, pnpm, yarn, or bun. Validate the CDN implementation by inspecting its HTML or template and classic scripts for the search container, Algolia \u2192 InstantSearch \u2192 config \u2192 search load order, browser globals, autocomplete widget configuration, search.start(), and exact pinned CDN URLs and integrity attributes for every Algolia script or stylesheet. Source inspection is required even when the project has no automated checks. window.instantsearch.widgets.autocomplete is a real widget in the pinned InstantSearch build; do not report its use as an error, and do not fetch a remote bundle or URL to verify it.",
|
|
6548
|
+
"In the autocomplete call, confirm that the item and noResults templates are inside the templates option of the indices entry, not in the top-level templates option of the widget. The top-level templates option accepts only panel, so an item template there throws on the first search and no results show. If item is missing from indices[].templates, set sufficient=false and tell the next pass to move the templates into the indices entry."
|
|
6526
6549
|
] : [],
|
|
6527
6550
|
"Always call reportStatus with status=success after validation, even when sufficient=false.",
|
|
6528
6551
|
"Set sufficient=false if the input's computed accessible name is empty or generic, including when aria-labelledby references a missing or empty element; a placeholder does not count as the label.",
|
|
@@ -9741,7 +9764,7 @@ async function resetProjectState() {
|
|
|
9741
9764
|
// package.json with { type: 'json' }
|
|
9742
9765
|
var package_default2 = {
|
|
9743
9766
|
name: "@algolia/wizard",
|
|
9744
|
-
version: "0.
|
|
9767
|
+
version: "0.90.0",
|
|
9745
9768
|
description: "Magically implement Algolia functionality in your codebase",
|
|
9746
9769
|
type: "module",
|
|
9747
9770
|
engines: {
|