@@ -36,7 +36,7 @@ type RequestPart =
3636function createChatMessage (
3737 sender : Sender ,
3838 text : string ,
39- props : Partial < ChatMessage > = { } ,
39+ props : Partial < ChatMessage > = { }
4040) : ChatMessage {
4141 return {
4242 id : crypto . randomUUID ( ) ,
@@ -49,7 +49,7 @@ function createChatMessage(
4949const initialMessage : ChatMessage = createChatMessage (
5050 Sender . MODEL ,
5151 appConfig . defaultMessage ,
52- { id : "initial" } ,
52+ { id : "initial" }
5353) ;
5454
5555/**
@@ -58,7 +58,7 @@ const initialMessage: ChatMessage = createChatMessage(
5858 */
5959function App ( ) {
6060 const [ user_email , _setUserEmail ] = useState < string | null > (
61- "foo@example.com" ,
61+ "foo@example.com"
6262 ) ;
6363 const [ messages , setMessages ] = useState < ChatMessage [ ] > ( [ initialMessage ] ) ;
6464 const [ isLoading , setIsLoading ] = useState ( false ) ;
@@ -96,20 +96,20 @@ function App() {
9696 if ( ! checkout || ! checkout . payment || ! checkout . payment . handlers ) {
9797 const errorMessage = createChatMessage (
9898 Sender . MODEL ,
99- "Sorry, I couldn't retrieve payment methods." ,
99+ "Sorry, I couldn't retrieve payment methods."
100100 ) ;
101101 setMessages ( ( prev ) => [ ...prev , errorMessage ] ) ;
102102 return ;
103103 }
104104
105105 //find the handler with id "example_payment_provider"
106106 const handler = checkout . payment . handlers . find (
107- ( handler : PaymentHandler ) => handler . id === "example_payment_provider" ,
107+ ( handler : PaymentHandler ) => handler . id === "example_payment_provider"
108108 ) ;
109109 if ( ! handler ) {
110110 const errorMessage = createChatMessage (
111111 Sender . MODEL ,
112- "Sorry, I couldn't find the supported payment handler." ,
112+ "Sorry, I couldn't find the supported payment handler."
113113 ) ;
114114 setMessages ( ( prev ) => [ ...prev , errorMessage ] ) ;
115115 return ;
@@ -119,7 +119,7 @@ function App() {
119119 const paymentResponse =
120120 await credentialProvider . current . getSupportedPaymentMethods (
121121 user_email ,
122- handler . config ,
122+ handler . config
123123 ) ;
124124 const paymentMethods = paymentResponse . payment_method_aliases ;
125125
@@ -131,7 +131,7 @@ function App() {
131131 console . error ( "Failed to resolve mandate:" , error ) ;
132132 const errorMessage = createChatMessage (
133133 Sender . MODEL ,
134- "Sorry, I couldn't retrieve payment methods." ,
134+ "Sorry, I couldn't retrieve payment methods."
135135 ) ;
136136 setMessages ( ( prev ) => [ ...prev , errorMessage ] ) ;
137137 }
@@ -145,7 +145,7 @@ function App() {
145145 const userActionMessage = createChatMessage (
146146 Sender . USER ,
147147 `User selected payment method: ${ selectedMethod } ` ,
148- { isUserAction : true } ,
148+ { isUserAction : true }
149149 ) ;
150150 setMessages ( ( prev ) => [ ...prev , userActionMessage ] ) ;
151151
@@ -157,7 +157,7 @@ function App() {
157157 const paymentInstrument =
158158 await credentialProvider . current . getPaymentToken (
159159 user_email ,
160- selectedMethod ,
160+ selectedMethod
161161 ) ;
162162
163163 if ( ! paymentInstrument || ! paymentInstrument . credential ) {
@@ -172,7 +172,7 @@ function App() {
172172 console . error ( "Failed to process payment mandate:" , error ) ;
173173 const errorMessage = createChatMessage (
174174 Sender . MODEL ,
175- "Sorry, I couldn't process the payment. Please try again." ,
175+ "Sorry, I couldn't process the payment. Please try again."
176176 ) ;
177177 setMessages ( ( prev ) => [ ...prev , errorMessage ] ) ;
178178 }
@@ -183,7 +183,7 @@ function App() {
183183 const userActionMessage = createChatMessage (
184184 Sender . USER ,
185185 `User confirmed payment.` ,
186- { isUserAction : true } ,
186+ { isUserAction : true }
187187 ) ;
188188 // Let handleSendMessage manage the loading indicator
189189 setMessages ( ( prev ) => [
@@ -210,7 +210,7 @@ function App() {
210210 console . error ( "Error confirming payment:" , error ) ;
211211 const errorMessage = createChatMessage (
212212 Sender . MODEL ,
213- "Sorry, there was an issue confirming your payment." ,
213+ "Sorry, there was an issue confirming your payment."
214214 ) ;
215215 // If handleSendMessage wasn't called, we might need to manually update state
216216 // In this case, we remove the loading indicator that handleSendMessage would have added
@@ -221,7 +221,7 @@ function App() {
221221
222222 const handleSendMessage = async (
223223 messageContent : string | RequestPart [ ] ,
224- options ?: { isUserAction ?: boolean ; headers ?: Record < string , string > } ,
224+ options ?: { isUserAction ?: boolean ; headers ?: Record < string , string > }
225225 ) => {
226226 if ( isLoading ) return ;
227227
@@ -231,7 +231,7 @@ function App() {
231231 ? "<User Action>"
232232 : typeof messageContent === "string"
233233 ? messageContent
234- : "Sent complex data" ,
234+ : "Sent complex data"
235235 ) ;
236236 if ( userMessage . text ) {
237237 // Only add if there's text
@@ -366,7 +366,7 @@ function App() {
366366 console . error ( "Error sending message:" , error ) ;
367367 const errorMessage = createChatMessage (
368368 Sender . MODEL ,
369- "Sorry, something went wrong. Please try again." ,
369+ "Sorry, something went wrong. Please try again."
370370 ) ;
371371 // Replace the placeholder with the error message
372372 setMessages ( ( prev ) => [ ...prev . slice ( 0 , - 1 ) , errorMessage ] ) ;
0 commit comments