Skip to content

Commit 078bc3c

Browse files
committed
style: format files with prettier
1 parent 9a62e5a commit 078bc3c

14 files changed

Lines changed: 89 additions & 91 deletions

File tree

a2a/chat-client/App.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type RequestPart =
3636
function 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(
4949
const 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
*/
5959
function 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]);

a2a/chat-client/components/Checkout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const CheckoutComponent: React.FC<CheckoutProps> = ({
9595
<p className="text-gray-800 font-medium pl-2">
9696
{formatCurrency(
9797
getItemTotal(lineItem).amount,
98-
checkout.currency,
98+
checkout.currency
9999
)}
100100
</p>
101101
</div>

a2a/chat-client/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class AppProperties {
2525
description: string,
2626
logoUrl: string,
2727
defaultMessage: string,
28-
titleText: string,
28+
titleText: string
2929
) {
3030
this.name = name;
3131
this.description = description;
@@ -40,5 +40,5 @@ export const appConfig = new AppProperties(
4040
"Your personal shopping assistant.",
4141
"/images/logo.jpg",
4242
"Hello, I am your Business Agent. How can I help you?",
43-
"Shop with Business Agent",
43+
"Shop with Business Agent"
4444
);

a2a/chat-client/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ const root = ReactDOM.createRoot(rootElement);
2626
root.render(
2727
<React.StrictMode>
2828
<App />
29-
</React.StrictMode>,
29+
</React.StrictMode>
3030
);

a2a/chat-client/mocks/credentialProviderProxy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ export class CredentialProviderProxy {
6161
async getSupportedPaymentMethods(
6262
user_email: string,
6363
// biome-ignore lint/suspicious/noExplicitAny: no specific type for config
64-
config: any,
64+
config: any
6565
): Promise<{ payment_method_aliases: PaymentMethod[] }> {
6666
console.log(
6767
`CredentialProviderProxy: Simulating fetch for ${user_email} supported payment methods with config:`,
68-
config,
68+
config
6969
);
7070
// Simulate network latency
7171
await new Promise((resolve) => setTimeout(resolve, 500));
@@ -80,17 +80,17 @@ export class CredentialProviderProxy {
8080
*/
8181
async getPaymentToken(
8282
user_email: string,
83-
payment_method_id: string,
83+
payment_method_id: string
8484
): Promise<PaymentInstrument | undefined> {
8585
console.log(
86-
`CredentialProviderProxy: Simulating fetch for payment token for user ${user_email} and method ${payment_method_id}`,
86+
`CredentialProviderProxy: Simulating fetch for payment token for user ${user_email} and method ${payment_method_id}`
8787
);
8888
// Simulate network latency
8989
await new Promise((resolve) => setTimeout(resolve, 500));
9090
const randomId = crypto.randomUUID();
9191
const payment_method =
9292
this._getMockPaymentMethods().payment_method_aliases.find(
93-
(method) => method.id === payment_method_id,
93+
(method) => method.id === payment_method_id
9494
);
9595

9696
if (!payment_method) {

a2a/docs/05-frontend.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class CredentialProviderProxy {
179179
// Returns mock payment methods (wrapped in object)
180180
async getSupportedPaymentMethods(
181181
user_email: string,
182-
config: any,
182+
config: any
183183
): Promise<{ payment_method_aliases: PaymentMethod[] }> {
184184
return {
185185
payment_method_aliases: [
@@ -206,7 +206,7 @@ class CredentialProviderProxy {
206206
// Converts method to PaymentInstrument with token
207207
async getPaymentToken(
208208
user_email: string,
209-
payment_method_id: string,
209+
payment_method_id: string
210210
): Promise<PaymentInstrument | undefined> {
211211
return {
212212
...payment_method,
@@ -243,6 +243,6 @@ export const appConfig = new AppProperties(
243243
"Your personal shopping assistant.",
244244
"/images/logo.jpg",
245245
"Hello, I am your Business Agent...",
246-
"Shop with Business Agent",
246+
"Shop with Business Agent"
247247
);
248248
```

0 commit comments

Comments
 (0)