-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add checkout autocomplete settings #6158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6158 +/- ##
==========================================
+ Coverage 39.33% 39.59% +0.26%
==========================================
Files 2413 2418 +5
Lines 39945 40072 +127
Branches 9138 9187 +49
==========================================
+ Hits 15711 15868 +157
+ Misses 24208 22963 -1245
- Partials 26 1241 +1215 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds new checkout autocomplete settings to the GraphQL schema, introducing fine-grained control over automatic checkout completion through a new CheckoutAutoCompleteInput type. The changes include adding delay and cut-off date settings while deprecating the simpler boolean flag.
- Introduces
CheckoutAutoCompleteInputwithenabled,delay, andcutOffDatefields for granular control - Updates
CheckoutSettingsto exposeautomaticCompletionDelayandautomaticCompletionCutOffDatefields - Deprecates
automaticallyCompleteFullyPaidCheckoutsin favor of the newautomaticCompletioninput
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| schema-main.graphql | Adds CheckoutAutoCompleteInput type, new fields to CheckoutSettings, and deprecates the old boolean flag. Also includes unrelated changes to Product fields and AttributeBulkUpdateErrorCode. |
| src/graphql/types.generated.ts | Generated TypeScript types reflecting the schema changes including new input types and updated mutation/query types |
| src/graphql/typePolicies.generated.ts | Generated Apollo type policies for the new checkout settings fields |
| src/graphql/hooks.generated.ts | Generated GraphQL fragment document with the new checkout settings fields |
| src/fragments/channels.ts | Updated channel details fragment to query the new automaticCompletionDelay and automaticCompletionCutOffDate fields |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| */ | ||
| automaticCompletion?: InputMaybe<CheckoutAutoCompleteInput>; | ||
| /** | ||
| * Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `authorize_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation mentions authorize_status but based on the context and the new CheckoutAutoCompleteInput type (line 1236), this should refer to charge_status instead. The original documentation at line 1236 correctly uses charge_status, and this deprecated field should maintain consistency with that original behavior.
|
|
||
| """ | ||
| Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `charge_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. | ||
| Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `authorize_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation mentions authorize_status but should refer to charge_status instead. This is inconsistent with the schema's own documentation for CheckoutAutoCompleteInput at line 28882, which correctly uses charge_status.
| Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `authorize_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. | |
| Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions. When enabled, the checkout will be automatically completed once the checkout `charge_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. |
| imageById( | ||
| """ID of a product image.""" | ||
| id: ID | ||
| id: ID! |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be an unrelated change to the PR's purpose of adding checkout autocomplete settings. The change makes the id parameter required (non-nullable) for the deprecated imageById field. This should be in a separate PR or explained in the PR description.
| id: ID! | |
| id: ID |
| } | ||
|
|
||
| enum AttributeBulkUpdateErrorCode { | ||
| enum AttributeBulkUpdateErrorCode @doc(category: "Attributes") { |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be an unrelated change to the PR's purpose of adding checkout autocomplete settings. Adding the @doc(category: "Attributes") directive to the AttributeBulkUpdateErrorCode enum should be in a separate PR or explained in the PR description.
| enum AttributeBulkUpdateErrorCode @doc(category: "Attributes") { | |
| enum AttributeBulkUpdateErrorCode { |
| cutOffDate?: InputMaybe<Scalars['DateTime']>; | ||
| /** The time in minutes after which the fully paid checkout will be automatically completed. Default is 30. Set to 0 for immediate completion. Should be less than the threshold for the oldest modified checkout eligible for automatic completion. */ | ||
| delay?: InputMaybe<Scalars['Minute']>; | ||
| /** Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `charge_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. */ |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after "transactions." before "When enabled". There should be a space between these two sentences for proper formatting.
| */ | ||
| automaticCompletion?: InputMaybe<CheckoutAutoCompleteInput>; | ||
| /** | ||
| * Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `authorize_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after "transactions." before "When enabled". There should be a space between these two sentences for proper formatting.
|
|
||
| """ | ||
| Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `charge_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. | ||
| Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `authorize_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after "transactions." before "When enabled". There should be a space between these two sentences for proper formatting.
| Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `authorize_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. | |
| Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions. When enabled, the checkout will be automatically completed once the checkout `authorize_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. |
|
|
||
| input CheckoutAutoCompleteInput @doc(category: "Checkout") { | ||
| """ | ||
| Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `charge_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount. |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after "transactions." before "When enabled". There should be a space between these two sentences for proper formatting.
| mediaById( | ||
| """ID of a product media.""" | ||
| id: ID | ||
| id: ID! |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be an unrelated change to the PR's purpose of adding checkout autocomplete settings. The change makes the id parameter required (non-nullable) for the mediaById field. This should be in a separate PR or explained in the PR description.
| id: ID! | |
| id: ID |
(limitation in Saleor)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 18 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| checkoutSettings: { | ||
| automaticallyCompleteFullyPaidCheckouts: true, | ||
| automaticCompletionDelay: 30, | ||
| automaticCompletionCutOffDate: "2024-01-01T00:00:00Z", |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fixture uses a past date "2024-01-01T00:00:00Z" for automaticCompletionCutOffDate. Since we're now in December 2025, this is a year in the past. According to the PR description, setting cut-off dates to the past should trigger a warning. Consider using a future date or a date relative to the current time for test fixtures to better represent realistic scenarios and avoid confusion.
| checkoutSettings: { | ||
| automaticallyCompleteFullyPaidCheckouts: true, | ||
| automaticCompletionDelay: 30, | ||
| automaticCompletionCutOffDate: "2024-01-01T00:00:00Z", |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fixture uses a past date "2024-01-01T00:00:00Z" for automaticCompletionCutOffDate. Since we're now in December 2025, this is a year in the past. According to the PR description, setting cut-off dates to the past should trigger a warning. Consider using a future date or a date relative to the current time for test fixtures to better represent realistic scenarios and avoid confusion.
| description: "button to reset cut-off date to saved value", | ||
| }, | ||
| automaticCompletionCutOffDateDisabledTooltip: { | ||
| id: "aWJPo+", |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Message ID mismatch: The ID "aWJPo+" here doesn't match the ID "WqZk8P" in locale/defaultMessages.json (line 5537). This will cause the translation to fail. Please ensure both files use the same ID.
| id: "aWJPo+", | |
| id: "WqZk8P", |
| checkoutSettings: { | ||
| automaticallyCompleteFullyPaidCheckouts: true, | ||
| automaticCompletionDelay: 30, | ||
| automaticCompletionCutOffDate: "2024-01-01T00:00:00Z", |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fixture uses a past date "2024-01-01T00:00:00Z" for automaticCompletionCutOffDate. Since we're now in December 2025, this is a year in the past. According to the PR description, setting cut-off dates to the past should trigger a warning. Consider using a future date or a date relative to the current time for test fixtures to better represent realistic scenarios and avoid confusion.
| onCutOffDateChange({ | ||
| target: { name: "automaticCompletionCutOffDate", value: savedCutOffDate }, | ||
| } as any); | ||
| onCutOffTimeChange({ | ||
| target: { name: "automaticCompletionCutOffTime", value: savedCutOffTime }, | ||
| } as any); |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using as any type assertion bypasses type safety. Consider creating a proper event object or adjusting the handler signature to accept the value directly instead of requiring an event object structure.
| // When enabling cut-off date, set current date/time as default | ||
| const now = new Date(); | ||
| const date = now.toISOString().split("T")[0]; | ||
| const time = now.toTimeString().slice(0, 5); |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential timezone inconsistency: Line 264 uses toISOString() which returns UTC time, but line 265 uses toTimeString() which returns local time. This mixing of UTC and local time could lead to incorrect date/time values. Consider using UTC consistently for both date and time extraction.
| const time = now.toTimeString().slice(0, 5); | |
| const time = `${String(now.getUTCHours()).padStart(2, "0")}:${String(now.getUTCMinutes()).padStart(2, "0")}`; |
| const handleSetCurrentDateTime = () => { | ||
| const now = new Date(); | ||
| const date = now.toISOString().split("T")[0]; | ||
| const time = now.toTimeString().slice(0, 5); |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential timezone inconsistency: Line 91 uses toISOString() which returns UTC time, but line 92 uses toTimeString() which returns local time. This mixing of UTC and local time could lead to incorrect date/time values. Consider using UTC consistently for both date and time extraction.
| const time = now.toTimeString().slice(0, 5); | |
| const time = `${String(now.getUTCHours()).padStart(2, "0")}:${String(now.getUTCMinutes()).padStart(2, "0")}`; |
|
|
||
| const time = automaticCompletionCutOffTime || "00:00"; | ||
|
|
||
| return new Date(`${automaticCompletionCutOffDate}T${time}`).toISOString(); |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential timezone ambiguity: Constructing a date with new Date(\${automaticCompletionCutOffDate}T${time}`)` without a timezone specifier will parse it as local time, not UTC. This inconsistency could cause the wrong datetime to be sent to the backend, which expects ISO strings in UTC. Consider being explicit about the timezone to match the backend's expectations.
| return new Date(`${automaticCompletionCutOffDate}T${time}`).toISOString(); | |
| return new Date(`${automaticCompletionCutOffDate}T${time}Z`).toISOString(); |
| checkoutSettings: { | ||
| automaticallyCompleteFullyPaidCheckouts: true, | ||
| automaticCompletionDelay: 30, | ||
| automaticCompletionCutOffDate: "2024-01-01T00:00:00Z", |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fixture uses a past date "2024-01-01T00:00:00Z" for automaticCompletionCutOffDate. Since we're now in December 2025, this is a year in the past. According to the PR description, setting cut-off dates to the past should trigger a warning. Consider using a future date or a date relative to the current time for test fixtures to better represent realistic scenarios and avoid confusion.
| checkoutSettings: { | ||
| automaticallyCompleteFullyPaidCheckouts: true, | ||
| automaticCompletionDelay: 30, | ||
| automaticCompletionCutOffDate: "2024-01-01T00:00:00Z", |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fixture uses a past date "2024-01-01T00:00:00Z" for automaticCompletionCutOffDate. Since we're now in December 2025, this is a year in the past. According to the PR description, setting cut-off dates to the past should trigger a warning. Consider using a future date or a date relative to the current time for test fixtures to better represent realistic scenarios and avoid confusion.
| automaticCompletionDelay: number | string | null; | ||
| automaticCompletionCutOffDate: string; | ||
| automaticCompletionCutOffTime: string; | ||
| useCutOffDate: boolean; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about you rewrite it to use more standalone approach? Can we build this settings as self-contained, like
- Component AutomaticCheckoutCompleteSettings: make query to fetch current, store mutation to update
- It's internal form can use modern and small forms inside
- We don't let the current monster grow
- In the future we will be able to use Suspense and skeleton loading
Added configuration to Channel settings to configure new checkout autocomplete settings added in Saleor 3.22.
It has warning messages for states that might break user storefront
1. Setting delay to 0
2. Enabling without cut-off date
3. Enabling with cut-off date
4. Changing cut-off date after feature was enabled - to the past
5. Changing cut-off date after feature was enabled - to the future
6. Tooltip for cut-off date toggle after it was enabled
7. Disabling feature completely once it was enabled