@vexpay/maps 0.0.0-stage → 0.1.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/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +155 -2
- package/dist/chunk-2U3TCV53.js +771 -0
- package/dist/chunk-2U3TCV53.js.map +1 -0
- package/dist/index.cjs +820 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/location-picker-DnqD4Pi3.d.cts +208 -0
- package/dist/location-picker-DnqD4Pi3.d.ts +208 -0
- package/dist/react.cjs +865 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +41 -0
- package/dist/react.d.ts +41 -0
- package/dist/react.js +81 -0
- package/dist/react.js.map +1 -0
- package/dist/vexmaps.global.js +59 -0
- package/dist/vexmaps.global.js.map +1 -0
- package/package.json +91 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# @vexpay/maps
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
- README and package links: [vexpay.app/maps](https://vexpay.app/maps) (access and coverage) and the docs at [docs.vexpay.app/maps](https://docs.vexpay.app/maps); `homepage` points to vexpay.app/maps instead of the private repository. New "Get an API key" section: request a key on WhatsApp with the message pre-filled.
|
|
6
|
+
|
|
7
|
+
## 0.1.0
|
|
8
|
+
|
|
9
|
+
First release of the VEX Maps SDK: `createVexMaps({ key, country })` with `search`, `reverse` and `countries` (typed `VexMapsError`, `unavailable` on timeout, network failure or server error, secret keys refused in browsers); DOM pieces `mountMap`, `mountAddressSearch` and `mountLocationPicker` with the always-visible "VEX Maps · © OpenStreetMap" signature; five map themes (`light`, `dark`, `white`, `grayscale`, `purple`); React components from `@vexpay/maps/react`; and a `<script>` build (`window.VexMaps`).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chu Ventures
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,156 @@
|
|
|
1
|
-
#
|
|
1
|
+
# VEX Maps for JavaScript
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Address search, reverse lookup, maps and a location picker for **Venezuela** and **Colombia**, built on open data (OpenStreetMap, Overture Maps, GeoNames and Colombian official data). No Google Maps, no Mapbox.
|
|
4
|
+
|
|
5
|
+
- **Client:** `search`, `reverse` and `countries`, typed, for the browser and Node.
|
|
6
|
+
- **Ready-made pieces:** a map, an address field with suggestions, and a location picker (search, then move the map so the pin sits on the door).
|
|
7
|
+
- **React:** the same pieces as components, from `@vexpay/maps/react`.
|
|
8
|
+
- **Formats:** ESM, CommonJS and a `<script>` build (`window.VexMaps`). MapLibre and React are optional peers.
|
|
9
|
+
- **Licence:** MIT.
|
|
10
|
+
|
|
11
|
+
**Links:** [vexpay.app/maps](https://vexpay.app/maps) (live map, coverage and access) · [Docs](https://docs.vexpay.app/maps) ([en español](https://docs.vexpay.app/es/maps)) · [VEX Pay](https://vexpay.app)
|
|
12
|
+
|
|
13
|
+
## Get an API key
|
|
14
|
+
|
|
15
|
+
[**Request a VEX Maps key on WhatsApp**](https://wa.me/584149333844?text=Hola%2C%20quiero%20una%20clave%20API%20de%20VEX%20Maps.%0AProducto%20o%20empresa%3A%20%0APa%C3%ADses%20%28Venezuela%2C%20Colombia%29%3A%20%0ASitios%20web%20que%20usar%C3%A1n%20el%20mapa%3A%20%0AQu%C3%A9%20necesito%20%28b%C3%BAsqueda%2C%20mapa%2C%20selector%20de%20ubicaci%C3%B3n%29%3A%20) (+58 414 933 3844). The message opens filled in: your product or company, the countries (Venezuela, Colombia), the websites that will show the map, and what you need (search, a map or the location picker). We reply with a publishable key (`vexmap_pk_…`, locked to your origins) and a secret key (`vexmap_sk_…`, server only).
|
|
16
|
+
|
|
17
|
+
## Keys
|
|
18
|
+
|
|
19
|
+
| Key | Prefix | Where | Can call |
|
|
20
|
+
|---|---|---|---|
|
|
21
|
+
| Publishable | `vexmap_pk_…` | the browser, from your allowed origins only | `search`, `reverse` |
|
|
22
|
+
| Secret | `vexmap_sk_…` | your server only | everything, including `countries` |
|
|
23
|
+
|
|
24
|
+
The SDK refuses a secret key in a browser.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
npm install @vexpay/maps maplibre-gl
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`maplibre-gl` is needed only for the map and the picker. Load its CSS once:
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## React, in five minutes
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { useVexMaps, LocationPicker } from '@vexpay/maps/react';
|
|
42
|
+
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
43
|
+
|
|
44
|
+
export function DeliveryStep({ onPicked, onFallback }) {
|
|
45
|
+
const vexmaps = useVexMaps({ key: process.env.NEXT_PUBLIC_VEX_MAPS_KEY!, country: 've' });
|
|
46
|
+
return (
|
|
47
|
+
<LocationPicker
|
|
48
|
+
client={vexmaps}
|
|
49
|
+
style={{ height: 420 }}
|
|
50
|
+
onConfirm={({ point, reverse, picked }) => onPicked({ point, zone: reverse?.zone, street: reverse?.street?.label })}
|
|
51
|
+
onUnavailable={() => onFallback()} // VEX Maps down or slow: show your typed address fields
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Also available: `<VexMap>` (a map, `onReady` gives the MapLibre map) and `<AddressSearch>` (the field alone, `onSelect` gives the result). Each takes `onUnavailable`.
|
|
58
|
+
|
|
59
|
+
## Plain HTML, in five minutes
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@5/dist/maplibre-gl.css" />
|
|
63
|
+
<script src="https://unpkg.com/maplibre-gl@5/dist/maplibre-gl.js"></script>
|
|
64
|
+
<script src="https://unpkg.com/@vexpay/maps@0.1/dist/vexmaps.global.js"></script>
|
|
65
|
+
|
|
66
|
+
<div id="picker" style="height: 420px"></div>
|
|
67
|
+
<script>
|
|
68
|
+
const vexmaps = VexMaps.createVexMaps({ key: 'vexmap_pk_…', country: 've' });
|
|
69
|
+
const picker = VexMaps.mountLocationPicker(document.getElementById('picker'), { client: vexmaps });
|
|
70
|
+
picker.on('confirm', ({ point, reverse }) => console.log(point, reverse && reverse.zone));
|
|
71
|
+
picker.on('unavailable', () => { /* show typed address fields */ });
|
|
72
|
+
</script>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The `<script>` build does not include MapLibre: load it first, as above.
|
|
76
|
+
|
|
77
|
+
## Node, in five minutes
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
import { createVexMaps } from '@vexpay/maps';
|
|
81
|
+
|
|
82
|
+
const vexmaps = createVexMaps({ key: process.env.VEX_MAPS_SECRET_KEY });
|
|
83
|
+
|
|
84
|
+
const { results } = await vexmaps.search('castellana', { country: 've' });
|
|
85
|
+
// [{ label: 'La Castellana', kind: 'neighbourhood', precision: 'AREA', point: { lat, lng }, admin: { level1: 'Miranda', level2: 'Chacao' }, … }]
|
|
86
|
+
|
|
87
|
+
const place = await vexmaps.reverse({ lat: 10.5013, lng: -66.8523 }, { country: 've' });
|
|
88
|
+
// { admin, neighbourhood, street, place, inServiceArea, zone, attribution }
|
|
89
|
+
|
|
90
|
+
const countries = await vexmaps.countries(); // secret keys only
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Colombian grid addresses work in `search`: `"Calle 72 # 10-34"`, `"Cra 7 con 72"`, `"Kr 24C # 20-10"`, `"Calle 26 Sur # 50-20"`. Pass `near` (the user's area) for the best result.
|
|
94
|
+
|
|
95
|
+
## Options
|
|
96
|
+
|
|
97
|
+
`createVexMaps({ key, country?, baseUrl?, theme?, styleUrl?, timeoutMs?, fetch? })`
|
|
98
|
+
|
|
99
|
+
- `country`: `'ve'` or `'co'`, the default for every call.
|
|
100
|
+
- `timeoutMs`: default `2000`. A timeout, network failure or server error becomes the `unavailable` error, so the page can fall back to typed fields.
|
|
101
|
+
- `theme`: the map theme, `light` (default), `dark`, `white`, `grayscale` or `purple`.
|
|
102
|
+
|
|
103
|
+
The location picker also takes `pinColor` (any CSS colour, default `#d1372b`) to match your brand: `<LocationPicker pinColor="#5b3fd1" … />` or `mountLocationPicker(el, { client, pinColor: '#5b3fd1' })`. The pin lifts while the map moves and drops back when it stops; with reduced motion it just stays put.
|
|
104
|
+
|
|
105
|
+
## Map themes
|
|
106
|
+
|
|
107
|
+
| Theme | Style URL |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `light` (default) | `https://tiles.chuventures.com/styles/light.json` |
|
|
110
|
+
| `dark` | `https://tiles.chuventures.com/styles/dark.json` |
|
|
111
|
+
| `white` | `https://tiles.chuventures.com/styles/white.json` |
|
|
112
|
+
| `grayscale` | `https://tiles.chuventures.com/styles/grayscale.json` |
|
|
113
|
+
| `purple` | `https://tiles.chuventures.com/styles/purple.json` |
|
|
114
|
+
|
|
115
|
+
Using the style with MapLibre directly (without the SDK)? Pass `attributionControl: { customAttribution: '' }` so the corner shows only the style's own credit.
|
|
116
|
+
|
|
117
|
+
## Errors
|
|
118
|
+
|
|
119
|
+
Every failure is a `VexMapsError` with a `code`:
|
|
120
|
+
|
|
121
|
+
| Code | Meaning |
|
|
122
|
+
|---|---|
|
|
123
|
+
| `unavailable` | timeout, network failure or server error: fall back to typed fields |
|
|
124
|
+
| `invalid_api_key` | the key is wrong, revoked or expired |
|
|
125
|
+
| `origin_not_allowed` | a publishable key used from an origin it doesn't allow |
|
|
126
|
+
| `country_not_allowed` | the key's product doesn't have that country |
|
|
127
|
+
| `rate_limited` | too many requests; `retryAfter` is in seconds |
|
|
128
|
+
| `invalid_text` | search text shorter than 3 or longer than 120 characters |
|
|
129
|
+
| `point_outside_country` | a reverse point outside the country |
|
|
130
|
+
| `secret_key_in_browser` | a secret key used in a browser |
|
|
131
|
+
| `secret_key_required` | a publishable key used for a secret-only call (`countries`) |
|
|
132
|
+
| `invalid_country`, `invalid_point` | a country other than `ve`/`co`, or a malformed point |
|
|
133
|
+
| `not_found`, `error` | anything else; `message` says what |
|
|
134
|
+
|
|
135
|
+
## Text and strings
|
|
136
|
+
|
|
137
|
+
The pieces speak Spanish. Override any label with `strings`, for example `{ placeholder: 'Busca tu dirección' }`. The defaults are in `DEFAULT_STRINGS`.
|
|
138
|
+
|
|
139
|
+
## Signature and attribution
|
|
140
|
+
|
|
141
|
+
Every map shows **VEX Maps · © OpenStreetMap** in its corner, and the search field shows **Búsqueda por VEX Maps** under its suggestions. The OpenStreetMap credit is required by the data's licence (ODbL). There is no option to hide either, and page CSS can't hide them.
|
|
142
|
+
|
|
143
|
+
## Privacy
|
|
144
|
+
|
|
145
|
+
Search text and points go in request bodies, never in URLs. VEX Maps uses them to answer that one request and doesn't store or log them.
|
|
146
|
+
|
|
147
|
+
## Licence
|
|
148
|
+
|
|
149
|
+
MIT. Map data © OpenStreetMap contributors (ODbL), Overture Maps Foundation, GeoNames (CC BY 4.0) and DANE.
|
|
150
|
+
|
|
151
|
+
## Help
|
|
152
|
+
|
|
153
|
+
- Docs: [docs.vexpay.app/maps](https://docs.vexpay.app/maps)
|
|
154
|
+
- Request an API key: [WhatsApp](https://wa.me/584149333844?text=Hola%2C%20quiero%20una%20clave%20API%20de%20VEX%20Maps.%0AProducto%20o%20empresa%3A%20%0APa%C3%ADses%20%28Venezuela%2C%20Colombia%29%3A%20%0ASitios%20web%20que%20usar%C3%A1n%20el%20mapa%3A%20%0AQu%C3%A9%20necesito%20%28b%C3%BAsqueda%2C%20mapa%2C%20selector%20de%20ubicaci%C3%B3n%29%3A%20) (+58 414 933 3844)
|
|
155
|
+
- Product and coverage: [vexpay.app/maps](https://vexpay.app/maps)
|
|
156
|
+
- VEX Pay (payments for Venezuela and Colombia): [vexpay.app](https://vexpay.app) · [docs.vexpay.app](https://docs.vexpay.app)
|