Skip to content

Commit 7b873d3

Browse files
committed
[MNY-322] SDK: Update success message shown in SwapWidget component (#8509)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR updates the success messages in the `SuccessScreen` component across various widgets in the `thirdweb` package, specifically for payment and swap transactions. ### Detailed summary - Updated success message type in `SwapWidget` to `"swap-success"`. - Updated success message type in `BuyWidget` and `CheckoutWidget` to `"payment-success"`. - Added a new story `BasicSwapSuccess` in `SuccessScreen.stories.tsx`. - Modified `SuccessScreen` to handle different message types. - Updated displayed titles and descriptions based on the success type. - Changed button text from "View Payment Receipt" to "View Transaction Receipt". > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Success screens now display dynamic, context-appropriate messaging tailored to transaction type, with distinct titles and descriptions for swap versus payment transactions. * Enhanced user experience with improved terminology—the option to "View Transaction Receipt" now displays consistently across all payment flows for better clarity and consistency. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent d33a943 commit 7b873d3

File tree

7 files changed

+29
-3
lines changed

7 files changed

+29
-3
lines changed

.changeset/happy-dots-jam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Update success message shown in SwapWidget component

packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ function BridgeWidgetContent(
723723
if (screen.id === "6:success") {
724724
return (
725725
<SuccessScreen
726+
type="payment-success"
726727
// from props
727728
client={props.client}
728729
hasPaymentId={!!props.paymentLinkId}

packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ function CheckoutWidgetContent(
730730
if (screen.id === "6:success") {
731731
return (
732732
<SuccessScreen
733+
type="payment-success"
733734
// from props
734735
client={props.client}
735736
hasPaymentId={!!props.paymentLinkId}

packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,7 @@ function TransactionWidgetContent(
786786
<SuccessScreen
787787
// from props
788788
client={props.client}
789+
type="payment-success"
789790
hasPaymentId={!!props.paymentLinkId}
790791
// others
791792
completedStatuses={screen.completedStatuses}

packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ type SuccessScreenProps = {
4646
* Whether or not this payment is associated with a payment ID. If it does, we show a different message.
4747
*/
4848
hasPaymentId: boolean;
49+
50+
type: "swap-success" | "payment-success";
4951
};
5052

5153
type ViewState = "success" | "detail";
@@ -58,6 +60,7 @@ export function SuccessScreen({
5860
client,
5961
hasPaymentId = false,
6062
showContinueWithTx,
63+
type,
6164
}: SuccessScreenProps) {
6265
const theme = useCustomTheme();
6366
const [viewState, setViewState] = useState<ViewState>("success");
@@ -112,6 +115,13 @@ export function SuccessScreen({
112115
);
113116
}
114117

118+
const title =
119+
type === "swap-success" ? "Swap Successful" : "Payment Successful";
120+
const description =
121+
type === "swap-success"
122+
? "Your token swap has been completed successfully."
123+
: "Your payment has been completed successfully.";
124+
115125
return (
116126
<Container flex="column" fullHeight px="md" pb="md" pt="md+">
117127
<Spacer y="3xl" />
@@ -151,15 +161,15 @@ export function SuccessScreen({
151161
marginBottom: spacing.xxs,
152162
}}
153163
>
154-
Payment Successful
164+
{title}
155165
</Text>
156166

157167
<Text center color="secondaryText" size="sm">
158168
{hasPaymentId
159169
? "You can now close this page and return to the application."
160170
: showContinueWithTx
161171
? "Click continue to execute your transaction."
162-
: "Your payment has been completed successfully."}
172+
: description}
163173
</Text>
164174
</div>
165175
</Container>
@@ -173,7 +183,7 @@ export function SuccessScreen({
173183
onClick={() => setViewState("detail")}
174184
variant="secondary"
175185
>
176-
View Payment Receipt
186+
View Transaction Receipt
177187
</Button>
178188

179189
{!hasPaymentId && (

packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ function SwapWidgetContent(
440440
if (screen.id === "4:success") {
441441
return (
442442
<SuccessScreen
443+
type="swap-success"
443444
client={props.client}
444445
completedStatuses={screen.completedStatuses}
445446
onDone={() => {

packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const meta: Meta<typeof SuccessScreen> = {
7575
windowAdapter: webWindowAdapter,
7676
client: storyClient,
7777
hasPaymentId: false,
78+
type: "payment-success",
7879
},
7980
component: SuccessScreen,
8081
decorators: [
@@ -94,6 +95,12 @@ export const Basic: Story = {
9495
args: {},
9596
};
9697

98+
export const BasicSwapSuccess: Story = {
99+
args: {
100+
type: "swap-success",
101+
},
102+
};
103+
97104
export const OnrampPayment: Story = {
98105
args: {
99106
completedStatuses: mockOnrampCompletedStatuses,

0 commit comments

Comments
 (0)