File tree Expand file tree Collapse file tree 11 files changed +156
-7
lines changed Expand file tree Collapse file tree 11 files changed +156
-7
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ export type UIOptions = Prettify<
4242 image ?: string ;
4343 } ;
4444 currency ?: SupportedFiatCurrency ;
45+ buttonLabel ?: string ;
4546 } & (
4647 | {
4748 mode : "fund_wallet" ;
Original file line number Diff line number Diff line change @@ -180,6 +180,11 @@ export type BuyWidgetProps = {
180180 * @default "USD"
181181 */
182182 currency ?: SupportedFiatCurrency ;
183+
184+ /**
185+ * Custom label for the main action button.
186+ */
187+ buttonLabel ?: string ;
183188} ;
184189
185190// Enhanced UIOptions to handle unsupported token state
@@ -335,6 +340,7 @@ export function BuyWidget(props: BuyWidgetProps) {
335340 } ,
336341 mode : "fund_wallet" ,
337342 currency : props . currency || "USD" ,
343+ buttonLabel : props . buttonLabel ,
338344 } ,
339345 type : "success" ,
340346 } ;
@@ -364,6 +370,8 @@ export function BuyWidget(props: BuyWidgetProps) {
364370 title : props . title ,
365371 } ,
366372 mode : "fund_wallet" ,
373+ currency : props . currency || "USD" ,
374+ buttonLabel : props . buttonLabel ,
367375 } ,
368376 type : "success" ,
369377 } ;
Original file line number Diff line number Diff line change @@ -186,6 +186,11 @@ export type CheckoutWidgetProps = {
186186 * @default "USD"
187187 */
188188 currency ?: SupportedFiatCurrency ;
189+
190+ /**
191+ * Custom label for the main action button.
192+ */
193+ buttonLabel ?: string ;
189194} ;
190195
191196// Enhanced UIOptions to handle unsupported token state
@@ -310,6 +315,7 @@ export function CheckoutWidget(props: CheckoutWidgetProps) {
310315 } ,
311316 mode : "direct_payment" ,
312317 currency : props . currency || "USD" ,
318+ buttonLabel : props . buttonLabel ,
313319 paymentInfo : {
314320 amount : props . amount ,
315321 feePayer : props . feePayer === "seller" ? "receiver" : "sender" ,
Original file line number Diff line number Diff line change @@ -64,7 +64,11 @@ export function DirectPayment({
6464 ) ;
6565 } ;
6666
67- const buyNow = (
67+ const buyNow = uiOptions . buttonLabel ? (
68+ < Text color = "primaryButtonText" size = "md" >
69+ { uiOptions . buttonLabel }
70+ </ Text >
71+ ) : (
6872 < Container flex = "row" gap = "3xs" >
6973 < Text color = "primaryButtonText" size = "md" >
7074 Buy Now ·
Original file line number Diff line number Diff line change @@ -336,13 +336,13 @@ export function FundWallet({
336336 } }
337337 variant = "primary"
338338 >
339- Buy { amount } { uiOptions . destinationToken . symbol }
339+ { uiOptions . buttonLabel || ` Buy $ {amount } $ {uiOptions . destinationToken . symbol } ` }
340340 </ Button >
341341 ) : (
342342 < ConnectButton
343343 client = { client }
344344 connectButton = { {
345- label : `Buy ${ amount } ${ uiOptions . destinationToken . symbol } ` ,
345+ label : uiOptions . buttonLabel || `Buy ${ amount } ${ uiOptions . destinationToken . symbol } ` ,
346346 } }
347347 theme = { theme }
348348 { ...connectOptions }
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ export function TransactionPayment({
112112 transactionDataQuery . data ?. functionInfo ?. functionName || "Contract Call" ;
113113 const isLoading = transactionDataQuery . isLoading || chainMetadata . isLoading ;
114114
115- const buttonLabel = `Execute ${ functionName } ` ;
115+ const buttonLabel = uiOptions . buttonLabel || `Execute ${ functionName } ` ;
116116
117117 if ( isLoading ) {
118118 return (
Original file line number Diff line number Diff line change @@ -189,6 +189,11 @@ export type TransactionWidgetProps = {
189189 * @default "USD"
190190 */
191191 currency ?: SupportedFiatCurrency ;
192+
193+ /**
194+ * Custom label for the main action button.
195+ */
196+ buttonLabel ?: string ;
192197} ;
193198
194199// Enhanced UIOptions to handle unsupported token state
@@ -349,6 +354,7 @@ export function TransactionWidget(props: TransactionWidgetProps) {
349354 return {
350355 data : {
351356 currency : props . currency || "USD" ,
357+ buttonLabel : props . buttonLabel ,
352358 metadata : {
353359 description : props . description ,
354360 image : props . image ,
Original file line number Diff line number Diff line change @@ -223,3 +223,33 @@ export const NoImageLight: Story = {
223223 } ,
224224 } ,
225225} ;
226+
227+ export const CustomButtonLabel : Story = {
228+ args : {
229+ theme : "dark" ,
230+ uiOptions : DIRECT_PAYMENT_UI_OPTIONS . customButton ,
231+ } ,
232+ parameters : {
233+ backgrounds : { default : "dark" } ,
234+ docs : {
235+ description : {
236+ story : "Example showcasing custom button label functionality. The button shows 'Purchase Now' instead of the default 'Buy Now' text." ,
237+ } ,
238+ } ,
239+ } ,
240+ } ;
241+
242+ export const CustomButtonLabelLight : Story = {
243+ args : {
244+ theme : "light" ,
245+ uiOptions : DIRECT_PAYMENT_UI_OPTIONS . customButton ,
246+ } ,
247+ parameters : {
248+ backgrounds : { default : "light" } ,
249+ docs : {
250+ description : {
251+ story : "Light theme version with custom button label 'Purchase Now'." ,
252+ } ,
253+ } ,
254+ } ,
255+ } ;
Original file line number Diff line number Diff line change @@ -194,3 +194,33 @@ export const LargeAmountLight: Story = {
194194 } ,
195195 } ,
196196} ;
197+
198+ export const CustomButtonLabel : Story = {
199+ args : {
200+ theme : "dark" ,
201+ uiOptions : FUND_WALLET_UI_OPTIONS . customButton ,
202+ } ,
203+ parameters : {
204+ backgrounds : { default : "dark" } ,
205+ docs : {
206+ description : {
207+ story : "Example showcasing custom button label functionality. The button shows 'Add Funds Now' instead of the default 'Buy [amount] [symbol]' text." ,
208+ } ,
209+ } ,
210+ } ,
211+ } ;
212+
213+ export const CustomButtonLabelLight : Story = {
214+ args : {
215+ theme : "light" ,
216+ uiOptions : FUND_WALLET_UI_OPTIONS . customButton ,
217+ } ,
218+ parameters : {
219+ backgrounds : { default : "light" } ,
220+ docs : {
221+ description : {
222+ story : "Light theme version with custom button label 'Add Funds Now'." ,
223+ } ,
224+ } ,
225+ } ,
226+ } ;
Original file line number Diff line number Diff line change @@ -168,3 +168,33 @@ export const ContractInteractionLight: Story = {
168168 } ,
169169 } ,
170170} ;
171+
172+ export const CustomButtonLabel : Story = {
173+ args : {
174+ theme : "dark" ,
175+ uiOptions : TRANSACTION_UI_OPTIONS . customButton ,
176+ } ,
177+ parameters : {
178+ backgrounds : { default : "dark" } ,
179+ docs : {
180+ description : {
181+ story : "Example showcasing custom button label functionality. The button shows 'Execute Now' instead of the default 'Execute [functionName]' text." ,
182+ } ,
183+ } ,
184+ } ,
185+ } ;
186+
187+ export const CustomButtonLabelLight : Story = {
188+ args : {
189+ theme : "light" ,
190+ uiOptions : TRANSACTION_UI_OPTIONS . customButton ,
191+ } ,
192+ parameters : {
193+ backgrounds : { default : "light" } ,
194+ docs : {
195+ description : {
196+ story : "Light theme version with custom button label 'Execute Now'." ,
197+ } ,
198+ } ,
199+ } ,
200+ } ;
You can’t perform that action at this time.
0 commit comments