Skip to content

Add mapping storefront pages with Polar checkout flow#10

Merged
DmitryMatv merged 7 commits intomainfrom
t3code/mapping-files-storefront-pages
Mar 19, 2026
Merged

Add mapping storefront pages with Polar checkout flow#10
DmitryMatv merged 7 commits intomainfrom
t3code/mapping-files-storefront-pages

Conversation

@DmitryMatv
Copy link
Owner

Summary

  • Add a new mapping storefront with dedicated index and product pages for UNSPSC↔CPV mapping files.
  • Introduce mapping_store product metadata model and sample CSV assets, plus sitemap and navigation updates to surface mappings pages.
  • Add frontend storefront logic to start mapping checkout, handle button states/errors, and show success banners after redirect.
  • Add backend /api/create-mapping-checkout endpoint using Polar, including shared return URL host validation.
  • Extend static cache profile handling for downloadable media/text assets (.pdf, .zip, .xlsx, .csv).
  • Add/adjust tests for storefront behavior, mapping storefront routes, payments checkout auth/flow, and static headers.

Testing

  • app/assets/ts/storefront.test.ts: verifies checkout request payload (slug + absolute return_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.

- 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
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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
@DmitryMatv DmitryMatv marked this pull request as draft March 17, 2026 19:47
@DmitryMatv DmitryMatv marked this pull request as ready for review March 17, 2026 19:48
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 }}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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
@DmitryMatv DmitryMatv merged commit 63e4daf into main Mar 19, 2026
@DmitryMatv DmitryMatv deleted the t3code/mapping-files-storefront-pages branch March 19, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant