Add mapping storefront pages with Polar checkout flow#10
Conversation
- add mapping product catalog, index, and product templates with sample CSV assets - implement `/api/create-mapping-checkout` and shared return URL validation - add storefront frontend logic/tests and wire navigation/sitemap links
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0b5ab9bea8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- replace placeholder Polar product IDs for UNSPSC/CPV mapping products - build checkout return URL from `window.location.origin` in storefront flow/tests - JSON-encode product/FAQ schema fields in `mapping_product.html` to avoid invalid JSON-LD - treat font files as static code cache profile (not media) and clean up timeout typings
- Use `Parameters<typeof clearTimeout>[0]` for `restoreTimeouts` handle type - Let TypeScript infer `createAnimationFrameController` return type in tests
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1525aaf65d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Download free sample | ||
| </a> | ||
| <button type="button" data-mapping-buy-button data-mapping-slug="{{ product.slug }}" | ||
| data-return-url="{{ canonical_url }}" |
There was a problem hiding this comment.
Use host-relative return URL for product buy button
data-return-url is hardcoded to canonical_url (https://classifast.com/...). On any non-production host (for example local, staging, or another allowed domain), storefront.ts sends that value to /api/create-mapping-checkout, but validate_return_url accepts only the current request host (plus explicit allowlist), so checkout creation returns 400 Invalid return_url and the product-page “Buy with Polar” flow fails. Use a host-relative URL (e.g. url_for('show_mapping_product_page', ...)) so the frontend resolves it to the active origin.
Useful? React with 👍 / 👎.
- Rename storefront routes and template references from `/mappings` to `/mapping` - Add 301 redirects from legacy `/mappings...` URLs to new singular paths - Update sitemap, checkout/storefront tests, and canonical links - Extract shared footer into `site_footer.html` and include it across pages
- add `coverage_summary` to mapping products and surface it on index/product pages - update mapping SEO/meta, CTA copy, and classifier page nav styling/content - serve sample downloads with the actual file basename and update tests accordingly
Summary
mapping_storeproduct metadata model and sample CSV assets, plus sitemap and navigation updates to surface mappings pages./api/create-mapping-checkoutendpoint using Polar, including shared return URL host validation..pdf,.zip,.xlsx,.csv).Testing
app/assets/ts/storefront.test.ts: verifies checkout request payload (slug + absolutereturn_url), redirect handling, error-state recovery, and checkout query param cleanup/success banner behavior.tests/test_mapping_storefront.py: validates mappings index/product storefront responses and related behavior.tests/test_payments_auth_and_checkout.py: covers mapping checkout endpoint behavior and payments auth/checkout flow updates.tests/test_static_headers.py: checks static header behavior after cache profile extension.bun run test/ backend test command: Not run.