allow appearance to be set on session #1208
Open
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.
Summary
This pull request introduces a robust and consistent approach for handling CSS variable case conversion between kebab-case (used in CSS and local context) and camelCase (required by GraphQL APIs). It refactors the theme and appearance logic to prioritize session-based overrides and ensures that variable merging and conversion are handled correctly throughout the checkout flow.
Case Conversion Utilities:
case-conversion.tsfor converting between kebab-case and camelCase, including helpers to convert entire objects for use with GraphQL and CSS.Theme and Appearance Logic:
use-theme.tsxto prioritize session appearance over context appearance, ensuring the theme reflects the most relevant user/session data.use-variables.tsxto merge CSS variables with the following priority: override variables > session appearance variables > context appearance variables. Session variables are converted from camelCase to kebab-case for CSS application. [1] [2]GraphQL Integration and Type Safety:
createCheckoutSessioningodaddy.tsto accept appearance variables in kebab-case, convert them to camelCase for GraphQL, and ensure correct typing for input objects. [1] [2]mutations.tsto support all appearance variable fields in camelCase, matching the updated conversion and merging logic.These changes streamline appearance customization, improve code clarity, and ensure seamless communication between the frontend and GraphQL backend.
Changeset
Test Plan