{"id":34791531,"url":"https://github.com/woosmap/woosmap-autocomplete-searchbox","last_synced_at":"2026-05-24T22:34:04.906Z","repository":{"id":54616371,"uuid":"113864971","full_name":"Woosmap/woosmap-autocomplete-searchbox","owner":"Woosmap","description":"Woosmap Autocomplete SearchBox to search for Woosmap Localities and fallback on Google Places according to a partial string similarity ratio (fuzzy string matching) and other certain specific criteria.","archived":false,"fork":false,"pushed_at":"2021-02-08T09:29:50.000Z","size":295,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-23T13:36:09.259Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://community.woosmap.com/localities-fallback-googleplaces/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Woosmap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-11T13:53:57.000Z","updated_at":"2024-04-23T13:36:09.260Z","dependencies_parsed_at":"2022-08-13T21:40:38.952Z","dependency_job_id":null,"html_url":"https://github.com/Woosmap/woosmap-autocomplete-searchbox","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/Woosmap/woosmap-autocomplete-searchbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Woosmap%2Fwoosmap-autocomplete-searchbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Woosmap%2Fwoosmap-autocomplete-searchbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Woosmap%2Fwoosmap-autocomplete-searchbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Woosmap%2Fwoosmap-autocomplete-searchbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Woosmap","download_url":"https://codeload.github.com/Woosmap/woosmap-autocomplete-searchbox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Woosmap%2Fwoosmap-autocomplete-searchbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28026682,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-25T10:00:08.658Z","updated_at":"2025-12-25T10:00:42.120Z","avatar_url":"https://github.com/Woosmap.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Autocomplete Localities Fallback Google Places\n\nLightweight and customizable autocomplete widget to search for [Woosmap Localities](https://developers.woosmap.com/products/localities/search-city-postcode/) and fallback on **Google Places** according to a partial string similarity ratio and other certain specific criteria.\n\nOfficial Documentation: \u003chttps://community.woosmap.com/localities-fallback-googleplaces/\u003e \n\n## Overview\n\nWhen Searching for [Woosmap Localities](https://developers.woosmap.com/products/localities/search-city-postcode/) using this widget, a **matching ratio** is computed between the user input and for each returned items.\n- If Woosmap Localities return no item with matching **Ratio = 100** (customizable using `breakpointRatio` parameter), the widget populate predictions response with Google Places.\n- All returned Woosmap Localities items with **Ratio \u003c= 75** (customizable using `minRatio` parameter) are removed from the predictions pick list.\n\nCheck how we [calculate ratio](#ratio--partial-string-similarity) or explore [source code on GitHub](https://github.com/woosmap/woosmap-autocomplete-searchbox).\n\n## Installation\n\nYou can use the **jsDelivr** CDN for both JS and CSS.\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/woosmap/woosmap-autocomplete-searchbox@latest/dist/autocompletewoosmap.min.js\"\u003e\u003c/script\u003e\n\u003clink href=\"https://cdn.jsdelivr.net/gh/woosmap/woosmap-autocomplete-searchbox@latest/dist/autocompletewoosmap.min.css\" rel=\"stylesheet\"\u003e\n```\n\nOtherwise, [fork or download the source code](https://github.com/woosmap/woosmap-autocomplete-searchbox) and run the following commands:\n\n#### Install dependencies\n```ShellSession\n$ npm install\n```\n#### Run\n```ShellSession\n$ npm run start\n```\n#### build\n```ShellSession\n$ npm run build\n```\n\n## Basic Usage\nBefore you try anything, you need to add an *input* block element and include `autocompletewoosmap.css` and `autocompletewoosmap.js` in your page, via the usual tags:\n```html\n\u003clink href=\"./autocompletewoosmap.css\" rel=\"stylesheet\"\u003e\u003c/head\u003e\n\u003cscript type=\"text/javascript\" src=\"./autocompletewoosmap.js\"\u003e\u003c/script\u003e\u003c/body\u003e\n\u003cinput id=\"my-input\"/\u003e\n```\nThen, you need at least to specify your Woosmap **Project Key** and you Google **API key** before instantiating the widget with default criteria:\n```html\n\u003cscript\u003e\n    const config = {\n        woosmap: {projectKey: \"woos-XXXX\"},\n        google: {apiKey: \"AIzaYYYYYY-1234567\"}\n    };    \n    const input = document.getElementById(\"my-input\");\n    new AutocompleteWoosmapSearchBox(input, config);\n\u003c/script\u003e\n```\n\nLoading Google Places is **optional**, as the widget does it automatically according to the Google options.   \n\n## Add Listener on Selected Predictions\n\nWhen a user select a Woosmap Locality or a Google Place from the list of autocomplete predictions, an event is fired with either a Woosmap Locality object or a Google Place Detail object.\nYou'll need to register on the Input text two EventListener named `'autocomplete-woosmap-selectcomplete'` and `'autocomplete-google-selectcomplete'`.\n\n### Woosmap Localities onSelect\n\nWoosmap Localities response Doc : https://developers.woosmap.com/guides/search-localities/search-city-postcode/#localities-predictions-responses\n\n```html\n\u003cscript\u003e\n    document.getElementById('my-input').addEventListener('autocomplete-woosmap-selectcomplete', function (evt) {\n        console.log(evt.woosmapLocality);\n    });\n\u003c/script\u003e\n```\n\n### Google Place Details onSelect\n\nPlace Details response Doc : https://developers.google.com/maps/documentation/javascript/places#place_details\n\n```html\n\u003cscript\u003e\n    document.getElementById('my-input').addEventListener('autocomplete-google-selectcomplete', function (evt) {\n        console.log(evt.placeDetails);\n    });\n\u003c/script\u003e\n``` \n\nAnd you're done!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoosmap%2Fwoosmap-autocomplete-searchbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwoosmap%2Fwoosmap-autocomplete-searchbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoosmap%2Fwoosmap-autocomplete-searchbox/lists"}