Repository navigation
docs: scope markets, paper trading and OTC wording to account regions - #1305
Merged
Merged
Conversation
twosugar
added a commit
that referenced
this pull request
Oct 26, 2026
…e quote store (#1306) ## Problem - US users saw the navbar **Pricing**, the homepage **See pricing** button and the paid plans on `/pricing` (LBUS does not sell these OpenAPI quote packages). - The paid plan prices were hard-coded in `HK$` and no longer matched the store (HK LV2 OpenAPI monthly 718 on the page vs 498 in the store; OPRA monthly 40 vs 28). ## Change **1. Hide pricing for US users** (`feat(pricing): hide pricing entries…`) New `isUSUser()` in `@longbridge/openapi-utils` (`packages/utils/src/us-user.ts`), decided in order: 1. Logged in → `app_id` cookie is a US tenant (`longbridge_us` / `longbridge_us_uat`) 2. Not logged in → `region` cookie is `US` (case-insensitive) 3. No `region` cookie → `x-ip-region` header from the portal `GET /api/_ping` (same endpoint h5hub / longbridge-websites use) Cached per page; any failure counts as non-US. When true, hides the navbar Pricing link (desktop + mobile), the homepage *See pricing* button and the *Subscribe only to what you need* plans. Free tier, comparison table and FAQ stay. **2. Load plan prices from the quote store** (`feat(pricing): load paid quote plan prices…`) `GET /v2/rewards/quote_product_list?account_channel=lb` with `x-app-id: longbridge` (no login needed; CORS allows the docs origins and `x-app-id`), matched by `package_key` `HK_L2_International_OpenAPI` / `US_OPRA_LV1_OpenAPI`: - Currency from each SKU — no hard-coded symbol. - Price = `real_price`; `per_month_price` shown for quarterly / annual; when `price > real_price`, discount % and original price are shown. - Billing-cycle tabs built from `card_duration` (1/2/3 = month/quarter/year, 5 = auto-renew, same enum as h5hub opa) — only cycles the API returns. Production currently returns 1/2/3 only, so *Auto-renew* is not shown; it appears automatically once the store returns it. - Loading / failure → `—`. ## Verification (local dev against production portal data) Local dev cannot call the portal directly (CORS), so it was tested through a throwaway local proxy that forwards to `mr.lbkrs.com` and adds CORS headers (not committed). | Cycle | HK LV2 Advanced | OPRA US Options | |---|---|---| | Monthly | HKD 498 /mo | HKD 28 /mo | | Quarterly | HKD 998 /quarter, ≈HKD 333/mo | HKD 58 /quarter, ≈HKD 19/mo | | Annual | HKD 3698 /year −38%, ≈HKD 308/mo, was HKD 5976 | HKD 188 /year −44%, ≈HKD 16/mo, was HKD 336 | - `/zh-CN/pricing` renders 月付 / 季付 / 年付 with the same data. - `region=US` → Pricing link, See pricing and the paid plans are hidden; `region=hk` → shown; no `region` → `/api/_ping` called, `x-ip-region: HK` read, shown. - Logged-in branch tested by stubbing the login bridge and calling `isUSUser()` (US app_id → true even with `region=hk`; HK app_id → false even with `region=US`). - In a real browser on `open.longbridge.com` and `open-canary.longbridge.xyz`, `/api/_ping` returns 200 and `x-ip-region` is readable. - oxlint: clean on the changed files. Not verified: a real US IP end-to-end, and a real logged-in US session on this branch. ## Notes - Canary portal data has no `US_OPRA_LV1_OpenAPI` and only annual for HK LV2, so on canary the OPRA card shows `—` and fewer cycles. - The US tenant `app_id` list now exists in three places (`BaseLayout.astro` inline bootstrap, `packages/tryit`, and the new file); the new file notes they must match. - Rebased onto #1305 (pricing FAQ wording) without conflicts. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docs site is one build served to both AP (Longbridge HK / SG) and Longbridge US users, so this scopes region-specific claims instead of hiding them:
qa/general,qa/trade, all locales): paper accounts are AP-only; market coverage states which products apply to AP vs Longbridge US accounts; removes the "short selling is supported for US stocks" and "OTC … not supported in paper accounts" sentences.Pricing, Agent Platform, short-selling pages, crypto account wording and legal/footer links are left for separate decisions.
🤖 Generated with Claude Code