@quantaroute/checkout 1.3.2 → 1.4.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 ADDED
@@ -0,0 +1,91 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@quantaroute/checkout` are documented here.
4
+
5
+ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
+ Release dates are from git history where available; earlier versions are estimated from the first public commit.
7
+
8
+ ## [1.4.1](https://github.com/quantaroute/checkout/compare/v1.4.0...v1.4.1) — 2026-06-13
9
+
10
+ ### Added
11
+
12
+ - Consistent email OTP — same code reused for up to 10 checkouts per email+merchant
13
+ - `SendEmailOtpResult` export with `reused` flag when send skips Resend
14
+ - `EmailOtpStep` copy when an existing code is still valid
15
+
16
+ ### Changed
17
+
18
+ - Email OTP rate limits — max 3 fresh codes / 24h; silent reuse when code is still active
19
+ - Verify lockout after 5 failed attempts (15 min)
20
+
21
+ ### Documentation
22
+
23
+ - OpenAPI spec for `/checkout-email-otp` (send, verify, `reused`, rate-limit responses)
24
+
25
+ ## [1.4.0](https://github.com/quantaroute/checkout/compare/v1.3.1...v1.4.0) — 2026-06-04
26
+
27
+ ### Added
28
+
29
+ - Email OTP auth (`enableEmailAuth`, `EmailStep`, `EmailOtpStep`, `checkout-email-otp` Edge Function)
30
+ - Per-merchant email templates (`email_from_name`, `email_logo_url`, `email_subject_template`)
31
+ - COD controls (`enableCod`, `CodAvailabilityBanner`, `checkCodEligibility()`)
32
+ - Server-side webhooks (`phone_verified`, `email_verified`, `address_completed`, `session.expired`)
33
+ - Automatic session expiry (`checkout-session-expiry` Edge Function + pg_cron)
34
+ - SDK exports: `sendEmailOtp`, `verifyEmailOtp`, `notifyAddressCompleted`
35
+ - Checkout events: `email_step_viewed`, `email_otp_sent`, `email_verified`
36
+
37
+ ## [1.3.1](https://github.com/quantaroute/checkout/compare/v1.3.0...v1.3.1) — 2026-03-14
38
+
39
+ ### Added
40
+
41
+ - Unified map search bar (`enableSearch`) with DigiPin and address autocomplete
42
+
43
+ ### Fixed
44
+
45
+ - DigiPin typing in the search box
46
+
47
+ ## [1.3.0](https://github.com/quantaroute/checkout/compare/v1.2.1...v1.3.0) — 2026-03-01
48
+
49
+ *Estimated — phone OTP and saved-address work landed before the 1.3.1 publish; no tagged commit.*
50
+
51
+ ### Added
52
+
53
+ - Phone OTP auth (`enablePhoneAuth`, `PhoneStep`, `OtpStep`, `checkout-otp` Edge Function)
54
+ - Saved addresses (`SavedAddressStep`, `checkout-addresses` CRUD API)
55
+ - Pincode validation and non-delivery warnings in `AddressForm`
56
+ - Per-merchant branding (`brandColor`, `logoUrl`, `headerBanner`)
57
+ - Client analytics hook (`onCheckoutEvent`, `CheckoutEvent` types)
58
+ - Checkout API client exports (`sendOtp`, `verifyOtp`, address helpers)
59
+
60
+ ## [1.2.1](https://github.com/quantaroute/checkout/compare/v1.2.0...v1.2.1) — 2026-02-19
61
+
62
+ ### Fixed
63
+
64
+ - npm package export paths for CSS and native entry points
65
+
66
+ ## [1.2.0](https://github.com/quantaroute/checkout/compare/v1.1.0...v1.2.0) — 2026-02-19
67
+
68
+ ### Added
69
+
70
+ - iOS and Android support via React Native / Expo (`*.native.tsx`, `expo-plugin.js`)
71
+ - Native map pin selector, address form, and checkout widget
72
+ - GPS geolocation on native (`useGeolocation.native.ts`)
73
+ - Native design system (`checkout.native.ts`, light + dark)
74
+
75
+ ## [1.1.0](https://github.com/quantaroute/checkout/compare/v1.0.0...v1.1.0) — 2026-02-18
76
+
77
+ ### Added
78
+
79
+ - DigiPin badge overlay on map
80
+ - Locality alternatives dropdown
81
+ - OSM address pre-fill (building, road, suburb)
82
+ - India boundary GeoJSON overlay
83
+
84
+ ## [1.0.0](https://github.com/quantaroute/checkout/releases/tag/v1.0.0) — 2026-02-17
85
+
86
+ ### Added
87
+
88
+ - Web checkout widget with MapLibre GL + Carto Positron
89
+ - Offline DigiPin generation and QuantaRoute API integration
90
+ - Mobile-first layout, dark mode, reduced-motion, keyboard accessibility
91
+
package/README.md CHANGED
@@ -286,6 +286,8 @@ npx expo run:android
286
286
 
287
287
  ## Props
288
288
 
289
+ ### Core props
290
+
289
291
  | Prop | Type | Default | Platform |
290
292
  |---|---|---|---|
291
293
  | `apiKey` | `string` | **required** | all |
@@ -301,6 +303,211 @@ npx expo run:android
301
303
  | `style` | `CSSProperties \| StyleProp<ViewStyle>` | – | all |
302
304
  | `indiaBoundaryUrl` | `string` | – | web only |
303
305
 
306
+ ### Search bar
307
+
308
+ | Prop | Type | Default | Platform |
309
+ |---|---|---|---|
310
+ | `enableSearch` | `boolean` | `true` | all |
311
+
312
+ When `enableSearch` is true, a unified search bar appears above the map. It handles two modes automatically:
313
+
314
+ - **Address search** — calls `/v1/digipin/autocomplete` (debounced 400 ms, location-biased)
315
+ - **DigiPin input** — decoded **100 % offline**, zero API cost, instant map flyTo
316
+
317
+ As India Post promotes DigiPin nationally, buyers can paste their 10-character code and land on their exact ±4 m location.
318
+
319
+ ### Phone OTP + saved addresses (D2C checkout)
320
+
321
+ | Prop | Type | Default | Platform |
322
+ |---|---|---|---|
323
+ | `enablePhoneAuth` | `boolean` | `false` | all |
324
+ | `merchantId` | `string` | – | all |
325
+ | `supabaseFunctionBaseUrl` | `string` | – | all |
326
+
327
+ When `enablePhoneAuth` is true the widget starts with a phone-entry step. Returning buyers can pick a previously saved address from any brand in the network instead of dropping the pin again.
328
+
329
+ **Requires:**
330
+
331
+ 1. A merchant account — sign up at [developers.quantaroute.com/onboarding](https://developers.quantaroute.com/onboarding/merchant) to get your `merchantId` and `supabaseFunctionBaseUrl`.
332
+ 2. The `checkout-otp` and `checkout-addresses` Edge Functions deployed (see [Supabase setup](#supabase-setup)).
333
+
334
+ ```tsx
335
+ <CheckoutWidget
336
+ apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
337
+ merchantId="your-merchant-uuid"
338
+ supabaseFunctionBaseUrl="https://<project>.supabase.co/functions/v1"
339
+ enablePhoneAuth={true}
340
+ enableSearch={true}
341
+ onComplete={(addr) => console.log(addr)}
342
+ />
343
+ ```
344
+
345
+ ### Email OTP auth (`enableEmailAuth`)
346
+
347
+ | Prop | Type | Default | Platform |
348
+ |---|---|---|---|
349
+ | `enableEmailAuth` | `boolean` | `false` | all |
350
+ | `merchantId` | `string` | – | all |
351
+ | `supabaseFunctionBaseUrl` | `string` | – | all |
352
+
353
+ When `enableEmailAuth` is true the widget starts with an email-entry step. The buyer receives a 6-digit OTP via **Resend**. On success a checkout session is created and saved addresses are shown if available.
354
+
355
+ > If both `enablePhoneAuth` and `enableEmailAuth` are set, phone OTP takes precedence.
356
+
357
+ ```tsx
358
+ <CheckoutWidget
359
+ apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
360
+ merchantId="your-merchant-uuid"
361
+ supabaseFunctionBaseUrl="https://<project>.supabase.co/functions/v1"
362
+ enableEmailAuth={true}
363
+ onComplete={(addr) => console.log(addr)}
364
+ onCheckoutEvent={(event) => {
365
+ // email-specific events: email_step_viewed | email_otp_sent | email_verified
366
+ console.log('[checkout]', event.type, event);
367
+ }}
368
+ />
369
+ ```
370
+
371
+ **Client-side events emitted during email auth:**
372
+
373
+ | Event type | When |
374
+ |---|---|
375
+ | `email_step_viewed` | Email input screen rendered |
376
+ | `email_otp_sent` | OTP dispatched via Resend |
377
+ | `email_verified` | OTP correct → session created |
378
+
379
+ ---
380
+
381
+ #### Setting up Resend (required for `enableEmailAuth`)
382
+
383
+ > **Hosted merchants (recommended):** If you onboarded at [developers.quantaroute.com](https://developers.quantaroute.com), QuantaRoute already runs Resend on shared infrastructure. Skip steps 1–5 below — just set `enableEmailAuth={true}` and register your domain in the portal. The steps below apply only when **self-hosting** the `checkout-email-otp` Edge Function in your own Supabase project.
384
+
385
+ 1. **Create a Resend account** at [resend.com](https://resend.com) — free tier covers ~3 000 emails / month.
386
+
387
+ 2. **Verify your sending domain** (e.g. `checkout.yourbrand.com` or `yourbrand.com`):
388
+ - Go to **Resend → Domains → Add domain**
389
+ - Add the DNS records shown (SPF, DKIM, DMARC) to your DNS provider
390
+ - Wait for "Verified" status (usually under 5 minutes with Cloudflare; up to 48 h with others)
391
+
392
+ 3. **Get an API key** — Resend → API Keys → Create. Restrict it to **Send access** only.
393
+
394
+ 4. **Set secrets on the `checkout-email-otp` Edge Function:**
395
+
396
+ In [Supabase Dashboard](https://supabase.com/dashboard) → your project → Edge Functions → Secrets:
397
+
398
+ | Secret | Value |
399
+ |---|---|
400
+ | `RESEND_API_KEY` | `re_...` from Resend |
401
+ | `RESEND_FROM_EMAIL` | A verified sender address, e.g. `checkout@yourbrand.com` |
402
+
403
+ 5. **Deploy the Edge Function** (if not already done):
404
+
405
+ ```bash
406
+ supabase functions deploy checkout-email-otp --project-ref <your-project-ref> --no-verify-jwt
407
+ ```
408
+
409
+ **Required env vars (frontend):**
410
+
411
+ ```env
412
+ NEXT_PUBLIC_QUANTAROUTE_KEY=dp_...
413
+ NEXT_PUBLIC_MERCHANT_ID=your-uuid-from-developer-portal
414
+ NEXT_PUBLIC_SUPABASE_FUNCTION_URL=https://<project-ref>.supabase.co/functions/v1
415
+ ```
416
+
417
+ ---
418
+
419
+ #### Per-merchant email template customisation
420
+
421
+ Set these columns directly on your `checkout.merchants` row (SQL or Supabase Table Editor). All are optional — omitting any falls back to the QuantaRoute default.
422
+
423
+ | Column | Type | Default | Effect |
424
+ |---|---|---|---|
425
+ | `email_from_name` | `text` | `"{brand} Checkout"` | "From" display name in the inbox, e.g. `"Fabindia"` |
426
+ | `email_logo_url` | `text` | *(text brand name)* | HTTPS URL of your logo (PNG/SVG, 180 × 48 px recommended) shown at the top of every OTP email |
427
+ | `email_subject_template` | `text` | `"{code} is your {brand} checkout code"` | Subject line; supports `{code}` and `{brand}` placeholders |
428
+
429
+ **Example SQL:**
430
+
431
+ ```sql
432
+ UPDATE checkout.merchants
433
+ SET
434
+ email_from_name = 'Fabindia',
435
+ email_logo_url = 'https://cdn.fabindia.com/logo-email.png',
436
+ email_subject_template = '{code} — verify your Fabindia order'
437
+ WHERE id = 'your-merchant-uuid';
438
+ ```
439
+
440
+ ---
441
+
442
+ ### Branding
443
+
444
+ | Prop | Type | Default | Platform |
445
+ |---|---|---|---|
446
+ | `brandColor` | `string` (hex) | `#0ea5e9` | all |
447
+ | `logoUrl` | `string` (URL) | – | all |
448
+ | `headerBanner` | `ReactNode` | – | web only |
449
+
450
+ ```tsx
451
+ <CheckoutWidget
452
+ apiKey="..."
453
+ brandColor="#7c3aed"
454
+ logoUrl="https://yourbrand.com/logo.png"
455
+ headerBanner={<p>🚚 Free shipping on orders over ₹499</p>}
456
+ onComplete={...}
457
+ />
458
+ ```
459
+
460
+ ### Analytics (client-side)
461
+
462
+ | Prop | Type | Default | Platform |
463
+ |---|---|---|---|
464
+ | `onCheckoutEvent` | `(event: CheckoutEvent) => void` | – | all |
465
+
466
+ Called on every step transition. Use it to forward events to MoEngage, Clevertap, GTM, or your own backend — no server-side integration required.
467
+
468
+ ```tsx
469
+ <CheckoutWidget
470
+ apiKey="..."
471
+ onCheckoutEvent={(event) => {
472
+ // event.type — e.g. 'phone_verified', 'location_confirmed', 'address_completed'
473
+ // event.step — widget step the user moved INTO
474
+ // event.buyerId — internal buyer UUID (after phone verification)
475
+ // event.digipin — DigiPin of the confirmed location
476
+ // event.timestamp — ISO 8601 timestamp
477
+
478
+ // MoEngage example:
479
+ Moengage.track_event(event.type, {
480
+ step: event.step,
481
+ buyerId: event.buyerId,
482
+ digipin: event.digipin,
483
+ });
484
+
485
+ // GTM example:
486
+ window.dataLayer?.push({ event: event.type, ...event });
487
+ }}
488
+ onComplete={...}
489
+ />
490
+ ```
491
+
492
+ **All event types:**
493
+
494
+ | Event | When fired | Auth channel |
495
+ |---|---|---|
496
+ | `phone_step_viewed` | Phone entry screen rendered | Phone |
497
+ | `otp_sent` | OTP dispatched via MSG91 | Phone |
498
+ | `phone_verified` | SMS OTP correct; session created | Phone |
499
+ | `email_step_viewed` | Email input screen rendered | Email |
500
+ | `email_otp_sent` | OTP dispatched via Resend | Email |
501
+ | `email_verified` | Email OTP correct; session created | Email |
502
+ | `auth_skipped` | Buyer tapped "Skip" | Both |
503
+ | `saved_addresses_viewed` | Saved address list rendered | – |
504
+ | `saved_address_selected` | Buyer chose a saved address (skips map) | – |
505
+ | `map_step_viewed` | Map pin step rendered | – |
506
+ | `location_confirmed` | Buyer tapped "Confirm location" | – |
507
+ | `form_step_viewed` | Address detail form rendered | – |
508
+ | `address_completed` | Full address submitted | – |
509
+ | `widget_reset` | Buyer tapped "Change address" | – |
510
+
304
511
  ---
305
512
 
306
513
  ## `CompleteAddress` output
@@ -389,6 +596,115 @@ function MyCheckout() {
389
596
 
390
597
  ---
391
598
 
599
+ ## Supabase setup
600
+
601
+ > Only needed when using **`enablePhoneAuth`**. Skip this section for the basic map-only widget.
602
+
603
+ ### 1 · Get your merchant credentials
604
+
605
+ Sign up at **[developers.quantaroute.com/onboarding/merchant](https://developers.quantaroute.com/onboarding/merchant)**. The wizard auto-provisions:
606
+
607
+ - `merchant_id` — your UUID in `checkout.merchants`
608
+ - Geocoding API key (for address search and reverse-geocoding)
609
+ - Integration snippet with all values filled in
610
+
611
+ ### 2 · Deploy Edge Functions
612
+
613
+ The Edge Functions live in `supabase/functions/` inside this repo. Deploy all of them:
614
+
615
+ ```bash
616
+ # Address CRUD + COD eligibility
617
+ supabase functions deploy checkout-addresses --project-ref <your-project-ref> --no-verify-jwt
618
+
619
+ # Email OTP auth (Resend — no TRAI dependency, ship now)
620
+ supabase functions deploy checkout-email-otp --project-ref <your-project-ref> --no-verify-jwt
621
+
622
+ # Phone OTP auth (MSG91 + TRAI DLT — deploy now, enable when DLT is ready)
623
+ supabase functions deploy checkout-otp --project-ref <your-project-ref> --no-verify-jwt
624
+
625
+ # Session expiry — fires session.expired webhooks; runs every 10 min via pg_cron
626
+ supabase functions deploy checkout-session-expiry --project-ref <your-project-ref> --no-verify-jwt
627
+ ```
628
+
629
+ ### 3 · Set Edge Function secrets
630
+
631
+ In the [Supabase Dashboard](https://supabase.com/dashboard) → your project → Edge Functions → Secrets:
632
+
633
+ **`checkout-email-otp` (required for email auth):**
634
+
635
+ | Secret | Value |
636
+ |---|---|
637
+ | `RESEND_API_KEY` | `re_...` — from [resend.com](https://resend.com) |
638
+ | `RESEND_FROM_EMAIL` | Verified sender address, e.g. `checkout@yourbrand.com` |
639
+
640
+ **`checkout-otp` (required for phone/SMS auth — set when TRAI DLT is approved):**
641
+
642
+ | Secret | Value |
643
+ |---|---|
644
+ | `MSG91_AUTHKEY` | Your MSG91 AuthKey ([setup guide](./docs/MSG91_INDIA_OTP_SETUP.md)) — must match the Edge Function env var name exactly |
645
+ | `MSG91_TEMPLATE_ID` | Your approved DLT OTP template ID |
646
+
647
+ ### 4 · Add your domain to the allowed list
648
+
649
+ In the developer portal at **[developers.quantaroute.com/dashboard/checkout](https://developers.quantaroute.com/dashboard/checkout)**, add your storefront's domain (e.g. `yourbrand.com`). The `checkout-email-otp` and `checkout-otp` Edge Functions enforce this list — requests from unlisted origins receive `403 Origin not allowed`.
650
+
651
+ ### Minimal Next.js integration
652
+
653
+ #### Email OTP (available now — no TRAI paperwork)
654
+
655
+ ```tsx
656
+ // app/checkout/page.tsx
657
+ 'use client';
658
+ import dynamic from 'next/dynamic';
659
+
660
+ const CheckoutWidget = dynamic(
661
+ () => import('@quantaroute/checkout').then((m) => m.CheckoutWidget),
662
+ { ssr: false }
663
+ );
664
+
665
+ export default function CheckoutPage() {
666
+ return (
667
+ <CheckoutWidget
668
+ apiKey={process.env.NEXT_PUBLIC_QUANTAROUTE_KEY!}
669
+ merchantId={process.env.NEXT_PUBLIC_MERCHANT_ID!}
670
+ supabaseFunctionBaseUrl={process.env.NEXT_PUBLIC_SUPABASE_FUNCTION_URL!}
671
+ enableEmailAuth={true} {/* ← email OTP via Resend */}
672
+ enableSearch={true}
673
+ brandColor="#your-brand-hex"
674
+ logoUrl="https://yourbrand.com/logo.png"
675
+ onComplete={(address) => {
676
+ // address.digipin, address.formattedAddress, address.pincode, ...
677
+ // → pass to your backend / payment gateway
678
+ }}
679
+ onCheckoutEvent={(event) => {
680
+ // email_step_viewed | email_otp_sent | email_verified | address_completed | ...
681
+ console.log('[checkout]', event.type, event);
682
+ }}
683
+ />
684
+ );
685
+ }
686
+ ```
687
+
688
+ #### Phone OTP (enable when TRAI DLT is approved — same widget, one prop swap)
689
+
690
+ ```tsx
691
+ <CheckoutWidget
692
+ ...
693
+ enablePhoneAuth={true} {/* swap enableEmailAuth → enablePhoneAuth when SMS is ready */}
694
+ enableEmailAuth={false}
695
+ />
696
+ ```
697
+
698
+ **Required env vars:**
699
+
700
+ ```env
701
+ NEXT_PUBLIC_QUANTAROUTE_KEY=dp_...
702
+ NEXT_PUBLIC_MERCHANT_ID=your-uuid-from-developer-portal
703
+ NEXT_PUBLIC_SUPABASE_FUNCTION_URL=https://<project-ref>.supabase.co/functions/v1
704
+ ```
705
+
706
+ ---
707
+
392
708
  ## Architecture
393
709
 
394
710
  ```
@@ -451,6 +767,79 @@ The offline DigiPin algorithm is the official India Post implementation:
451
767
 
452
768
  ---
453
769
 
770
+ ## Documentation
771
+
772
+ | Doc | Description |
773
+ |-----|-------------|
774
+ | [Changelog](./CHANGELOG.md) | Version history and release notes |
775
+ | [Checkout roadmap](./docs/CHECKOUT_ROADMAP.md) | Feature phases and implementation status |
776
+ | [MSG91 OTP setup](./docs/MSG91_INDIA_OTP_SETUP.md) | India SMS / DLT configuration for phone OTP |
777
+ | [Brand teardown](./docs/brand-teardown.md) | Competitive analysis (Shopflo) |
778
+
779
+ ---
780
+
781
+ ## Security & integration
782
+
783
+ ### What ships in the npm package
784
+
785
+ The published tarball contains **no secrets** — only client-side widget code:
786
+
787
+ | Included | Excluded |
788
+ |---|---|
789
+ | `dist/lib/*.js` (Terser-minified ES + UMD) | `supabase/`, Edge Functions, migrations |
790
+ | `dist/lib/index.d.ts` | `demo/`, `docs/`, `openapi.yaml`, `.env*` |
791
+ | `dist/style.css` | `vite.config.ts`, dev tooling |
792
+ | `src/` (required for React Native / Metro) | `node_modules/` |
793
+
794
+ - **Geocoding `apiKey`** (`dp_…`) is designed for the browser bundle — rate-limited, scoped to your merchant plan.
795
+ - **Admin API key** (`qca_…`) must **never** ship in frontend code. Use it server-side only (`x-api-key` on `checkout-admin`).
796
+ - OTP delivery (Resend) and session minting run on **QuantaRoute-hosted Edge Functions**, not inside the npm bundle.
797
+ - **Consistent email OTP:** the same 6-digit code is stored per `(email, merchant)` and reused for up to **10 successful logins** (not single-use). Repeat send requests skip Resend when the code is still active. This reduces email cost but is weaker than banking-grade OTP — document for your shoppers if required by policy.
798
+
799
+ Verify before every publish:
800
+
801
+ ```bash
802
+ npm run type-check && npm run build:lib
803
+ npm pack --dry-run # confirm 36 files, no .env / supabase / demo
804
+ rg -i 're_|sk_|service.role|password' dist/ # should return no matches
805
+ ```
806
+
807
+ ### Merchant integration checklist (email OTP on web)
808
+
809
+ Use this when embedding `@quantaroute/checkout` on a **hosted QuantaRoute** storefront (onboarded via [developers.quantaroute.com](https://developers.quantaroute.com)):
810
+
811
+ 1. **Onboard** — complete [merchant onboarding](https://developers.quantaroute.com/onboarding/merchant); copy `merchantId`, geocoding `apiKey`, and `supabaseFunctionBaseUrl` from the wizard or [Checkout dashboard](https://developers.quantaroute.com/dashboard/checkout).
812
+ 2. **Install** — `npm install @quantaroute/checkout maplibre-gl` (+ CSS imports).
813
+ 3. **Env vars** — expose only public values (`NEXT_PUBLIC_QUANTAROUTE_KEY`, `NEXT_PUBLIC_MERCHANT_ID`, `NEXT_PUBLIC_SUPABASE_FUNCTION_URL`). Never commit `.env` to git.
814
+ 4. **Allowed domains** — in the developer portal, add every origin that will host the widget (e.g. `yourbrand.com`, `www.yourbrand.com`, `*.yourbrand.com` for subdomains). Both `checkout-otp` and `checkout-email-otp` reject requests from unlisted origins.
815
+ 5. **Enable auth** — set `enableEmailAuth={true}` with `merchantId` and `supabaseFunctionBaseUrl`. Auth is **opt-in** and **web-only** today (React Native widget does not include the email OTP steps).
816
+ 6. **Optional branding** — `brandColor`, `logoUrl`; per-merchant email template columns (`email_from_name`, `email_logo_url`, `email_subject_template`) in the portal.
817
+ 7. **Handle completion** — implement `onComplete` to pass the `CompleteAddress` to your cart / payment gateway. Built-in payment (`enablePayment`) and COD (`enableCod`) are separate opt-in props.
818
+
819
+ > **Resend is platform-managed for hosted merchants.** QuantaRoute operates the shared `checkout-email-otp` Edge Function and Resend sender (`RESEND_API_KEY`, `RESEND_FROM_EMAIL`). Merchants do **not** need their own Resend account for the hosted MVP. See [Setting up Resend](#setting-up-resend-required-for-enableemailauth) only if you self-host the Edge Functions.
820
+
821
+ ### Platform responsibilities (QuantaRoute)
822
+
823
+ | Item | Owner |
824
+ |---|---|
825
+ | Deploy & operate `checkout-email-otp`, `checkout-addresses`, `checkout-session-expiry` | QuantaRoute |
826
+ | `RESEND_API_KEY`, `RESEND_FROM_EMAIL`, Supabase service role | QuantaRoute (Edge Function secrets) |
827
+ | `checkout.merchants` provisioning, `allowed_domains`, email template columns | QuantaRoute portal + DB |
828
+ | Buyer OTP consistent reuse (10 logins per code), fresh-code limit (3 / 24h), verify lockout (5 fails → 15 min) | Edge Function |
829
+ | Geocoding API key issuance & plan rate limits | QuantaRoute |
830
+
831
+ ### Maintainer publish checklist
832
+
833
+ When publishing a new version to npm (maintainers only):
834
+
835
+ 1. Enable **npm 2FA** on the `@quantaroute` org account (publish + modify).
836
+ 2. Run `npm run type-check && npm run build:lib && npm pack --dry-run` — confirm tarball contents.
837
+ 3. Confirm no `.env`, `.pem`, or `supabase/` paths in the pack list.
838
+ 4. Publish from a **clean git tag** with provenance: `npm publish --provenance --access public`.
839
+ 5. Do **not** bump version in the same change unless releasing; current version is `1.4.0`.
840
+
841
+ ---
842
+
454
843
  ## Development
455
844
 
456
845
  ```bash
@@ -483,33 +872,7 @@ npx expo run:android # requires Android Studio
483
872
 
484
873
  ## Changelog
485
874
 
486
- ### v1.2.0
487
-
488
- - **iOS & Android support** via `expo-osm-sdk` (MapLibre GL Native)
489
- - `MapPinSelector.native.tsx` — draggable OSMView pin
490
- - `AddressForm.native.tsx` — `TextInput` / `ScrollView` / `Modal` locality picker
491
- - `CheckoutWidget.native.tsx` — `SafeAreaView` layout with identical flow logic
492
- - `useGeolocation.native.ts` — GPS via `expo-location`
493
- - `checkout.native.ts` — complete `StyleSheet` design system (light + dark)
494
- - `expo-plugin.js` — one-line `app.json` setup for iOS/Android
495
- - `babel.config.js` — Metro transpilation config
496
- - `mapHeight` prop now accepts `number` (native) or `string` (web, e.g. `'380px'`)
497
- - All native peer dependencies marked optional (zero impact on web bundles)
498
-
499
- ### v1.1.x
500
-
501
- - DigiPin badge overlay on map
502
- - Locality alternatives dropdown
503
- - OSM address pre-fill (building name, road, suburb)
504
- - India boundary GeoJSON overlay
505
-
506
- ### v1.0.0
507
-
508
- - Initial release: MapLibre GL + Carto Positron
509
- - Offline DigiPin generation
510
- - QuantaRoute API integration
511
- - Mobile-first responsive design
512
- - Dark mode, reduced-motion, keyboard accessible
875
+ See [CHANGELOG.md](./CHANGELOG.md) for version history. Current release: **v1.4.1**.
513
876
 
514
877
  ---
515
878