Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/happy-dots-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Update success message shown in SwapWidget component
1 change: 1 addition & 0 deletions packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,7 @@
if (screen.id === "6:success") {
return (
<SuccessScreen
type="payment-success"

Check warning on line 726 in packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L726 was not covered by tests
// from props
client={props.client}
hasPaymentId={!!props.paymentLinkId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ function CheckoutWidgetContent(
if (screen.id === "6:success") {
return (
<SuccessScreen
type="payment-success"
// from props
client={props.client}
hasPaymentId={!!props.paymentLinkId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@
<SuccessScreen
// from props
client={props.client}
type="payment-success"

Check warning on line 789 in packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L789 was not covered by tests
hasPaymentId={!!props.paymentLinkId}
// others
completedStatuses={screen.completedStatuses}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
* Whether or not this payment is associated with a payment ID. If it does, we show a different message.
*/
hasPaymentId: boolean;

type: "swap-success" | "payment-success";
};

type ViewState = "success" | "detail";
Expand All @@ -58,6 +60,7 @@
client,
hasPaymentId = false,
showContinueWithTx,
type,

Check warning on line 63 in packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L63 was not covered by tests
}: SuccessScreenProps) {
const theme = useCustomTheme();
const [viewState, setViewState] = useState<ViewState>("success");
Expand Down Expand Up @@ -112,6 +115,13 @@
);
}

const title =
type === "swap-success" ? "Swap Successful" : "Payment Successful";
const description =
type === "swap-success"
? "Your token swap has been completed successfully."
: "Your payment has been completed successfully.";

Check warning on line 123 in packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added lines #L118 - L123 were not covered by tests

return (
<Container flex="column" fullHeight px="md" pb="md" pt="md+">
<Spacer y="3xl" />
Expand Down Expand Up @@ -151,15 +161,15 @@
marginBottom: spacing.xxs,
}}
>
Payment Successful
{title}

Check warning on line 164 in packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L164 was not covered by tests
</Text>

<Text center color="secondaryText" size="sm">
{hasPaymentId
? "You can now close this page and return to the application."
: showContinueWithTx
? "Click continue to execute your transaction."
: "Your payment has been completed successfully."}
: description}

Check warning on line 172 in packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L172 was not covered by tests
</Text>
</div>
</Container>
Expand All @@ -173,7 +183,7 @@
onClick={() => setViewState("detail")}
variant="secondary"
>
View Payment Receipt
View Transaction Receipt
</Button>

{!hasPaymentId && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ function SwapWidgetContent(
if (screen.id === "4:success") {
return (
<SuccessScreen
type="swap-success"
client={props.client}
completedStatuses={screen.completedStatuses}
onDone={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const meta: Meta<typeof SuccessScreen> = {
windowAdapter: webWindowAdapter,
client: storyClient,
hasPaymentId: false,
type: "payment-success",
},
component: SuccessScreen,
decorators: [
Expand All @@ -94,6 +95,12 @@ export const Basic: Story = {
args: {},
};

export const BasicSwapSuccess: Story = {
args: {
type: "swap-success",
},
};

export const OnrampPayment: Story = {
args: {
completedStatuses: mockOnrampCompletedStatuses,
Expand Down
Loading