Skip to content

Conversation

@witoszekdev
Copy link
Member

@witoszekdev witoszekdev commented Dec 3, 2025

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

CleanShot 2025-12-05 at 17 04 31@2x

2. Enabling without cut-off date

CleanShot 2025-12-05 at 17 04 38@2x

3. Enabling with cut-off date

CleanShot 2025-12-05 at 17 08 10@2x

4. Changing cut-off date after feature was enabled - to the past

CleanShot 2025-12-05 at 17 04 56@2x

5. Changing cut-off date after feature was enabled - to the future

CleanShot 2025-12-05 at 17 05 01@2x

6. Tooltip for cut-off date toggle after it was enabled

CleanShot 2025-12-05 at 17 05 06@2x

7. Disabling feature completely once it was enabled

CleanShot 2025-12-05 at 17 05 11@2x

Copilot AI review requested due to automatic review settings December 3, 2025 12:42
@changeset-bot
Copy link

changeset-bot bot commented Dec 3, 2025

⚠️ No Changeset found

Latest commit: dab847f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 17.47573% with 85 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.59%. Comparing base (0cccea0) to head (dab847f).
⚠️ Report is 29 commits behind head on main.

Files with missing lines Patch % Lines
...ls/pages/ChannelDetailsPage/ChannelDetailsPage.tsx 0.00% 22 Missing and 2 partials ⚠️
...nts/ChannelForm/AutomaticallyCompleteCheckouts.tsx 0.00% 14 Missing ⚠️
...ents/ChannelForm/useAutomaticCompletionHandlers.ts 0.00% 14 Missing ⚠️
...ents/ChannelForm/useAutomaticCompletionWarnings.ts 0.00% 13 Missing ⚠️
...c/channels/views/ChannelDetails/ChannelDetails.tsx 0.00% 12 Missing and 1 partial ⚠️
src/channels/validation.ts 0.00% 5 Missing and 1 partial ⚠️
...rc/channels/components/ChannelForm/ChannelForm.tsx 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a 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 CheckoutAutoCompleteInput with enabled, delay, and cutOffDate fields for granular control
  • Updates CheckoutSettings to expose automaticCompletionDelay and automaticCompletionCutOffDate fields
  • Deprecates automaticallyCompleteFullyPaidCheckouts in favor of the new automaticCompletion input

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

Copilot AI Dec 3, 2025

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.

Copilot uses AI. Check for mistakes.

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

Copilot AI Dec 3, 2025

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.

Suggested change
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.

Copilot uses AI. Check for mistakes.
imageById(
"""ID of a product image."""
id: ID
id: ID!
Copy link

Copilot AI Dec 3, 2025

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.

Suggested change
id: ID!
id: ID

Copilot uses AI. Check for mistakes.
}

enum AttributeBulkUpdateErrorCode {
enum AttributeBulkUpdateErrorCode @doc(category: "Attributes") {
Copy link

Copilot AI Dec 3, 2025

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.

Suggested change
enum AttributeBulkUpdateErrorCode @doc(category: "Attributes") {
enum AttributeBulkUpdateErrorCode {

Copilot uses AI. Check for mistakes.
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. */
Copy link

Copilot AI Dec 3, 2025

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.

Copilot uses AI. Check for mistakes.
*/
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.
Copy link

Copilot AI Dec 3, 2025

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.

Copilot uses AI. Check for mistakes.

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

Copilot AI Dec 3, 2025

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.

Suggested change
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.

Copilot uses AI. Check for mistakes.

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

Copilot AI Dec 3, 2025

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.

Copilot uses AI. Check for mistakes.
mediaById(
"""ID of a product media."""
id: ID
id: ID!
Copy link

Copilot AI Dec 3, 2025

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.

Suggested change
id: ID!
id: ID

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings December 3, 2025 16:39
Copy link
Contributor

Copilot AI left a 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",
Copy link

Copilot AI Dec 3, 2025

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.

Copilot uses AI. Check for mistakes.
checkoutSettings: {
automaticallyCompleteFullyPaidCheckouts: true,
automaticCompletionDelay: 30,
automaticCompletionCutOffDate: "2024-01-01T00:00:00Z",
Copy link

Copilot AI Dec 3, 2025

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.

Copilot uses AI. Check for mistakes.
description: "button to reset cut-off date to saved value",
},
automaticCompletionCutOffDateDisabledTooltip: {
id: "aWJPo+",
Copy link

Copilot AI Dec 3, 2025

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.

Suggested change
id: "aWJPo+",
id: "WqZk8P",

Copilot uses AI. Check for mistakes.
checkoutSettings: {
automaticallyCompleteFullyPaidCheckouts: true,
automaticCompletionDelay: 30,
automaticCompletionCutOffDate: "2024-01-01T00:00:00Z",
Copy link

Copilot AI Dec 3, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 99 to 104
onCutOffDateChange({
target: { name: "automaticCompletionCutOffDate", value: savedCutOffDate },
} as any);
onCutOffTimeChange({
target: { name: "automaticCompletionCutOffTime", value: savedCutOffTime },
} as any);
Copy link

Copilot AI Dec 3, 2025

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.

Copilot uses AI. Check for mistakes.
// 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);
Copy link

Copilot AI Dec 3, 2025

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.

Suggested change
const time = now.toTimeString().slice(0, 5);
const time = `${String(now.getUTCHours()).padStart(2, "0")}:${String(now.getUTCMinutes()).padStart(2, "0")}`;

Copilot uses AI. Check for mistakes.
const handleSetCurrentDateTime = () => {
const now = new Date();
const date = now.toISOString().split("T")[0];
const time = now.toTimeString().slice(0, 5);
Copy link

Copilot AI Dec 3, 2025

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.

Suggested change
const time = now.toTimeString().slice(0, 5);
const time = `${String(now.getUTCHours()).padStart(2, "0")}:${String(now.getUTCMinutes()).padStart(2, "0")}`;

Copilot uses AI. Check for mistakes.

const time = automaticCompletionCutOffTime || "00:00";

return new Date(`${automaticCompletionCutOffDate}T${time}`).toISOString();
Copy link

Copilot AI Dec 3, 2025

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.

Suggested change
return new Date(`${automaticCompletionCutOffDate}T${time}`).toISOString();
return new Date(`${automaticCompletionCutOffDate}T${time}Z`).toISOString();

Copilot uses AI. Check for mistakes.
checkoutSettings: {
automaticallyCompleteFullyPaidCheckouts: true,
automaticCompletionDelay: 30,
automaticCompletionCutOffDate: "2024-01-01T00:00:00Z",
Copy link

Copilot AI Dec 3, 2025

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.

Copilot uses AI. Check for mistakes.
checkoutSettings: {
automaticallyCompleteFullyPaidCheckouts: true,
automaticCompletionDelay: 30,
automaticCompletionCutOffDate: "2024-01-01T00:00:00Z",
Copy link

Copilot AI Dec 3, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +45 to 49
automaticCompletionDelay: number | string | null;
automaticCompletionCutOffDate: string;
automaticCompletionCutOffTime: string;
useCutOffDate: boolean;
}
Copy link
Member

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

  1. Component AutomaticCheckoutCompleteSettings: make query to fetch current, store mutation to update
  2. It's internal form can use modern and small forms inside
  3. We don't let the current monster grow
  4. In the future we will be able to use Suspense and skeleton loading

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.

3 participants