-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add new unified OrderCaptureDialog with amount options #6200
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
Merged
Merged
Changes from 93 commits
Commits
Show all changes
102 commits
Select commit
Hold shift + click to select a range
aaa4c9d
Add border to Order summary and remove bg
mirekm 7ce12ba
Improve empty state for Payments summary card
mirekm 5c1b09d
Match font size and add tabular nums to amounts
mirekm 51ae25d
Fix buttons stacking on each other
mirekm 7c2b4d6
Extract messages
mirekm d1f5263
Add changeset
mirekm 3390702
Fix linting warning
mirekm 5ba1c15
Fix "No applicable shipping methods" bug
mirekm 2f242bf
Fix Edit Shipping Options modal to show unavailable method so user is…
mirekm 7dcf708
Merge the old UNCONFIRMED and DRAFT order summary into the new design…
mirekm 4de0c07
Eslint
mirekm 8e09b06
More types
mirekm f25a05a
Extract messages
mirekm a7905f8
Add changeset
mirekm f90f52b
Fix imports placement
mirekm 3a494ac
Merge branch 'improve-order-summary' into unify-order-value-sections
mirekm 97dd348
Merge branch 'main' into unify-order-value-sections
mirekm c0d9104
Clean up the old unused Draft summary component
mirekm d7a0151
Unify the Draft header style and reuse OrderCardTitle component
mirekm 4aae8de
Improve the Add products button showing disabled state
mirekm c77648c
Extract messages
mirekm b1c6b52
Improve the "Set shipping" logic and messages in Order Summary
mirekm f4d1ec1
Add tests to Order summary
mirekm f26dfd5
Extract messages
mirekm 94b676f
Fix liniting errors
mirekm ee0aea1
Let users remove the selected shipping method in Drafts
mirekm b3feed7
Extract messages
mirekm 3210bc1
Types
mirekm dd3ad2c
Add new unified OrderCaptureDialog with amount options
mirekm e334327
Add changeset
mirekm 17546f5
Extract messages
mirekm 71ac249
Fix Callout tests to respect ThemeProvider
mirekm 86b7f7c
Add essential PriceField util tests
mirekm 6bfcc7c
Add dialog tests
mirekm e2a82e4
Fix types
mirekm dddc58e
Merge branch 'main' into unify-order-value-sections
mirekm 655723f
fix: add support for feature branches in testenvs (CI/CD)
NyanKiyoshi b1da70f
Merge branch 'main' into unify-order-value-sections
mirekm 5f41731
Merge remote-tracking branch 'origin/fix/cicd/testenvs/support-featur…
mirekm 5fe2a43
Merge branch 'unify-order-value-sections' into enable-granular-capture
mirekm 810a191
Extract messages
mirekm 7e64094
Don't ignore apollo errors
mirekm 818bb5e
Remove the temp testing hack
mirekm 0ed6529
Reset the dialog to the default option on open
mirekm ec4c2bc
Tests for empty state
mirekm 3ee9d9b
Drop no-op function in favour of optional callback
mirekm 301ace8
Update variable name
mirekm 6178530
Emphasise the totals in the Summary section
mirekm 9eda3bf
Remove the unnecessary spread of props
mirekm 482099b
Move discounts outside of the total lines as the dsicounts apply dire…
mirekm 4851f22
Fix returned type
mirekm c1a5e6f
Improve ButtonLink and drop InlineLink
mirekm c4fe064
Simplify conditional rendering of shipping messages
mirekm feb3c07
Extract messages
mirekm 245838f
Merge branch 'main' into unify-order-value-sections
mirekm fbe015a
When isClearable is true, selecting "No shipping method" is intention…
mirekm 4fac6c6
Fix tests
mirekm f2c201d
Merge branch 'unify-order-value-sections' into enable-granular-capture
mirekm c0cf716
cleanup release workflow (#6193)
lkostrowski 5f2e6a7
Fix customer->order filter redirection (#6213)
lkostrowski 955f177
Release 3.22 (#6211) (#6212)
lkostrowski c6848f5
Update transactions (#6178)
mirekm 7b32e85
Merge branch 'main' into unify-order-value-sections
mirekm 9dd648e
Make messages for transaction action buttons reusable
mirekm fd03505
Let's use Box instead of custom CSS for PaymentsSummaryEmptyState com…
mirekm 1de52c7
Improve the contract on Mark as Paid
mirekm 28a013c
Improve the change description
mirekm 25301a2
Remove the prior changelog files
mirekm 70500a9
Render only when onMarkAsPaid is defined
mirekm ee30448
Improve changelog desc
mirekm bf5cd90
Refactor to use defaultZeroMoney constant for default money values
mirekm 0a8d88f
Optimise transaction amount retrieval with useMemo
mirekm 9536089
Add separate transaction-charge-action URL param; Fixed data refetch …
mirekm a78b453
Simplify the summary message
mirekm 4966958
Merge branch 'unify-order-value-sections' into enable-granular-capture
mirekm 111bca2
Merge branch 'main' into enable-granular-capture
mirekm e6677cd
Extract messages
mirekm e4186e9
Fix tests
mirekm 6f18dc6
Merge branch 'main' into enable-granular-capture
mirekm b501930
Refactor selected transaction lookup
mirekm 0c7a82b
Apply code review
mirekm c1ceeb7
Improve comma handling
mirekm b91e24b
Apply code review
mirekm 3d7c960
Extract messages
mirekm afd9086
Improve changeset message
mirekm 6be32b5
Merge branch 'main' into enable-granular-capture
mirekm 2f5a61c
Use Number to maintain the amount state instead of string
mirekm 19848b9
Return ReactNode insrtead of JSX.Element
mirekm c5b78ca
No silent failures
mirekm 10c3dd7
Link to the variant's metadata instead of letting users change it in …
mirekm e1ad2b9
Fixed dependencies with security warnings (#6245)
witoszekdev cb378ac
Merge branch 'main' into enable-granular-capture
mirekm 78bde8a
Merge branch 'main' into enable-granular-capture
mirekm 23ab07b
Improve the separator nomalisation to handle multiple tousend blocks
mirekm f8eaa71
Refactor capture modal state into separate hook
witoszekdev 5bf94c1
Use order currency as default currency
witoszekdev 66fb2b7
Mock theme instead of using ThemeProvider
witoszekdev f562ee8
CR: Minor fixes
witoszekdev e43abf2
Apply suggestion from @witoszekdev
witoszekdev 324d842
Extract messages
witoszekdev 8a1cdd3
Fix test
witoszekdev 9cb5e15
Merge branch 'main' into enable-granular-capture
witoszekdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| "saleor-dashboard": patch | ||
| --- | ||
|
|
||
| New capture dialog for capturing payments with support for: | ||
| - Full and partial authorization status indicators | ||
| - Custom capture amount input with currency-aware decimal validation | ||
| - Order balance and transaction-level capture tracking | ||
| - Outcome prediction showing resulting order status |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,58 +1,66 @@ | ||
| import { ExclamationIcon } from "@dashboard/icons/ExclamationIcon"; | ||
| import { Box } from "@saleor/macaw-ui-next"; | ||
| import { iconSize, iconStrokeWidthBySize } from "@dashboard/components/icons"; | ||
| import { getStatusColor, PillStatusType } from "@dashboard/misc"; | ||
| import { Box, Text, useTheme } from "@saleor/macaw-ui-next"; | ||
| import { AlertTriangle, CircleAlert, Info, LucideIcon } from "lucide-react"; | ||
| import { ReactNode } from "react"; | ||
|
|
||
| import { DashboardCard } from "../Card"; | ||
| type CalloutType = "info" | "warning" | "error"; | ||
|
|
||
| type CalloutType = "info" | "warning"; | ||
| interface CalloutStyles { | ||
| status: PillStatusType; | ||
| iconColor: "warning1" | "critical1" | "default1"; | ||
| Icon: LucideIcon; | ||
| } | ||
|
|
||
| const warningStylesBox = { | ||
| backgroundColor: "warning1", | ||
| borderColor: "warning1", | ||
| } as const; | ||
|
|
||
| const warningStylesIcon = { | ||
| color: "warning1", | ||
| } as const; | ||
|
|
||
| const gridTemplate = ` | ||
| "icon title" | ||
| "empty content" | ||
| `; | ||
| const calloutStylesMap: Record<CalloutType, CalloutStyles> = { | ||
| warning: { | ||
| status: "warning", | ||
| iconColor: "warning1", | ||
| Icon: CircleAlert, | ||
| }, | ||
| error: { | ||
| status: "error", | ||
| iconColor: "critical1", | ||
| Icon: AlertTriangle, | ||
| }, | ||
| info: { | ||
| status: "neutral", | ||
| iconColor: "default1", | ||
| Icon: Info, | ||
| }, | ||
| }; | ||
|
|
||
| export const Callout = ({ | ||
| children, | ||
| title, | ||
| type, | ||
| }: { | ||
| children: ReactNode; | ||
| interface CalloutProps { | ||
| children?: ReactNode; | ||
| title: ReactNode; | ||
| type: CalloutType; | ||
| }) => { | ||
| const boxStyles = type === "warning" ? warningStylesBox : null; | ||
| const iconStyles = type === "warning" ? warningStylesIcon : null; | ||
| } | ||
|
|
||
| export const Callout = ({ children, title, type }: CalloutProps): JSX.Element => { | ||
| const { theme: currentTheme } = useTheme(); | ||
| const { status, iconColor, Icon } = calloutStylesMap[type]; | ||
| const backgroundColor = getStatusColor({ status, currentTheme }).base; | ||
|
|
||
| return ( | ||
| <DashboardCard | ||
| display="grid" | ||
| __gridTemplateColumns="auto 1fr" | ||
| __gridTemplateRows="auto auto" | ||
| __gridTemplateAreas={gridTemplate} | ||
| withBorder | ||
| rowGap={1} | ||
| columnGap={2} | ||
| __width="fit-content" | ||
| {...boxStyles} | ||
| <Box | ||
| display="flex" | ||
| alignItems="flex-start" | ||
| gap={3} | ||
| padding={4} | ||
| borderRadius={4} | ||
| __backgroundColor={backgroundColor} | ||
| > | ||
| <DashboardCard.Title display="contents"> | ||
| <Box __lineHeight="0" __gridArea="icon" {...iconStyles}> | ||
| <ExclamationIcon width="20" height="20" /> | ||
| </Box> | ||
| <Box __gridArea="title">{title}</Box> | ||
| </DashboardCard.Title> | ||
| <DashboardCard.Content __gridArea="content" fontSize={3} paddingRight={0} paddingLeft={0}> | ||
| {children} | ||
| </DashboardCard.Content> | ||
| </DashboardCard> | ||
| <Box color={iconColor} __lineHeight="0" flexShrink="0"> | ||
| <Icon size={iconSize.small} strokeWidth={iconStrokeWidthBySize.small} /> | ||
| </Box> | ||
| <Box display="flex" flexDirection="column" gap={1}> | ||
| <Box>{title}</Box> | ||
| {children && ( | ||
| <Text size={3} color="default2"> | ||
| {children} | ||
| </Text> | ||
| )} | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.