@geophrase/react 1.3.1 → 1.3.2
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 +7 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ npm install @geophrase/react
|
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
18
18
|
|
|
19
|
-
The snippet below uses `mode: 'server'` so you can drop it into any React app and see the widget
|
|
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.
|
|
20
20
|
|
|
21
21
|
```jsx
|
|
22
22
|
import { useState } from 'react';
|
|
@@ -50,12 +50,14 @@ export default function Checkout() {
|
|
|
50
50
|
The SDK supports two modes. Pick whichever fits your architecture:
|
|
51
51
|
|
|
52
52
|
- **`server`**: the widget returns `{ token }`. Your backend exchanges it for the full address using your API key, which never touches the frontend.
|
|
53
|
-
- **`client`**: the widget resolves the address in the browser and passes it straight to `onSuccess`. Requires `key` in the options.
|
|
53
|
+
- **`client`**: the widget resolves the address in the browser and passes it straight to `onSuccess`. Requires `key` in the SDK options.
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
> Both modes require a Geophrase API key. See [creating and securing an API key](https://business.geophrase.com/docs/api-keys).
|
|
56
|
+
>
|
|
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.
|
|
56
58
|
|
|
57
59
|
```jsx
|
|
58
|
-
// client mode, no backend required
|
|
60
|
+
// client mode, no backend integration required
|
|
59
61
|
const { open } = useGeophrase({
|
|
60
62
|
mode: 'client',
|
|
61
63
|
key: 'YOUR_API_KEY',
|
|
@@ -68,7 +70,7 @@ const { open } = useGeophrase({
|
|
|
68
70
|
| Parameter | Type | Required | Description |
|
|
69
71
|
| :--- | :--- | :--- | :--- |
|
|
70
72
|
| `mode` | `string` | Optional | `'client'` (default) or `'server'`. Determines the architectural flow of the SDK. |
|
|
71
|
-
| `key` | `string` | **Conditional** | Your Geophrase API key. **Required if `mode` is `'client'`.** Omit if using server mode. |
|
|
73
|
+
| `key` | `string` | **Conditional** | Your [Geophrase API key](https://business.geophrase.com/docs/api-keys). **Required if `mode` is `'client'`.** Omit if using server mode. |
|
|
72
74
|
| `theme` | `string` | Optional | `'light'`, `'dark'`, or `'system'`. Defaults to `'system'`. |
|
|
73
75
|
| `orderId` | `string` | Optional | Your internal reference ID for this checkout session. |
|
|
74
76
|
| `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.3.
|
|
3
|
+
"version": "1.3.2",
|
|
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.3.
|
|
47
|
+
"@geophrase/core": "^1.3.2"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|