Skip to content

feat(wake): use checkoutUrl as GraphQL storefront endpoint - #1653

Open
guitavano wants to merge 1 commit into
mainfrom
guitavano/wake-api-integration
Open

feat(wake): use checkoutUrl as GraphQL storefront endpoint#1653
guitavano wants to merge 1 commit into
mainfrom
guitavano/wake-api-integration

Conversation

@guitavano

@guitavano guitavano commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What

Changes the Wake Storefront GraphQL client to point at ${checkoutUrl}/graphql instead of the hardcoded https://storefront-api.fbits.net/graphql.

-    endpoint: "https://storefront-api.fbits.net/graphql",
+    endpoint: `${checkoutUrl}/graphql`,

Why

The Storefront GraphQL endpoint is now derived from the account's configured checkoutUrl (e.g. https://checkout.erploja2.com.br), so the GraphQL API is served from the same domain as the rest of the Wake integration instead of the shared storefront-api.fbits.net host.

Notes

  • checkoutUrl is already a required app prop (wake/mod.ts), so no new configuration is needed.
  • The TCS-Access-Token auth header (Storefront Token) is unchanged.

🤖 Generated with Claude Code


Summary by cubic

Switch the Storefront GraphQL client to ${checkoutUrl}/graphql instead of the shared https://storefront-api.fbits.net/graphql, so requests go to the account’s checkout domain. No config changes needed; the TCS-Access-Token header stays the same.

Written for commit 1d03676. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Updated the Wake storefront GraphQL connection to use the configured checkout URL, improving compatibility with custom storefront configurations.

Point the Storefront GraphQL client to ${checkoutUrl}/graphql instead of
the hardcoded https://storefront-api.fbits.net/graphql.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.160.1 update
  • 🎉 for Minor 0.161.0 update
  • 🚀 for Major 1.0.0 update

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d9c2996f-91a2-4f1a-b63d-4f721564cc09

📥 Commits

Reviewing files that changed from the base of the PR and between 292aed0 and 1d03676.

📒 Files selected for processing (1)
  • wake/mod.ts

📝 Walkthrough

Walkthrough

The Wake storefront GraphQL endpoint now uses ${checkoutUrl}/graphql instead of a fixed storefront API URL.

Changes

Wake GraphQL endpoint

Layer / File(s) Summary
Configure the storefront GraphQL endpoint
wake/mod.ts
The client builds the GraphQL endpoint from the configured checkoutUrl.

Estimated code review effort: 1 (Trivial) | ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main endpoint change in the pull request.
Description check ✅ Passed The description explains what changed, why it changed, configuration impact, and authentication impact, but it omits the issue, Loom, and demonstration links.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch guitavano/wake-api-integration

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="wake/mod.ts">

<violation number="1" location="wake/mod.ts:112">
P2: Trailing slash in `checkoutUrl` produces double-slash path `//graphql`. If `checkoutUrl` ends with `/`, interpolation yields `https://...//graphql` which some servers reject as a 404. `wake/hooks/context.ts:89` already uses the safe `new URL('/graphql', checkoutUrl)` pattern — follow that same pattern here.</violation>

<violation number="2" location="wake/mod.ts:112">
P2: The `checkoutApi` on line 117 defensively falls back to a default URL with `checkoutUrl ?? \`https://${account}.checkout.fbits.store\``, but the storefront GraphQL endpoint on the changed line uses `${checkoutUrl}/graphql` with no fallback at all. If `checkoutUrl` is somehow empty, undefined, or resolves to an empty string at runtime, the storefront client will break — its endpoint would be `/graphql` (a relative URL) instead of an absolute one.

Recommendation: apply the same fallback pattern used for `checkoutApi`, e.g., `` `\${checkoutUrl ?? `https://${account}.checkout.fbits.store`}/graphql` `` or normalize `checkoutUrl` once at the top of `App()`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread wake/mod.ts
//22e714b360b7ef187fe4bdb93385dd0a85686e2a
const storefront = createGraphqlClient({
endpoint: "https://storefront-api.fbits.net/graphql",
endpoint: `${checkoutUrl}/graphql`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Trailing slash in checkoutUrl produces double-slash path //graphql. If checkoutUrl ends with /, interpolation yields https://...//graphql which some servers reject as a 404. wake/hooks/context.ts:89 already uses the safe new URL('/graphql', checkoutUrl) pattern — follow that same pattern here.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At wake/mod.ts, line 112:

<comment>Trailing slash in `checkoutUrl` produces double-slash path `//graphql`. If `checkoutUrl` ends with `/`, interpolation yields `https://...//graphql` which some servers reject as a 404. `wake/hooks/context.ts:89` already uses the safe `new URL('/graphql', checkoutUrl)` pattern — follow that same pattern here.</comment>

<file context>
@@ -109,7 +109,7 @@ For help: https://wakecommerce.readme.io/docs/storefront-api-criacao-e-autentica
   //22e714b360b7ef187fe4bdb93385dd0a85686e2a
   const storefront = createGraphqlClient({
-    endpoint: "https://storefront-api.fbits.net/graphql",
+    endpoint: `${checkoutUrl}/graphql`,
     headers: new Headers({ "TCS-Access-Token": `${stringStorefrontToken}` }),
     fetcher: fetchSafe,
</file context>
Suggested change
endpoint: `${checkoutUrl}/graphql`,
endpoint: new URL("/graphql", checkoutUrl).href,

Comment thread wake/mod.ts
//22e714b360b7ef187fe4bdb93385dd0a85686e2a
const storefront = createGraphqlClient({
endpoint: "https://storefront-api.fbits.net/graphql",
endpoint: `${checkoutUrl}/graphql`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The checkoutApi on line 117 defensively falls back to a default URL with checkoutUrl ?? \https://${account}.checkout.fbits.store`, but the storefront GraphQL endpoint on the changed line uses ${checkoutUrl}/graphqlwith no fallback at all. IfcheckoutUrlis somehow empty, undefined, or resolves to an empty string at runtime, the storefront client will break — its endpoint would be/graphql` (a relative URL) instead of an absolute one.

Recommendation: apply the same fallback pattern used for checkoutApi, e.g., `\${checkoutUrl ?? `https://${account}.checkout.fbits.store`}/graphql` or normalize checkoutUrl once at the top of App().

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At wake/mod.ts, line 112:

<comment>The `checkoutApi` on line 117 defensively falls back to a default URL with `checkoutUrl ?? \`https://${account}.checkout.fbits.store\``, but the storefront GraphQL endpoint on the changed line uses `${checkoutUrl}/graphql` with no fallback at all. If `checkoutUrl` is somehow empty, undefined, or resolves to an empty string at runtime, the storefront client will break — its endpoint would be `/graphql` (a relative URL) instead of an absolute one.

Recommendation: apply the same fallback pattern used for `checkoutApi`, e.g., `` `\${checkoutUrl ?? `https://${account}.checkout.fbits.store`}/graphql` `` or normalize `checkoutUrl` once at the top of `App()`.</comment>

<file context>
@@ -109,7 +109,7 @@ For help: https://wakecommerce.readme.io/docs/storefront-api-criacao-e-autentica
   //22e714b360b7ef187fe4bdb93385dd0a85686e2a
   const storefront = createGraphqlClient({
-    endpoint: "https://storefront-api.fbits.net/graphql",
+    endpoint: `${checkoutUrl}/graphql`,
     headers: new Headers({ "TCS-Access-Token": `${stringStorefrontToken}` }),
     fetcher: fetchSafe,
</file context>

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