ci: add NEXT_PUBLIC_TRANSAK_* env vars to preview and cloudfront deploys - #653
Closed
victhorbi wants to merge 2 commits into
Closed
ci: add NEXT_PUBLIC_TRANSAK_* env vars to preview and cloudfront deploys#653victhorbi wants to merge 2 commits into
victhorbi wants to merge 2 commits into
Conversation
…dfront (production) deploys
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe deployment workflows now expose Transak configuration during production and preview builds. Production uses secret values and the ChangesTransak deployment configuration
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
|
Size Change: 0 B Total Size: 8.92 MB ℹ️ View Unchanged
|
- deploy-preview uses NEXT_PUBLIC_TRANSAK_API_KEY_STAGING - deploy-cloudfront uses NEXT_PUBLIC_TRANSAK_API_KEY_PROD Keeps the prod site inert (Buy hidden) until the production key exists: key absent = transak config disabled in the example wrapper.
Vombato
approved these changes
Aug 5, 2026
Collaborator
Author
|
Changes moved into PR #649 |
victhorbi
added a commit
that referenced
this pull request
Aug 6, 2026
* feat: add fiat and crypto subscription payment components - Add useBuyCrypto, useFiatCheckout, useSubscription, useSubscriptionCheckout hooks - Add FiatCheckoutModal, PayWithFiatButton, SubscribeButton, SubscriptionCheckoutModal components - Add FiatOnramp content in AccountModal - Add subscription demo in PaymentsDemo example - Add crypto payment method to SubscriptionCheckout (VET/ERC20) - Extend SubscriptionPlan type with optional cryptoPayment field - Add i18n translation keys for fiat/crypto payments - Fix Privy v3 compatibility (optional clientId, cross-app-connect deps) - Mock fallback for useSubscription when API base URL not configured - Add Solana deps to root workspace (Privy v3 transitive) * feat: switch fiat onramp from Privy/Stripe to Transak (native VET support) BREAKS: Replaces useBuyCrypto, useFiatCheckout, FiatCheckoutModal, PayWithFiatButton, FiatOnrampContent with Transak equivalents. Adds: - useTransakCheckout hook (dual-mode widget URL: apiKey-only for sandbox, widgetUrlBuilder for production) - TransakCheckoutModal, PayWithTransakButton components - TransakOnrampContent in AccountModal - @transak/ui-js-sdk dependency - transak config on VeChainKitProvider - Subscription fiat path opens Transak to fund, then creates sub Removes: - Privy useAddFunds / useBuyCrypto dependency - @stripe/crypto peer dep - All Privy/Stripe-specific translations * fix: keep Transak modal open on success + remove dead code in subscribe - PayWithTransakButton: isOpen stays true on 'success' so the success screen is visible; only closes when user dismisses - useSubscriptionCheckout: removed unreachable createSubscription fallthrough (was only reachable for crypto-without-cryptoPayment, an impossible UI state); replaced with a clear error * fix: auto-hide 'Buy' quick action when transak.apiKey is not configured Without this, the Buy button rendered unconditionally and only threw 'Transak is not configured' after the user filled the form and clicked Continue. Now it stays hidden unless the developer passes a transak config to VeChainKitProvider. * feat: gate 'Pay with Card' on transak.apiKey presence When the developer does not pass a Transak API key to VeChainKitProvider, kit-internal UI no longer surfaces fiat-only options: - useSubscriptionCheckout: derives hasFiat from config; default paymentMethod for non-crypto plans is 'crypto' when fiat is unavailable - SubscriptionCheckoutModal: 'Pay with Card' tab hidden unless hasFiat; plans with neither crypto nor fiat show an info note instead of the Subscribe button - en.json: 'No payment method available for this plan.' key * feat: require Transak Secure Widget URL flow Transak deprecated direct widget URLs (apiKey in the query string); widgets now only load from a sessionId-based URL minted by the Create Widget URL API (POST /api/v2/auth/session), called from the partner backend with the API secret. - TransakConfig.widgetUrlBuilder is now required; apiKey optional - useTransakCheckout: removed buildDirectUrl fallback, errors clearly when widgetUrlBuilder is missing - hasFiat / Buy quick-action gating now checks widgetUrlBuilder - example: /api/transak/widget-url route does refresh-token -> create-widget-url with x-user-ip; wrapper wires widgetUrlBuilder - .env.example: TRANSAK_API_KEY / TRANSAK_API_SECRET server vars * fix: embed Transak widget in host modal to stop focus flicker The Transak SDK's default behavior appends its own full-screen overlay to document.body, outside the Chakra modal. Chakra's focus trap then detects focus escaping the modal and pulls it back whenever the user clicks into Transak's inputs, causing the email field to constantly lose focus. - useTransakCheckout: pass containerId so the widget renders as an iframe inside the host modal; expose TRANSAK_WIDGET_CONTAINER_ID; replace the SDK's close() with cleanup() (which actually removes the iframe in container mode) and clear the container on open/close/unmount - TransakCheckoutModal: render the embed container during processing and disable the modal focus trap (allowExternalFocus) while the widget is active * fix: lower demo amount to Transak minimum and fix widget scrollbars - Demo/button/hook/modal defaults changed from $50 to $20 (Transak's minimum card order), so sandbox testing is cheaper - TransakCheckoutModal: widget container height is now viewport-aware (calc(100vh - 240px), 420-620px) and mobile uses a near-fullscreen bottom sheet, so the widget's own scroll is the only scrollbar instead of a double scrollbar (modal + iframe) * fix: lower default Transak amount to $10 minimum Transak's minimum order with light KYC is $10; the demo and component defaults now use it instead of $20. * fix: theme standalone Transak/subscription modals and fix cross-app-connect Privy config * feat: auto-derive Transak environment from connected network * docs: add Transak on-ramp backend setup guide * chore: remove half-implemented subscription flow, revert Privy to v2, restore typecheck gate - Remove useSubscription, useSubscriptionCheckout, SubscriptionModal, SubscriptionCheckoutModal, SubscribeButton and stripe-subscriptions docs (full signed-typed-message subscription flow lands in a follow-up PR) - Revert @privy-io/react-auth to 2.25.0 and @privy-io/cross-app-provider to ^0.3.4 in kit and cross-app-connect; drop root Solana deps; restore v2 provider shapes (Privy v3 bump deferred to its own PR) - Restore tsc --noEmit gate in kit build and add Typecheck step to CI - Remove subscription-only i18n keys * fix: address CodeRabbit findings on Transak checkout and reference route - Add 10s timeouts to outbound Transak API calls and an in-memory rate limit on the widget-url route (unauthenticated minting protection) - Guard instanceRef assignment with the generation counter so a stale widget never overwrites the active instance - Validate walletAddress with isAddress before building the widget URL - Return to the form step when the Transak widget closes without success - Fix docs: fence language and valid JSON request example * feat(next-template): allow overriding the Transak mini-server URL via NEXT_PUBLIC_TRANSAK_API_URL * feat(homepage): wire Transak onramp + pass env vars to preview deploy - Add transak prop to homepage VechainKitProviderWrapper (same pattern as next-template): Buy VET button appears in AccountModal when NEXT_PUBLIC_TRANSAK_API_KEY is set, calling the mini-server at NEXT_PUBLIC_TRANSAK_API_URL - Pass NEXT_PUBLIC_TRANSAK_API_KEY and NEXT_PUBLIC_TRANSAK_API_URL through deploy-preview.yaml so the homepage preview build inlines them - Document both vars in examples/homepage/.env.example * chore: trigger preview redeploy with Transak env vars * feat: wire Transak environment + add mandatory integration requirements docs - Both providers (homepage + next-template) pass NEXT_PUBLIC_TRANSAK_ENVIRONMENT in the fetch body (not as top-level config prop) to the mini-server - deploy-preview.yaml: NEXT_PUBLIC_TRANSAK_ENVIRONMENT='staging' - deploy-cloudfront.yaml: NEXT_PUBLIC_TRANSAK_ENVIRONMENT='production' - docs/recipes/transak-onramp.md: section 6 with credential isolation, x-api-key, x-user-ip, backend IP whitelisting, CORS, rate limiting, partner onboarding checklist; env vars table updated * ci: split Transak API key secret per environment - deploy-preview uses NEXT_PUBLIC_TRANSAK_API_KEY_STAGING - deploy-cloudfront uses NEXT_PUBLIC_TRANSAK_API_KEY_PROD Keeps the prod site inert (Buy hidden) until the production key exists. Re-applies 808f04a, lost when #653 was folded into this branch. * fix: harden rate-limit IP resolution + guard stale generation in transak checkout catch - widget-url route: resolveClientIp prefers x-real-ip (written by trusted proxies, unspoofable from the client) over the leftmost x-forwarded-for entry; falls back to 'unknown' bucket when no public IP is available so attackers cannot trivially rotate headers to bypass the rate limit. - useTransakCheckout open(): guard the catch block with genRef.current !== gen so a superseded generation does not overwrite the active generation's error/status (matches the guard already used before instance assignment). --------- Co-authored-by: Luca Bandini <luca.bandini@vechain.org>
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.
Description
deploy-preview.yamlruns viapull_request_target, which uses the workflow definition from main — not the PR branch. The Transak env vars added in PR #649 are therefore ignored unless they're on main too.This PR adds the Transak environment variables to both deploy workflows on main:
deploy-preview.yaml:NEXT_PUBLIC_TRANSAK_API_KEY,NEXT_PUBLIC_TRANSAK_API_URL,NEXT_PUBLIC_TRANSAK_ENVIRONMENT: 'staging'deploy-cloudfront.yaml: same plusNEXT_PUBLIC_TRANSAK_ENVIRONMENT: 'production'These are consumed at build time by the homepage's
VechainKitProviderWrapperto wire the kit's Built-in Buy VET button and point it at the deployed mini-server (lambda).Helper PR for #649 — no code changes, only CI env.
Summary by CodeRabbit