Skip to content

Commit fb78fc8

Browse files
committed
fix: wording
1 parent 3e7d742 commit fb78fc8

File tree

7 files changed

+21
-17
lines changed

7 files changed

+21
-17
lines changed

src/components/ecommerce/manage/blocks/create-client.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ export function CreateEcommerceClient() {
4040
<DialogTrigger asChild>
4141
<Button>
4242
<Plus className="mr-2 h-4 w-4" />
43-
Create Client ID
43+
Create Ecommerce Client
4444
</Button>
4545
</DialogTrigger>
4646
<DialogContent>
4747
<DialogHeader>
48-
<DialogTitle>Create New Client ID</DialogTitle>
48+
<DialogTitle>Create New Ecommerce Client</DialogTitle>
4949
</DialogHeader>
5050
<EcommerceClientForm
5151
onSubmit={handleSubmit}
5252
isLoading={isLoading}
53-
submitButtonText="Create Client ID"
53+
submitButtonText="Create Client"
5454
onCancel={() => setIsOpen(false)}
5555
/>
5656
</DialogContent>

src/components/ecommerce/manage/blocks/create-default-client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function CreateDefaultEcommerceClient() {
3434
variant="default"
3535
>
3636
{isLoading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
37-
Create Default Client ID
37+
Create Default Client
3838
</Button>
3939
);
4040
}

src/components/ecommerce/manage/blocks/delete-client.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ export function DeleteEcommerceClient({
5151
<AlertDialogTrigger asChild>{children}</AlertDialogTrigger>
5252
<AlertDialogContent>
5353
<AlertDialogHeader>
54-
<AlertDialogTitle>Delete Client ID</AlertDialogTitle>
54+
<AlertDialogTitle>Delete Ecommerce Client</AlertDialogTitle>
5555
<AlertDialogDescription className="space-y-2">
5656
<p>
57-
Are you sure you want to delete the client ID "
57+
Are you sure you want to delete the client "
5858
{ecommerceClient.label}"?
5959
</p>
6060
<p className="font-medium text-red-600">
61-
⚠️ This action cannot be undone. The client ID will be permanently
62-
removed and any integrations using it will stop working.
61+
⚠️ This action cannot be undone. The client will be permanently
62+
removed and any integrations using it's ID will stop working.
6363
</p>
6464
</AlertDialogDescription>
6565
</AlertDialogHeader>

src/components/ecommerce/manage/blocks/edit-client.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function EditEcommerceClient({
5050
<DialogTrigger asChild>{children}</DialogTrigger>
5151
<DialogContent>
5252
<DialogHeader>
53-
<DialogTitle>Edit Client ID</DialogTitle>
53+
<DialogTitle>Edit Ecommerce Client</DialogTitle>
5454
</DialogHeader>
5555
<EcommerceClientForm
5656
onSubmit={handleSubmit}
@@ -63,7 +63,7 @@ export function EditEcommerceClient({
6363
? Number(ecommerceClient.feePercentage)
6464
: undefined,
6565
}}
66-
submitButtonText="Update Client ID"
66+
submitButtonText="Update Client"
6767
onCancel={() => setIsOpen(false)}
6868
/>
6969
</DialogContent>

src/components/ecommerce/manage/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ interface EcommerceManageProps {
1414
export function EcommerceManage({
1515
initialEcommerceClients,
1616
}: EcommerceManageProps) {
17-
const shouldCreateDefault =
18-
initialEcommerceClients.length === 0 ||
19-
!initialEcommerceClients.some((c) => c.domain === DEFAULT_CLIENT_ID_DOMAIN);
2017
const { data, error, refetch, isRefetching } = api.ecommerce.getAll.useQuery(
2118
undefined,
2219
{
2320
initialData: initialEcommerceClients,
2421
refetchOnMount: true,
2522
},
2623
);
24+
const shouldCreateDefault =
25+
data.length === 0 ||
26+
!data.some((c) => c.domain === DEFAULT_CLIENT_ID_DOMAIN);
2727

2828
if (error) {
2929
return (

src/lib/schemas/ecommerce.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ const baseEcommerceClientApiSchema = z.object({
3030
domain: z.string().url(),
3131
feeAddress: z
3232
.string()
33-
.refine(isEthereumAddress, "Invalid Ethereum address format")
33+
.refine((value) => {
34+
if (value === undefined || value === "") return true;
35+
36+
return isEthereumAddress(value);
37+
}, "Invalid Ethereum address format")
3438
.optional(),
3539
feePercentage: z.coerce
3640
.number()

src/server/routers/ecommerce.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ export const ecommerceRouter = router({
4040
: {}),
4141
});
4242

43-
if (!response.data.ecommerceClient) {
44-
throw new Error("Failed to create client ID via external API.");
43+
if (!response.data.clientId) {
44+
throw new Error("Failed to create client on external API.");
4545
}
4646

4747
await db.insert(ecommerceClientTable).values({
4848
id: ulid(),
4949
userId: user.id,
5050
domain: input.domain,
51-
externalId: response.data.ecommerceClient.id,
51+
externalId: response.data.id,
5252
rnClientId: response.data.clientId,
5353
label: input.label,
5454
feeAddress: input.feeAddress,

0 commit comments

Comments
 (0)