@instockng/api-client 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apps/backend/src/lib/meta-capi.d.ts +1 -1
- package/dist/apps/backend/src/lib/meta-capi.js +1 -1
- package/dist/apps/backend/src/lib/order-recovery.d.ts +86 -0
- package/dist/apps/backend/src/lib/order-recovery.js +7 -2
- package/dist/apps/backend/src/notifications/producers/meta-capi-producer.d.ts +7 -0
- package/dist/apps/backend/src/notifications/producers/meta-capi-producer.js +41 -0
- package/dist/apps/backend/src/routes/admin/orders.d.ts +310 -20
- package/dist/apps/backend/src/routes/admin/orders.js +26 -2
- package/dist/apps/backend/src/routes/public/orders.d.ts +288 -6
- package/dist/apps/backend/src/routes/public/orders.js +1 -1
- package/dist/apps/backend/src/validators/order.d.ts +6 -37
- package/dist/apps/backend/src/validators/order.js +6 -7
- package/dist/enum-types.d.ts +8 -0
- package/dist/enum-types.js +5 -0
- package/dist/fetchers/carts.js +5 -0
- package/dist/fetchers/orders.d.ts +258 -1
- package/dist/hooks/admin/abandoned-carts.js +12 -8
- package/dist/hooks/admin/brands.js +15 -10
- package/dist/hooks/admin/customers.js +3 -2
- package/dist/hooks/admin/delivery-zones.js +24 -16
- package/dist/hooks/admin/discount-codes.js +24 -16
- package/dist/hooks/admin/inventory.js +15 -10
- package/dist/hooks/admin/orders.d.ts +285 -3
- package/dist/hooks/admin/orders.js +24 -15
- package/dist/hooks/admin/products.js +15 -10
- package/dist/hooks/admin/stats.js +3 -2
- package/dist/hooks/admin/variants.js +18 -12
- package/dist/hooks/admin/warehouses.js +15 -10
- package/dist/hooks/public/orders.d.ts +258 -1
- package/dist/hooks/useApiConfig.d.ts +2 -1
- package/dist/hooks/useApiConfig.js +2 -2
- package/dist/packages/api-client/src/enum-types.d.ts +8 -0
- package/dist/packages/api-client/src/enum-types.js +5 -0
- package/dist/packages/api-client/src/fetchers/carts.js +5 -0
- package/dist/packages/api-client/src/fetchers/orders.d.ts +258 -1
- package/dist/packages/api-client/src/hooks/admin/orders.d.ts +285 -3
- package/dist/packages/api-client/src/hooks/admin/orders.js +7 -4
- package/dist/packages/api-client/src/hooks/public/orders.d.ts +258 -1
- package/dist/packages/api-client/src/rpc-client.d.ts +891 -319
- package/dist/packages/api-client/src/types.d.ts +1 -4
- package/dist/packages/api-client/src/utils/query-keys.d.ts +1 -1
- package/dist/packages/api-client/src/utils/query-keys.js +1 -1
- package/dist/provider.d.ts +7 -4
- package/dist/provider.js +5 -3
- package/dist/rpc-client.d.ts +891 -319
- package/dist/types.d.ts +1 -0
- package/dist/utils/query-keys.d.ts +1 -1
- package/dist/utils/query-keys.js +1 -1
- package/package.json +1 -1
|
@@ -309,14 +309,296 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
309
309
|
"/confirm": {
|
|
310
310
|
$post: {
|
|
311
311
|
input: {};
|
|
312
|
-
output: {
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
output: {
|
|
313
|
+
error: {
|
|
314
|
+
code: string;
|
|
315
|
+
message: string;
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
outputFormat: "json";
|
|
319
|
+
status: 400;
|
|
320
|
+
} | {
|
|
321
|
+
input: {};
|
|
322
|
+
output: {
|
|
323
|
+
error: {
|
|
324
|
+
code: string;
|
|
325
|
+
message: string;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
outputFormat: "json";
|
|
329
|
+
status: 404;
|
|
330
|
+
} | {
|
|
331
|
+
input: {};
|
|
332
|
+
output: {
|
|
333
|
+
subtotal: number;
|
|
334
|
+
deliveryCharge: number;
|
|
335
|
+
totalPrice: number;
|
|
336
|
+
discountAmount: number;
|
|
337
|
+
createdAt: string;
|
|
338
|
+
updatedAt: string;
|
|
339
|
+
deletedAt: string;
|
|
340
|
+
prospectSince: string;
|
|
341
|
+
lastRecoveryAttemptAt: string;
|
|
342
|
+
brand: {
|
|
343
|
+
createdAt: string;
|
|
344
|
+
updatedAt: string;
|
|
345
|
+
deletedAt: string;
|
|
346
|
+
name: string;
|
|
347
|
+
id: string;
|
|
348
|
+
slug: string;
|
|
349
|
+
logoUrl: string | null;
|
|
350
|
+
siteUrl: string;
|
|
351
|
+
domain: string;
|
|
352
|
+
metaPixelId: string | null;
|
|
353
|
+
};
|
|
354
|
+
deliveryZone: {
|
|
355
|
+
deliveryCost: number;
|
|
356
|
+
freeShippingThreshold: number;
|
|
357
|
+
createdAt: string;
|
|
358
|
+
updatedAt: string;
|
|
359
|
+
deletedAt: string;
|
|
360
|
+
state: {
|
|
361
|
+
createdAt: string;
|
|
362
|
+
updatedAt: string;
|
|
363
|
+
deletedAt: string;
|
|
364
|
+
name: string;
|
|
365
|
+
id: string;
|
|
366
|
+
isActive: boolean;
|
|
367
|
+
};
|
|
368
|
+
name: string;
|
|
369
|
+
id: string;
|
|
370
|
+
brandId: string | null;
|
|
371
|
+
stateId: string;
|
|
372
|
+
allowCOD: boolean;
|
|
373
|
+
allowOnline: boolean;
|
|
374
|
+
waybillOnly: boolean;
|
|
375
|
+
estimatedDays: number | null;
|
|
376
|
+
isActive: boolean;
|
|
377
|
+
};
|
|
378
|
+
items: {
|
|
379
|
+
priceAtPurchase: number;
|
|
380
|
+
variant: {
|
|
381
|
+
price: number;
|
|
382
|
+
createdAt: string;
|
|
383
|
+
updatedAt: string;
|
|
384
|
+
deletedAt: string;
|
|
385
|
+
product: {
|
|
386
|
+
createdAt: string;
|
|
387
|
+
updatedAt: string;
|
|
388
|
+
deletedAt: string;
|
|
389
|
+
name: string;
|
|
390
|
+
id: string;
|
|
391
|
+
slug: string;
|
|
392
|
+
brandId: string;
|
|
393
|
+
isActive: boolean;
|
|
394
|
+
description: string | null;
|
|
395
|
+
thumbnailUrl: string | null;
|
|
396
|
+
quantityDiscounts: string | number | boolean | {
|
|
397
|
+
[x: string]: string | number | boolean | /*elided*/ any | {
|
|
398
|
+
[x: number]: string | number | boolean | /*elided*/ any | /*elided*/ any;
|
|
399
|
+
length: number;
|
|
400
|
+
toString: never;
|
|
401
|
+
toLocaleString: never;
|
|
402
|
+
pop: never;
|
|
403
|
+
push: never;
|
|
404
|
+
concat: never;
|
|
405
|
+
join: never;
|
|
406
|
+
reverse: never;
|
|
407
|
+
shift: never;
|
|
408
|
+
slice: never;
|
|
409
|
+
sort: never;
|
|
410
|
+
splice: never;
|
|
411
|
+
unshift: never;
|
|
412
|
+
indexOf: never;
|
|
413
|
+
lastIndexOf: never;
|
|
414
|
+
every: never;
|
|
415
|
+
some: never;
|
|
416
|
+
forEach: never;
|
|
417
|
+
map: never;
|
|
418
|
+
filter: never;
|
|
419
|
+
reduce: never;
|
|
420
|
+
reduceRight: never;
|
|
421
|
+
find: never;
|
|
422
|
+
findIndex: never;
|
|
423
|
+
fill: never;
|
|
424
|
+
copyWithin: never;
|
|
425
|
+
entries: never;
|
|
426
|
+
keys: never;
|
|
427
|
+
values: never;
|
|
428
|
+
includes: never;
|
|
429
|
+
flatMap: never;
|
|
430
|
+
flat: never;
|
|
431
|
+
[Symbol.iterator]: never;
|
|
432
|
+
readonly [Symbol.unscopables]: {
|
|
433
|
+
[x: number]: boolean;
|
|
434
|
+
length?: boolean;
|
|
435
|
+
toString?: boolean;
|
|
436
|
+
toLocaleString?: boolean;
|
|
437
|
+
pop?: boolean;
|
|
438
|
+
push?: boolean;
|
|
439
|
+
concat?: boolean;
|
|
440
|
+
join?: boolean;
|
|
441
|
+
reverse?: boolean;
|
|
442
|
+
shift?: boolean;
|
|
443
|
+
slice?: boolean;
|
|
444
|
+
sort?: boolean;
|
|
445
|
+
splice?: boolean;
|
|
446
|
+
unshift?: boolean;
|
|
447
|
+
indexOf?: boolean;
|
|
448
|
+
lastIndexOf?: boolean;
|
|
449
|
+
every?: boolean;
|
|
450
|
+
some?: boolean;
|
|
451
|
+
forEach?: boolean;
|
|
452
|
+
map?: boolean;
|
|
453
|
+
filter?: boolean;
|
|
454
|
+
reduce?: boolean;
|
|
455
|
+
reduceRight?: boolean;
|
|
456
|
+
find?: boolean;
|
|
457
|
+
findIndex?: boolean;
|
|
458
|
+
fill?: boolean;
|
|
459
|
+
copyWithin?: boolean;
|
|
460
|
+
entries?: boolean;
|
|
461
|
+
keys?: boolean;
|
|
462
|
+
values?: boolean;
|
|
463
|
+
includes?: boolean;
|
|
464
|
+
flatMap?: boolean;
|
|
465
|
+
flat?: boolean;
|
|
466
|
+
};
|
|
467
|
+
};
|
|
468
|
+
} | {
|
|
469
|
+
[x: number]: string | number | boolean | {
|
|
470
|
+
[x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
|
|
471
|
+
} | /*elided*/ any;
|
|
472
|
+
length: number;
|
|
473
|
+
toString: never;
|
|
474
|
+
toLocaleString: never;
|
|
475
|
+
pop: never;
|
|
476
|
+
push: never;
|
|
477
|
+
concat: never;
|
|
478
|
+
join: never;
|
|
479
|
+
reverse: never;
|
|
480
|
+
shift: never;
|
|
481
|
+
slice: never;
|
|
482
|
+
sort: never;
|
|
483
|
+
splice: never;
|
|
484
|
+
unshift: never;
|
|
485
|
+
indexOf: never;
|
|
486
|
+
lastIndexOf: never;
|
|
487
|
+
every: never;
|
|
488
|
+
some: never;
|
|
489
|
+
forEach: never;
|
|
490
|
+
map: never;
|
|
491
|
+
filter: never;
|
|
492
|
+
reduce: never;
|
|
493
|
+
reduceRight: never;
|
|
494
|
+
find: never;
|
|
495
|
+
findIndex: never;
|
|
496
|
+
fill: never;
|
|
497
|
+
copyWithin: never;
|
|
498
|
+
entries: never;
|
|
499
|
+
keys: never;
|
|
500
|
+
values: never;
|
|
501
|
+
includes: never;
|
|
502
|
+
flatMap: never;
|
|
503
|
+
flat: never;
|
|
504
|
+
[Symbol.iterator]: never;
|
|
505
|
+
readonly [Symbol.unscopables]: {
|
|
506
|
+
[x: number]: boolean;
|
|
507
|
+
length?: boolean;
|
|
508
|
+
toString?: boolean;
|
|
509
|
+
toLocaleString?: boolean;
|
|
510
|
+
pop?: boolean;
|
|
511
|
+
push?: boolean;
|
|
512
|
+
concat?: boolean;
|
|
513
|
+
join?: boolean;
|
|
514
|
+
reverse?: boolean;
|
|
515
|
+
shift?: boolean;
|
|
516
|
+
slice?: boolean;
|
|
517
|
+
sort?: boolean;
|
|
518
|
+
splice?: boolean;
|
|
519
|
+
unshift?: boolean;
|
|
520
|
+
indexOf?: boolean;
|
|
521
|
+
lastIndexOf?: boolean;
|
|
522
|
+
every?: boolean;
|
|
523
|
+
some?: boolean;
|
|
524
|
+
forEach?: boolean;
|
|
525
|
+
map?: boolean;
|
|
526
|
+
filter?: boolean;
|
|
527
|
+
reduce?: boolean;
|
|
528
|
+
reduceRight?: boolean;
|
|
529
|
+
find?: boolean;
|
|
530
|
+
findIndex?: boolean;
|
|
531
|
+
fill?: boolean;
|
|
532
|
+
copyWithin?: boolean;
|
|
533
|
+
entries?: boolean;
|
|
534
|
+
keys?: boolean;
|
|
535
|
+
values?: boolean;
|
|
536
|
+
includes?: boolean;
|
|
537
|
+
flatMap?: boolean;
|
|
538
|
+
flat?: boolean;
|
|
539
|
+
};
|
|
540
|
+
};
|
|
541
|
+
};
|
|
542
|
+
name: string | null;
|
|
543
|
+
id: string;
|
|
544
|
+
isActive: boolean;
|
|
545
|
+
thumbnailUrl: string | null;
|
|
546
|
+
productId: string;
|
|
547
|
+
sku: string;
|
|
548
|
+
trackInventory: boolean;
|
|
549
|
+
lowStockThreshold: number | null;
|
|
550
|
+
};
|
|
551
|
+
warehouse: {
|
|
552
|
+
createdAt: string;
|
|
553
|
+
updatedAt: string;
|
|
554
|
+
deletedAt: string;
|
|
555
|
+
name: string;
|
|
556
|
+
id: string;
|
|
557
|
+
isActive: boolean;
|
|
558
|
+
address: string | null;
|
|
559
|
+
city: string | null;
|
|
560
|
+
state: string | null;
|
|
561
|
+
};
|
|
562
|
+
id: string;
|
|
563
|
+
orderId: string;
|
|
564
|
+
variantId: string;
|
|
565
|
+
warehouseId: string | null;
|
|
566
|
+
quantity: number;
|
|
567
|
+
}[];
|
|
568
|
+
id: string;
|
|
569
|
+
email: string | null;
|
|
570
|
+
brandId: string;
|
|
571
|
+
deliveryZoneId: string;
|
|
572
|
+
recoveryAttempts: number;
|
|
573
|
+
recoveryDiscountCodeId: string | null;
|
|
574
|
+
wasRecovered: boolean;
|
|
575
|
+
estimatedDays: number | null;
|
|
576
|
+
orderNumber: number;
|
|
577
|
+
firstName: string;
|
|
578
|
+
lastName: string;
|
|
579
|
+
phone: string;
|
|
580
|
+
address: string;
|
|
581
|
+
city: string;
|
|
582
|
+
discountCodeId: string | null;
|
|
583
|
+
paymentMethod: import("@prisma/client").$Enums.PaymentMethod;
|
|
584
|
+
paystackReference: string | null;
|
|
585
|
+
status: import("@prisma/client").$Enums.OrderStatus;
|
|
586
|
+
cancellationReason: string | null;
|
|
587
|
+
prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
|
|
588
|
+
userActionToken: string;
|
|
589
|
+
};
|
|
590
|
+
outputFormat: "json";
|
|
591
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
315
592
|
} | {
|
|
316
593
|
input: {};
|
|
317
|
-
output: {
|
|
318
|
-
|
|
319
|
-
|
|
594
|
+
output: {
|
|
595
|
+
error: {
|
|
596
|
+
code: string;
|
|
597
|
+
message: string;
|
|
598
|
+
};
|
|
599
|
+
};
|
|
600
|
+
outputFormat: "json";
|
|
601
|
+
status: 500;
|
|
320
602
|
};
|
|
321
603
|
};
|
|
322
604
|
}, "/">;
|
|
@@ -138,7 +138,7 @@ const app = new Hono()
|
|
|
138
138
|
console.error('Failed to queue confirmation notification:', notificationError);
|
|
139
139
|
// Don't fail the request if notification fails
|
|
140
140
|
}
|
|
141
|
-
return c.
|
|
141
|
+
return c.json(formatOrderResponse(confirmedOrder));
|
|
142
142
|
}
|
|
143
143
|
catch (error) {
|
|
144
144
|
if (error.message === 'Invalid order or token') {
|
|
@@ -13,10 +13,7 @@ export declare const createOrderSchema: z.ZodObject<{
|
|
|
13
13
|
quantity: z.ZodNumber;
|
|
14
14
|
}, z.core.$strip>>;
|
|
15
15
|
discount: z.ZodOptional<z.ZodNumber>;
|
|
16
|
-
paymentMethod: z.
|
|
17
|
-
cod: "cod";
|
|
18
|
-
online: "online";
|
|
19
|
-
}>;
|
|
16
|
+
paymentMethod: () => z.ZodOptional<z.ZodString>;
|
|
20
17
|
paystackReference: z.ZodOptional<z.ZodString>;
|
|
21
18
|
}, z.core.$strip>;
|
|
22
19
|
export declare const updateOrderSchema: z.ZodObject<{
|
|
@@ -29,10 +26,7 @@ export declare const updateOrderSchema: z.ZodObject<{
|
|
|
29
26
|
deliveryZoneId: z.ZodOptional<z.ZodString>;
|
|
30
27
|
deliveryCharge: z.ZodOptional<z.ZodNumber>;
|
|
31
28
|
discount: z.ZodOptional<z.ZodNumber>;
|
|
32
|
-
paymentMethod: z.ZodOptional<z.
|
|
33
|
-
cod: "cod";
|
|
34
|
-
online: "online";
|
|
35
|
-
}>>;
|
|
29
|
+
paymentMethod: z.ZodOptional<z.ZodString>;
|
|
36
30
|
paystackReference: z.ZodOptional<z.ZodString>;
|
|
37
31
|
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
38
32
|
sku: z.ZodString;
|
|
@@ -40,24 +34,9 @@ export declare const updateOrderSchema: z.ZodObject<{
|
|
|
40
34
|
}, z.core.$strip>>>;
|
|
41
35
|
}, z.core.$strip>;
|
|
42
36
|
export declare const updateOrderStatusSchema: z.ZodObject<{
|
|
43
|
-
status: z.
|
|
44
|
-
pending: "pending";
|
|
45
|
-
shipped: "shipped";
|
|
46
|
-
delivered: "delivered";
|
|
47
|
-
cancelled: "cancelled";
|
|
48
|
-
returned: "returned";
|
|
49
|
-
prospect: "prospect";
|
|
50
|
-
}>;
|
|
37
|
+
status: z.ZodString;
|
|
51
38
|
cancellationReason: z.ZodOptional<z.ZodString>;
|
|
52
|
-
prospectReason: z.ZodOptional<z.
|
|
53
|
-
other: "other";
|
|
54
|
-
no_answer: "no_answer";
|
|
55
|
-
thinking: "thinking";
|
|
56
|
-
price_concern: "price_concern";
|
|
57
|
-
will_call_back: "will_call_back";
|
|
58
|
-
unclear_commitment: "unclear_commitment";
|
|
59
|
-
payment_issue: "payment_issue";
|
|
60
|
-
}>>;
|
|
39
|
+
prospectReason: z.ZodOptional<z.ZodString>;
|
|
61
40
|
prospectNote: z.ZodOptional<z.ZodString>;
|
|
62
41
|
warehouses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
63
42
|
orderItemId: z.ZodUUID;
|
|
@@ -66,18 +45,8 @@ export declare const updateOrderStatusSchema: z.ZodObject<{
|
|
|
66
45
|
}, z.core.$strip>;
|
|
67
46
|
export declare const orderFiltersSchema: z.ZodObject<{
|
|
68
47
|
brandId: z.ZodOptional<z.ZodUUID>;
|
|
69
|
-
status: z.ZodOptional<z.
|
|
70
|
-
|
|
71
|
-
shipped: "shipped";
|
|
72
|
-
delivered: "delivered";
|
|
73
|
-
cancelled: "cancelled";
|
|
74
|
-
returned: "returned";
|
|
75
|
-
prospect: "prospect";
|
|
76
|
-
}>>;
|
|
77
|
-
paymentMethod: z.ZodOptional<z.ZodEnum<{
|
|
78
|
-
cod: "cod";
|
|
79
|
-
online: "online";
|
|
80
|
-
}>>;
|
|
48
|
+
status: z.ZodOptional<z.ZodString>;
|
|
49
|
+
paymentMethod: z.ZodOptional<z.ZodString>;
|
|
81
50
|
warehouseId: z.ZodOptional<z.ZodUUID>;
|
|
82
51
|
search: z.ZodOptional<z.ZodString>;
|
|
83
52
|
startDate: z.ZodOptional<z.ZodString>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { OrderStatusSchema, ProspectReasonSchema, PaymentMethodSchema } from '../generated/zod';
|
|
3
2
|
// Order creation schema (public API)
|
|
4
3
|
export const createOrderSchema = z.object({
|
|
5
4
|
brandSlug: z.string().min(1),
|
|
@@ -15,7 +14,7 @@ export const createOrderSchema = z.object({
|
|
|
15
14
|
quantity: z.number().int().positive(),
|
|
16
15
|
})).min(1),
|
|
17
16
|
discount: z.number().nonnegative().optional(),
|
|
18
|
-
paymentMethod:
|
|
17
|
+
paymentMethod: z.string().optional,
|
|
19
18
|
paystackReference: z.string().optional(),
|
|
20
19
|
});
|
|
21
20
|
// Update order schema (admin API)
|
|
@@ -29,7 +28,7 @@ export const updateOrderSchema = z.object({
|
|
|
29
28
|
deliveryZoneId: z.string().uuid().optional(),
|
|
30
29
|
deliveryCharge: z.number().nonnegative().optional(),
|
|
31
30
|
discount: z.number().nonnegative().optional(),
|
|
32
|
-
paymentMethod:
|
|
31
|
+
paymentMethod: z.string().optional(),
|
|
33
32
|
paystackReference: z.string().optional(),
|
|
34
33
|
items: z.array(z.object({
|
|
35
34
|
sku: z.string().min(1),
|
|
@@ -38,9 +37,9 @@ export const updateOrderSchema = z.object({
|
|
|
38
37
|
});
|
|
39
38
|
// Update order status schema
|
|
40
39
|
export const updateOrderStatusSchema = z.object({
|
|
41
|
-
status:
|
|
40
|
+
status: z.string(),
|
|
42
41
|
cancellationReason: z.string().optional(),
|
|
43
|
-
prospectReason:
|
|
42
|
+
prospectReason: z.string().optional(),
|
|
44
43
|
prospectNote: z.string().optional(),
|
|
45
44
|
warehouses: z.array(z.object({
|
|
46
45
|
orderItemId: z.uuid(),
|
|
@@ -50,8 +49,8 @@ export const updateOrderStatusSchema = z.object({
|
|
|
50
49
|
// Order filter schema
|
|
51
50
|
export const orderFiltersSchema = z.object({
|
|
52
51
|
brandId: z.uuid().optional(),
|
|
53
|
-
status:
|
|
54
|
-
paymentMethod:
|
|
52
|
+
status: z.string().optional(),
|
|
53
|
+
paymentMethod: z.string().optional(),
|
|
55
54
|
warehouseId: z.uuid().optional(),
|
|
56
55
|
search: z.string().optional(), // Search by order number, customer name, phone
|
|
57
56
|
startDate: z.string().optional(),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum types extracted from RPC responses
|
|
3
|
+
* These are re-exported in types.ts
|
|
4
|
+
*/
|
|
5
|
+
import type { AdminOrderFull, PublicCartResponse } from './rpc-types';
|
|
6
|
+
export type OrderStatus = AdminOrderFull['status'];
|
|
7
|
+
export type ProspectReason = NonNullable<AdminOrderFull['prospectReason']>;
|
|
8
|
+
export type PaymentMethod = PublicCartResponse['availablePaymentMethods'][number];
|
package/dist/fetchers/carts.js
CHANGED
|
@@ -51,6 +51,7 @@ export async function updateCart(cartId, data) {
|
|
|
51
51
|
const clients = createRpcClients(API_URL);
|
|
52
52
|
const res = await clients.carts[':id'].$patch({
|
|
53
53
|
param: { id: cartId },
|
|
54
|
+
// @ts-expect-error - Hono RPC type inference issue
|
|
54
55
|
json: data,
|
|
55
56
|
});
|
|
56
57
|
if (!res.ok) {
|
|
@@ -72,6 +73,7 @@ export async function addCartItem(cartId, sku, quantity, fbc, fbp) {
|
|
|
72
73
|
const clients = createRpcClients(API_URL);
|
|
73
74
|
const res = await clients.carts[':id'].items.$post({
|
|
74
75
|
param: { id: cartId },
|
|
76
|
+
// @ts-expect-error - Hono RPC type inference issue
|
|
75
77
|
json: { sku, quantity, fbc, fbp },
|
|
76
78
|
});
|
|
77
79
|
if (!res.ok) {
|
|
@@ -91,6 +93,7 @@ export async function updateCartItem(cartId, itemId, quantity) {
|
|
|
91
93
|
const clients = createRpcClients(API_URL);
|
|
92
94
|
const res = await clients.carts[':id'].items[':itemId'].$patch({
|
|
93
95
|
param: { id: cartId, itemId },
|
|
96
|
+
// @ts-expect-error - Hono RPC type inference issue
|
|
94
97
|
json: { quantity },
|
|
95
98
|
});
|
|
96
99
|
if (!res.ok) {
|
|
@@ -126,6 +129,7 @@ export async function applyDiscount(cartId, code) {
|
|
|
126
129
|
const clients = createRpcClients(API_URL);
|
|
127
130
|
const res = await clients.carts[':id']['apply-discount'].$post({
|
|
128
131
|
param: { id: cartId },
|
|
132
|
+
// @ts-expect-error - Hono RPC type inference issue
|
|
129
133
|
json: { code },
|
|
130
134
|
});
|
|
131
135
|
if (!res.ok) {
|
|
@@ -160,6 +164,7 @@ export async function checkoutCart(cartId, checkoutData) {
|
|
|
160
164
|
const clients = createRpcClients(API_URL);
|
|
161
165
|
const res = await clients.carts[':id'].checkout.$post({
|
|
162
166
|
param: { id: cartId },
|
|
167
|
+
// @ts-expect-error - Hono RPC type inference issue
|
|
163
168
|
json: checkoutData,
|
|
164
169
|
});
|
|
165
170
|
if (!res.ok) {
|