@geophrase/react 1.5.1 β†’ 1.6.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/README.md CHANGED
@@ -4,6 +4,8 @@ The official React and Next.js hook for Geophrase Connect. Drop the Geophrase ad
4
4
 
5
5
  πŸ‘‰ **[Full documentation and integration guide](https://geophrase.com/docs)**
6
6
 
7
+ πŸ—ΊοΈ **[How GPS address capture works with couriers or your own riders](https://geophrase.com/features/gps-address-capture)**
8
+
7
9
  ---
8
10
 
9
11
  ## Install
@@ -16,7 +18,7 @@ npm install @geophrase/react
16
18
 
17
19
  ## Quick Start
18
20
 
19
- The snippet below uses `mode: 'server'` so you can drop it into any React app and see the widget without creating an API key first.
21
+ The snippet below uses `mode: 'server'`, which needs only your API key id β€” no secret API key. Drop it into any React app, swap in your own `keyId`, and the widget runs.
20
22
 
21
23
  ```jsx
22
24
  import { useState } from 'react';
@@ -26,6 +28,7 @@ export default function Checkout() {
26
28
  const [result, setResult] = useState(null);
27
29
 
28
30
  const { open } = useGeophrase({
31
+ keyId: 'YOUR_API_KEY_ID', // required β€” your API key id (both modes)
29
32
  mode: 'server', // widget returns a token your backend exchanges for the address
30
33
  theme: 'system', // 'light' | 'dark' | 'system'
31
34
  orderId: 'ORD-98765', // your internal reference id
@@ -52,13 +55,14 @@ The SDK supports two modes. Pick whichever fits your architecture:
52
55
  - **`server`**: the widget returns `{ token }`. Your backend exchanges it for the full address using your API key, which never touches the frontend.
53
56
  - **`client`**: the widget resolves the address in the browser and passes it straight to `onSuccess`. Requires `key` in the SDK options.
54
57
 
55
- > Both modes require a Geophrase API key. See [creating and securing an API key](https://geophrase.com/docs/api-keys).
58
+ > Every integration requires your API key id (`keyId`) in the SDK options β€” it identifies your account to the widget. On top of that, `client` mode needs your secret API key (`key`) in the browser, while `server` mode uses that secret only on your backend. See [creating and securing an API key](https://geophrase.com/docs/api-keys).
56
59
  >
57
- > If your app has a backend, `server` mode keeps your API key entirely off the frontend, which is the most secure option. If you don't have a backend (or want the fastest possible integration), `client` mode with a domain-restricted key is fine.
60
+ > If your app has a backend, `server` mode keeps your secret API key entirely off the frontend, which is the most secure option. If you don't have a backend (or want the fastest possible integration), `client` mode with a domain-restricted key is fine.
58
61
 
59
62
  ```jsx
60
63
  // client mode, no backend integration required
61
64
  const { open } = useGeophrase({
65
+ keyId: 'YOUR_API_KEY_ID',
62
66
  mode: 'client',
63
67
  key: 'YOUR_API_KEY',
64
68
  onSuccess: (address) => setResult(address)
@@ -69,8 +73,9 @@ const { open } = useGeophrase({
69
73
 
70
74
  | Parameter | Type | Required | Description |
71
75
  | :--- | :--- | :--- | :--- |
76
+ | `keyId` | `string` | **Yes** | Your 8-character [Geophrase API key id](https://geophrase.com/docs/api-keys). Required in **both** modes; sent to the widget to identify your account. |
72
77
  | `mode` | `string` | Optional | `'client'` (default) or `'server'`. Determines the architectural flow of the SDK. |
73
- | `key` | `string` | **Conditional** | Your [Geophrase API key](https://geophrase.com/docs/api-keys). **Required if `mode` is `'client'`.** Omit if using server mode. |
78
+ | `key` | `string` | **Conditional** | Your secret [Geophrase API key](https://geophrase.com/docs/api-keys). **Required if `mode` is `'client'`.** Omit if using server mode. |
74
79
  | `theme` | `string` | Optional | `'light'`, `'dark'`, or `'system'`. Defaults to `'system'`. |
75
80
  | `orderId` | `string` | Optional | Your internal reference ID for this checkout session. |
76
81
  | `phone` | `string` | Optional | The customer's 10-digit phone number (pre-fills the widget). |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geophrase/react",
3
- "version": "1.5.1",
3
+ "version": "1.6.1",
4
4
  "description": "React & Next.js hook for the Geophrase address picker. Drop-in widget that captures structured Indian addresses with coordinates to reduce RTO.",
5
5
  "license": "MIT",
6
6
  "author": "Geophrase",
@@ -44,7 +44,7 @@
44
44
  "react": ">=16.8.0"
45
45
  },
46
46
  "dependencies": {
47
- "@geophrase/core": "^1.5.1"
47
+ "@geophrase/core": "^1.6.0"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"
@@ -25,6 +25,7 @@ export const useGeophrase = (options = {}) => {
25
25
 
26
26
  try {
27
27
  geoInstance.current = new Geophrase({
28
+ keyId: options.keyId,
28
29
  mode: options.mode,
29
30
  theme: options.theme,
30
31
  key: options.key,
@@ -51,7 +52,7 @@ export const useGeophrase = (options = {}) => {
51
52
  }
52
53
  };
53
54
  // Include mode and theme in the dependency array so the instance rebuilds if they change state
54
- }, [options.mode, options.theme, options.key, options.orderId, options.phone]);
55
+ }, [options.keyId, options.mode, options.theme, options.key, options.orderId, options.phone]);
55
56
 
56
57
  const open = useCallback(() => {
57
58
  if (geoInstance.current) {