@instockng/api-client 1.0.7 → 1.0.8
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/http-app.js +28 -0
- package/dist/apps/backend/src/lib/brand-response.d.ts +1 -1
- package/dist/apps/backend/src/lib/cart-helpers.d.ts +13 -11
- package/dist/apps/backend/src/lib/cart-helpers.js +28 -0
- package/dist/apps/backend/src/lib/cart-response.d.ts +5 -5
- package/dist/apps/backend/src/lib/clerk.js +23 -0
- package/dist/apps/backend/src/lib/delivery-zone-response.d.ts +6 -4
- package/dist/apps/backend/src/lib/discount-code-response.d.ts +2 -2
- package/dist/apps/backend/src/lib/meta-capi.d.ts +5 -0
- package/dist/apps/backend/src/lib/meta-capi.js +33 -2
- package/dist/apps/backend/src/lib/order-recovery.d.ts +30 -24
- package/dist/apps/backend/src/lib/order-response.d.ts +9 -7
- package/dist/apps/backend/src/lib/product-response.d.ts +4 -4
- package/dist/apps/backend/src/lib/sentry.d.ts +48 -0
- package/dist/apps/backend/src/lib/sentry.js +180 -0
- package/dist/apps/backend/src/notifications/producers/meta-capi-producer.js +18 -4
- package/dist/apps/backend/src/routes/admin/abandoned-carts.d.ts +10 -10
- package/dist/apps/backend/src/routes/admin/brands.d.ts +4 -4
- package/dist/apps/backend/src/routes/admin/customers.d.ts +9 -7
- package/dist/apps/backend/src/routes/admin/delivery-zones.d.ts +23 -15
- package/dist/apps/backend/src/routes/admin/discount-codes.d.ts +10 -10
- package/dist/apps/backend/src/routes/admin/inventory.js +10 -0
- package/dist/apps/backend/src/routes/admin/orders.d.ts +54 -42
- package/dist/apps/backend/src/routes/admin/orders.js +25 -0
- package/dist/apps/backend/src/routes/admin/products.d.ts +12 -12
- package/dist/apps/backend/src/routes/admin/products.js +34 -15
- package/dist/apps/backend/src/routes/admin/stats.d.ts +9 -7
- package/dist/apps/backend/src/routes/admin/variants.d.ts +5 -5
- package/dist/apps/backend/src/routes/admin/variants.js +42 -18
- package/dist/apps/backend/src/routes/admin/warehouses.d.ts +7 -7
- package/dist/apps/backend/src/routes/public/brands.d.ts +1 -1
- package/dist/apps/backend/src/routes/public/carts.d.ts +49 -47
- package/dist/apps/backend/src/routes/public/carts.js +148 -1
- package/dist/apps/backend/src/routes/public/delivery-zones.d.ts +2 -0
- package/dist/apps/backend/src/routes/public/delivery-zones.js +2 -0
- package/dist/apps/backend/src/routes/public/orders.d.ts +18 -14
- package/dist/apps/backend/src/routes/public/orders.js +24 -0
- package/dist/apps/backend/src/routes/public/products.d.ts +6 -6
- package/dist/apps/backend/src/types/index.d.ts +1 -0
- package/dist/apps/backend/src/validators/delivery-zone.d.ts +4 -0
- package/dist/apps/backend/src/validators/delivery-zone.js +4 -0
- package/dist/apps/backend/src/validators/discount-code.d.ts +3 -3
- package/dist/apps/backend/src/validators/order.d.ts +3 -1
- package/dist/apps/backend/src/validators/order.js +3 -1
- package/dist/packages/api-client/src/fetchers/brands.d.ts +1 -1
- package/dist/packages/api-client/src/fetchers/carts.d.ts +49 -47
- package/dist/packages/api-client/src/fetchers/delivery-zones.d.ts +2 -0
- package/dist/packages/api-client/src/fetchers/orders.d.ts +18 -14
- package/dist/packages/api-client/src/fetchers/products.d.ts +6 -6
- package/dist/packages/api-client/src/hooks/admin/abandoned-carts.d.ts +10 -10
- package/dist/packages/api-client/src/hooks/admin/brands.d.ts +4 -4
- package/dist/packages/api-client/src/hooks/admin/customers.d.ts +9 -7
- package/dist/packages/api-client/src/hooks/admin/delivery-zones.d.ts +23 -15
- package/dist/packages/api-client/src/hooks/admin/discount-codes.d.ts +10 -10
- package/dist/packages/api-client/src/hooks/admin/orders.d.ts +54 -42
- package/dist/packages/api-client/src/hooks/admin/products.d.ts +6 -6
- package/dist/packages/api-client/src/hooks/admin/stats.d.ts +9 -7
- package/dist/packages/api-client/src/hooks/admin/variants.d.ts +5 -5
- package/dist/packages/api-client/src/hooks/admin/warehouses.d.ts +7 -7
- package/dist/packages/api-client/src/hooks/public/brands.d.ts +1 -1
- package/dist/packages/api-client/src/hooks/public/carts.d.ts +49 -47
- package/dist/packages/api-client/src/hooks/public/delivery-zones.d.ts +2 -0
- package/dist/packages/api-client/src/hooks/public/orders.d.ts +18 -14
- package/dist/packages/api-client/src/hooks/public/products.d.ts +6 -6
- package/dist/packages/api-client/src/rpc-client.d.ts +219 -187
- package/package.json +1 -1
|
@@ -34,8 +34,8 @@ export declare function formatOrderResponse(order: OrderDBResponse): {
|
|
|
34
34
|
createdAt: string;
|
|
35
35
|
updatedAt: string;
|
|
36
36
|
deletedAt: string;
|
|
37
|
-
name: string;
|
|
38
37
|
id: string;
|
|
38
|
+
name: string;
|
|
39
39
|
slug: string;
|
|
40
40
|
logoUrl: string | null;
|
|
41
41
|
siteUrl: string;
|
|
@@ -52,18 +52,20 @@ export declare function formatOrderResponse(order: OrderDBResponse): {
|
|
|
52
52
|
createdAt: string;
|
|
53
53
|
updatedAt: string;
|
|
54
54
|
deletedAt: string;
|
|
55
|
-
name: string;
|
|
56
55
|
id: string;
|
|
56
|
+
name: string;
|
|
57
57
|
isActive: boolean;
|
|
58
58
|
};
|
|
59
|
-
name: string;
|
|
60
59
|
id: string;
|
|
60
|
+
name: string;
|
|
61
61
|
brandId: string | null;
|
|
62
62
|
stateId: string;
|
|
63
63
|
allowCOD: boolean;
|
|
64
64
|
allowOnline: boolean;
|
|
65
65
|
waybillOnly: boolean;
|
|
66
66
|
estimatedDays: number | null;
|
|
67
|
+
noteTitle: string | null;
|
|
68
|
+
noteContent: string | null;
|
|
67
69
|
isActive: boolean;
|
|
68
70
|
};
|
|
69
71
|
items: {
|
|
@@ -77,8 +79,8 @@ export declare function formatOrderResponse(order: OrderDBResponse): {
|
|
|
77
79
|
createdAt: string;
|
|
78
80
|
updatedAt: string;
|
|
79
81
|
deletedAt: string;
|
|
80
|
-
name: string;
|
|
81
82
|
id: string;
|
|
83
|
+
name: string;
|
|
82
84
|
slug: string;
|
|
83
85
|
brandId: string;
|
|
84
86
|
isActive: boolean;
|
|
@@ -86,8 +88,8 @@ export declare function formatOrderResponse(order: OrderDBResponse): {
|
|
|
86
88
|
thumbnailUrl: string | null;
|
|
87
89
|
quantityDiscounts: Prisma.JsonValue | null;
|
|
88
90
|
};
|
|
89
|
-
name: string | null;
|
|
90
91
|
id: string;
|
|
92
|
+
name: string | null;
|
|
91
93
|
isActive: boolean;
|
|
92
94
|
thumbnailUrl: string | null;
|
|
93
95
|
productId: string;
|
|
@@ -99,8 +101,8 @@ export declare function formatOrderResponse(order: OrderDBResponse): {
|
|
|
99
101
|
createdAt: string;
|
|
100
102
|
updatedAt: string;
|
|
101
103
|
deletedAt: string;
|
|
102
|
-
name: string;
|
|
103
104
|
id: string;
|
|
105
|
+
name: string;
|
|
104
106
|
isActive: boolean;
|
|
105
107
|
address: string | null;
|
|
106
108
|
city: string | null;
|
|
@@ -112,8 +114,8 @@ export declare function formatOrderResponse(order: OrderDBResponse): {
|
|
|
112
114
|
warehouseId: string | null;
|
|
113
115
|
quantity: number;
|
|
114
116
|
}[];
|
|
115
|
-
id: string;
|
|
116
117
|
email: string | null;
|
|
118
|
+
id: string;
|
|
117
119
|
brandId: string;
|
|
118
120
|
deliveryZoneId: string;
|
|
119
121
|
recoveryAttempts: number;
|
|
@@ -32,8 +32,8 @@ export declare function formatProductResponse(product: ProductDBResponse): {
|
|
|
32
32
|
createdAt: string;
|
|
33
33
|
updatedAt: string;
|
|
34
34
|
deletedAt: string;
|
|
35
|
-
name: string;
|
|
36
35
|
id: string;
|
|
36
|
+
name: string;
|
|
37
37
|
slug: string;
|
|
38
38
|
logoUrl: string | null;
|
|
39
39
|
siteUrl: string;
|
|
@@ -45,8 +45,8 @@ export declare function formatProductResponse(product: ProductDBResponse): {
|
|
|
45
45
|
updatedAt: string;
|
|
46
46
|
price: number;
|
|
47
47
|
deletedAt: string;
|
|
48
|
-
name: string | null;
|
|
49
48
|
id: string;
|
|
49
|
+
name: string | null;
|
|
50
50
|
isActive: boolean;
|
|
51
51
|
thumbnailUrl: string | null;
|
|
52
52
|
productId: string;
|
|
@@ -54,8 +54,8 @@ export declare function formatProductResponse(product: ProductDBResponse): {
|
|
|
54
54
|
trackInventory: boolean;
|
|
55
55
|
lowStockThreshold: number | null;
|
|
56
56
|
}[];
|
|
57
|
-
name: string;
|
|
58
57
|
id: string;
|
|
58
|
+
name: string;
|
|
59
59
|
slug: string;
|
|
60
60
|
createdAt: Date;
|
|
61
61
|
updatedAt: Date;
|
|
@@ -71,8 +71,8 @@ export declare function formatProductVariantResponse(variant: ProductVariantDBRe
|
|
|
71
71
|
updatedAt: string;
|
|
72
72
|
price: number;
|
|
73
73
|
deletedAt: string;
|
|
74
|
-
name: string | null;
|
|
75
74
|
id: string;
|
|
75
|
+
name: string | null;
|
|
76
76
|
isActive: boolean;
|
|
77
77
|
thumbnailUrl: string | null;
|
|
78
78
|
productId: string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentry error tracking for Cloudflare Workers
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for capturing errors, exceptions, and messages
|
|
5
|
+
* with proper context and sampling rates.
|
|
6
|
+
*
|
|
7
|
+
* Sentry is initialized via withSentry() wrapper in index.ts
|
|
8
|
+
*/
|
|
9
|
+
import type { Context } from 'hono';
|
|
10
|
+
/**
|
|
11
|
+
* Capture an exception with request context
|
|
12
|
+
*/
|
|
13
|
+
export declare function captureException(error: Error | unknown, context?: {
|
|
14
|
+
level?: 'fatal' | 'error' | 'warning';
|
|
15
|
+
tags?: Record<string, string>;
|
|
16
|
+
extra?: Record<string, any>;
|
|
17
|
+
fingerprint?: string[];
|
|
18
|
+
honoContext?: Context<any>;
|
|
19
|
+
}): void;
|
|
20
|
+
/**
|
|
21
|
+
* Capture a message with context (for non-exception events)
|
|
22
|
+
*/
|
|
23
|
+
export declare function captureMessage(message: string, context?: {
|
|
24
|
+
level?: 'fatal' | 'error' | 'warning' | 'info' | 'debug';
|
|
25
|
+
tags?: Record<string, string>;
|
|
26
|
+
extra?: Record<string, any>;
|
|
27
|
+
sampleRate?: number;
|
|
28
|
+
}): void;
|
|
29
|
+
/**
|
|
30
|
+
* Add breadcrumb for tracing event flow
|
|
31
|
+
*/
|
|
32
|
+
export declare function addBreadcrumb(message: string, data?: Record<string, any>, category?: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Wrap a function with Sentry error capturing
|
|
35
|
+
*/
|
|
36
|
+
export declare function withSentry<T extends (...args: any[]) => any>(fn: T, context?: {
|
|
37
|
+
tags?: Record<string, string>;
|
|
38
|
+
extra?: Record<string, any>;
|
|
39
|
+
}): T;
|
|
40
|
+
/**
|
|
41
|
+
* Helper to determine if an error should be tracked in Sentry
|
|
42
|
+
* based on its characteristics (e.g., status code, error code)
|
|
43
|
+
*/
|
|
44
|
+
export declare function shouldTrackError(statusCode: number, errorCode?: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Get sample rate for different error types
|
|
47
|
+
*/
|
|
48
|
+
export declare function getSampleRate(errorCode: string): number;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentry error tracking for Cloudflare Workers
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities for capturing errors, exceptions, and messages
|
|
5
|
+
* with proper context and sampling rates.
|
|
6
|
+
*
|
|
7
|
+
* Sentry is initialized via withSentry() wrapper in index.ts
|
|
8
|
+
*/
|
|
9
|
+
import * as Sentry from '@sentry/cloudflare';
|
|
10
|
+
/**
|
|
11
|
+
* Capture an exception with request context
|
|
12
|
+
*/
|
|
13
|
+
export function captureException(error, context) {
|
|
14
|
+
Sentry.withScope((scope) => {
|
|
15
|
+
// Set severity level
|
|
16
|
+
if (context?.level) {
|
|
17
|
+
scope.setLevel(context.level);
|
|
18
|
+
}
|
|
19
|
+
// Add tags for filtering/grouping
|
|
20
|
+
if (context?.tags) {
|
|
21
|
+
Object.entries(context.tags).forEach(([key, value]) => {
|
|
22
|
+
scope.setTag(key, value);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
// Add extra context data
|
|
26
|
+
if (context?.extra) {
|
|
27
|
+
Object.entries(context.extra).forEach(([key, value]) => {
|
|
28
|
+
scope.setExtra(key, value);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// Custom fingerprint for grouping
|
|
32
|
+
if (context?.fingerprint) {
|
|
33
|
+
scope.setFingerprint(context.fingerprint);
|
|
34
|
+
}
|
|
35
|
+
// Add request context from Hono if available
|
|
36
|
+
if (context?.honoContext) {
|
|
37
|
+
const c = context.honoContext;
|
|
38
|
+
const req = c.req;
|
|
39
|
+
// Set request context
|
|
40
|
+
scope.setContext('request', {
|
|
41
|
+
url: req.url,
|
|
42
|
+
method: req.method,
|
|
43
|
+
headers: sanitizeHeaders(req.header()),
|
|
44
|
+
});
|
|
45
|
+
// Add user context if authenticated
|
|
46
|
+
const user = c.get('user');
|
|
47
|
+
if (user) {
|
|
48
|
+
scope.setUser({
|
|
49
|
+
id: user.id,
|
|
50
|
+
email: user.email,
|
|
51
|
+
username: user.name,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
// Add brand context if available
|
|
55
|
+
const brandSlug = req.param('brandSlug') || req.query('brandSlug');
|
|
56
|
+
if (brandSlug) {
|
|
57
|
+
scope.setTag('brand', brandSlug);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Capture the exception
|
|
61
|
+
Sentry.captureException(error);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Capture a message with context (for non-exception events)
|
|
66
|
+
*/
|
|
67
|
+
export function captureMessage(message, context) {
|
|
68
|
+
// Apply sampling if specified
|
|
69
|
+
if (context?.sampleRate !== undefined && Math.random() > context.sampleRate) {
|
|
70
|
+
return; // Skip this capture based on sample rate
|
|
71
|
+
}
|
|
72
|
+
Sentry.withScope((scope) => {
|
|
73
|
+
if (context?.level) {
|
|
74
|
+
scope.setLevel(context.level);
|
|
75
|
+
}
|
|
76
|
+
if (context?.tags) {
|
|
77
|
+
Object.entries(context.tags).forEach(([key, value]) => {
|
|
78
|
+
scope.setTag(key, value);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (context?.extra) {
|
|
82
|
+
Object.entries(context.extra).forEach(([key, value]) => {
|
|
83
|
+
scope.setExtra(key, value);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
Sentry.captureMessage(message, context?.level || 'info');
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Add breadcrumb for tracing event flow
|
|
91
|
+
*/
|
|
92
|
+
export function addBreadcrumb(message, data, category) {
|
|
93
|
+
Sentry.addBreadcrumb({
|
|
94
|
+
message,
|
|
95
|
+
data,
|
|
96
|
+
category: category || 'default',
|
|
97
|
+
level: 'info',
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Wrap a function with Sentry error capturing
|
|
102
|
+
*/
|
|
103
|
+
export function withSentry(fn, context) {
|
|
104
|
+
return ((...args) => {
|
|
105
|
+
try {
|
|
106
|
+
const result = fn(...args);
|
|
107
|
+
// Handle async functions
|
|
108
|
+
if (result instanceof Promise) {
|
|
109
|
+
return result.catch((error) => {
|
|
110
|
+
captureException(error, context);
|
|
111
|
+
throw error;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
captureException(error, context);
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Sanitize headers to remove sensitive data
|
|
124
|
+
*/
|
|
125
|
+
function sanitizeHeaders(headers) {
|
|
126
|
+
const sanitized = {};
|
|
127
|
+
const sensitiveHeaders = ['authorization', 'cookie', 'x-api-key'];
|
|
128
|
+
Object.entries(headers).forEach(([key, value]) => {
|
|
129
|
+
if (sensitiveHeaders.includes(key.toLowerCase())) {
|
|
130
|
+
sanitized[key] = '[REDACTED]';
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
sanitized[key] = value;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return sanitized;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Helper to determine if an error should be tracked in Sentry
|
|
140
|
+
* based on its characteristics (e.g., status code, error code)
|
|
141
|
+
*/
|
|
142
|
+
export function shouldTrackError(statusCode, errorCode) {
|
|
143
|
+
// Always track 500 errors
|
|
144
|
+
if (statusCode >= 500) {
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
// Don't track expected client errors
|
|
148
|
+
const expectedErrors = ['UNAUTHORIZED', 'NOT_FOUND'];
|
|
149
|
+
if (errorCode && expectedErrors.includes(errorCode)) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
// Track other 4xx errors with sampling
|
|
153
|
+
return statusCode >= 400;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get sample rate for different error types
|
|
157
|
+
*/
|
|
158
|
+
export function getSampleRate(errorCode) {
|
|
159
|
+
const sampleRates = {
|
|
160
|
+
// High-volume, expected errors - low sample rate
|
|
161
|
+
CART_EXPIRED: 0.1,
|
|
162
|
+
NOT_FOUND: 0.05,
|
|
163
|
+
CART_NOT_FOUND: 0.05,
|
|
164
|
+
ORDER_NOT_FOUND: 0.05,
|
|
165
|
+
VARIANT_NOT_FOUND: 0.05,
|
|
166
|
+
// Medium-volume errors - moderate sample rate
|
|
167
|
+
INVALID_DISCOUNT_CODE: 0.2,
|
|
168
|
+
MIN_PURCHASE_NOT_MET: 0.15,
|
|
169
|
+
PAYMENT_METHOD_NOT_AVAILABLE: 0.25,
|
|
170
|
+
INVALID_DELIVERY_ZONE: 0.3,
|
|
171
|
+
PRECONDITION_FAILED: 0.5,
|
|
172
|
+
// Low-volume errors - higher sample rate
|
|
173
|
+
BAD_REQUEST: 0.1,
|
|
174
|
+
CODE_EXISTS: 1.0,
|
|
175
|
+
STATE_EXISTS: 1.0,
|
|
176
|
+
// Default for unknown errors
|
|
177
|
+
DEFAULT: 1.0,
|
|
178
|
+
};
|
|
179
|
+
return sampleRates[errorCode] ?? sampleRates.DEFAULT;
|
|
180
|
+
}
|
|
@@ -31,9 +31,13 @@ export async function enqueueAddToCartEvent(env, data) {
|
|
|
31
31
|
fbp: data.fbp,
|
|
32
32
|
},
|
|
33
33
|
customData: {
|
|
34
|
-
value: data.price, //
|
|
34
|
+
value: data.price * data.quantity, // Total value
|
|
35
35
|
currency: 'NGN',
|
|
36
|
-
|
|
36
|
+
contents: [{
|
|
37
|
+
id: data.sku,
|
|
38
|
+
quantity: data.quantity,
|
|
39
|
+
item_price: data.price,
|
|
40
|
+
}],
|
|
37
41
|
contentName: data.productName,
|
|
38
42
|
contentType: 'product',
|
|
39
43
|
numItems: data.quantity,
|
|
@@ -106,6 +110,7 @@ export async function enqueuePurchaseEvent(env, order, options) {
|
|
|
106
110
|
firstName: order.firstName,
|
|
107
111
|
lastName: order.lastName,
|
|
108
112
|
city: order.city,
|
|
113
|
+
state: order.deliveryZone.state.name,
|
|
109
114
|
country: 'ng', // Nigeria
|
|
110
115
|
clientIpAddress: options?.clientIpAddress,
|
|
111
116
|
clientUserAgent: options?.clientUserAgent,
|
|
@@ -115,7 +120,11 @@ export async function enqueuePurchaseEvent(env, order, options) {
|
|
|
115
120
|
customData: {
|
|
116
121
|
value: Number(order.totalPrice),
|
|
117
122
|
currency: 'NGN',
|
|
118
|
-
|
|
123
|
+
contents: order.items.map((item) => ({
|
|
124
|
+
id: item.variant.sku,
|
|
125
|
+
quantity: item.quantity,
|
|
126
|
+
item_price: Number(item.priceAtPurchase),
|
|
127
|
+
})),
|
|
119
128
|
contentType: 'product',
|
|
120
129
|
numItems: order.items.reduce((sum, item) => sum + item.quantity, 0),
|
|
121
130
|
},
|
|
@@ -151,12 +160,17 @@ export async function enqueueConfirmedPurchaseEvent(env, order) {
|
|
|
151
160
|
firstName: order.firstName,
|
|
152
161
|
lastName: order.lastName,
|
|
153
162
|
city: order.city,
|
|
163
|
+
state: order.deliveryZone.state.name,
|
|
154
164
|
country: 'ng', // Nigeria
|
|
155
165
|
},
|
|
156
166
|
customData: {
|
|
157
167
|
value: Number(order.totalPrice),
|
|
158
168
|
currency: 'NGN',
|
|
159
|
-
|
|
169
|
+
contents: order.items.map((item) => ({
|
|
170
|
+
id: item.variant.sku,
|
|
171
|
+
quantity: item.quantity,
|
|
172
|
+
item_price: Number(item.priceAtPurchase),
|
|
173
|
+
})),
|
|
160
174
|
contentType: 'product',
|
|
161
175
|
numItems: order.items.reduce((sum, item) => sum + item.quantity, 0),
|
|
162
176
|
},
|
|
@@ -10,8 +10,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
10
10
|
createdAt: string;
|
|
11
11
|
updatedAt: string;
|
|
12
12
|
deletedAt: string;
|
|
13
|
-
name: string;
|
|
14
13
|
id: string;
|
|
14
|
+
name: string;
|
|
15
15
|
slug: string;
|
|
16
16
|
logoUrl: string | null;
|
|
17
17
|
siteUrl: string;
|
|
@@ -31,14 +31,14 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
31
31
|
lastRecoveryAttemptAt: string;
|
|
32
32
|
recoveryDiscountCode: {
|
|
33
33
|
id: string;
|
|
34
|
+
type: string;
|
|
35
|
+
value: string;
|
|
34
36
|
createdAt: string;
|
|
35
37
|
updatedAt: string;
|
|
36
38
|
deletedAt: string;
|
|
37
39
|
brandId: string | null;
|
|
38
40
|
isActive: boolean;
|
|
39
41
|
code: string;
|
|
40
|
-
type: string;
|
|
41
|
-
value: string;
|
|
42
42
|
minPurchase: string;
|
|
43
43
|
maxDiscount: string;
|
|
44
44
|
usageLimit: number | null;
|
|
@@ -56,8 +56,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
56
56
|
variant: {
|
|
57
57
|
price: number;
|
|
58
58
|
product: {
|
|
59
|
-
name: string;
|
|
60
59
|
id: string;
|
|
60
|
+
name: string;
|
|
61
61
|
slug: string;
|
|
62
62
|
createdAt: string;
|
|
63
63
|
updatedAt: string;
|
|
@@ -212,8 +212,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
212
212
|
};
|
|
213
213
|
};
|
|
214
214
|
};
|
|
215
|
-
name: string | null;
|
|
216
215
|
id: string;
|
|
216
|
+
name: string | null;
|
|
217
217
|
createdAt: string;
|
|
218
218
|
updatedAt: string;
|
|
219
219
|
deletedAt: string;
|
|
@@ -344,8 +344,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
344
344
|
createdAt: string;
|
|
345
345
|
updatedAt: string;
|
|
346
346
|
deletedAt: string;
|
|
347
|
-
name: string;
|
|
348
347
|
id: string;
|
|
348
|
+
name: string;
|
|
349
349
|
slug: string;
|
|
350
350
|
logoUrl: string | null;
|
|
351
351
|
siteUrl: string;
|
|
@@ -365,14 +365,14 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
365
365
|
lastRecoveryAttemptAt: string;
|
|
366
366
|
recoveryDiscountCode: {
|
|
367
367
|
id: string;
|
|
368
|
+
type: string;
|
|
369
|
+
value: string;
|
|
368
370
|
createdAt: string;
|
|
369
371
|
updatedAt: string;
|
|
370
372
|
deletedAt: string;
|
|
371
373
|
brandId: string | null;
|
|
372
374
|
isActive: boolean;
|
|
373
375
|
code: string;
|
|
374
|
-
type: string;
|
|
375
|
-
value: string;
|
|
376
376
|
minPurchase: string;
|
|
377
377
|
maxDiscount: string;
|
|
378
378
|
usageLimit: number | null;
|
|
@@ -390,8 +390,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
390
390
|
variant: {
|
|
391
391
|
price: number;
|
|
392
392
|
product: {
|
|
393
|
-
name: string;
|
|
394
393
|
id: string;
|
|
394
|
+
name: string;
|
|
395
395
|
slug: string;
|
|
396
396
|
createdAt: string;
|
|
397
397
|
updatedAt: string;
|
|
@@ -546,8 +546,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
546
546
|
};
|
|
547
547
|
};
|
|
548
548
|
};
|
|
549
|
-
name: string | null;
|
|
550
549
|
id: string;
|
|
550
|
+
name: string | null;
|
|
551
551
|
createdAt: string;
|
|
552
552
|
updatedAt: string;
|
|
553
553
|
deletedAt: string;
|
|
@@ -4,8 +4,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
4
4
|
$get: {
|
|
5
5
|
input: {};
|
|
6
6
|
output: {
|
|
7
|
-
name: string;
|
|
8
7
|
id: string;
|
|
8
|
+
name: string;
|
|
9
9
|
slug: string;
|
|
10
10
|
logoUrl: string | null;
|
|
11
11
|
siteUrl: string;
|
|
@@ -52,8 +52,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
52
52
|
};
|
|
53
53
|
};
|
|
54
54
|
output: {
|
|
55
|
-
name: string;
|
|
56
55
|
id: string;
|
|
56
|
+
name: string;
|
|
57
57
|
slug: string;
|
|
58
58
|
logoUrl: string | null;
|
|
59
59
|
siteUrl: string;
|
|
@@ -86,8 +86,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
86
86
|
$post: {
|
|
87
87
|
input: {};
|
|
88
88
|
output: {
|
|
89
|
-
name: string;
|
|
90
89
|
id: string;
|
|
90
|
+
name: string;
|
|
91
91
|
slug: string;
|
|
92
92
|
logoUrl: string | null;
|
|
93
93
|
siteUrl: string;
|
|
@@ -120,8 +120,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
120
120
|
};
|
|
121
121
|
};
|
|
122
122
|
output: {
|
|
123
|
-
name: string;
|
|
124
123
|
id: string;
|
|
124
|
+
name: string;
|
|
125
125
|
slug: string;
|
|
126
126
|
logoUrl: string | null;
|
|
127
127
|
siteUrl: string;
|
|
@@ -43,8 +43,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
43
43
|
createdAt: string;
|
|
44
44
|
updatedAt: string;
|
|
45
45
|
deletedAt: string;
|
|
46
|
-
name: string;
|
|
47
46
|
id: string;
|
|
47
|
+
name: string;
|
|
48
48
|
slug: string;
|
|
49
49
|
logoUrl: string | null;
|
|
50
50
|
siteUrl: string;
|
|
@@ -61,18 +61,20 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
61
61
|
createdAt: string;
|
|
62
62
|
updatedAt: string;
|
|
63
63
|
deletedAt: string;
|
|
64
|
-
name: string;
|
|
65
64
|
id: string;
|
|
65
|
+
name: string;
|
|
66
66
|
isActive: boolean;
|
|
67
67
|
};
|
|
68
|
-
name: string;
|
|
69
68
|
id: string;
|
|
69
|
+
name: string;
|
|
70
70
|
brandId: string | null;
|
|
71
71
|
stateId: string;
|
|
72
72
|
allowCOD: boolean;
|
|
73
73
|
allowOnline: boolean;
|
|
74
74
|
waybillOnly: boolean;
|
|
75
75
|
estimatedDays: number | null;
|
|
76
|
+
noteTitle: string | null;
|
|
77
|
+
noteContent: string | null;
|
|
76
78
|
isActive: boolean;
|
|
77
79
|
};
|
|
78
80
|
items: {
|
|
@@ -86,8 +88,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
86
88
|
createdAt: string;
|
|
87
89
|
updatedAt: string;
|
|
88
90
|
deletedAt: string;
|
|
89
|
-
name: string;
|
|
90
91
|
id: string;
|
|
92
|
+
name: string;
|
|
91
93
|
slug: string;
|
|
92
94
|
brandId: string;
|
|
93
95
|
isActive: boolean;
|
|
@@ -239,8 +241,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
239
241
|
};
|
|
240
242
|
};
|
|
241
243
|
};
|
|
242
|
-
name: string | null;
|
|
243
244
|
id: string;
|
|
245
|
+
name: string | null;
|
|
244
246
|
isActive: boolean;
|
|
245
247
|
thumbnailUrl: string | null;
|
|
246
248
|
productId: string;
|
|
@@ -252,8 +254,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
252
254
|
createdAt: string;
|
|
253
255
|
updatedAt: string;
|
|
254
256
|
deletedAt: string;
|
|
255
|
-
name: string;
|
|
256
257
|
id: string;
|
|
258
|
+
name: string;
|
|
257
259
|
isActive: boolean;
|
|
258
260
|
address: string | null;
|
|
259
261
|
city: string | null;
|
|
@@ -265,8 +267,8 @@ declare const app: import("hono/hono-base").HonoBase<AppContext, {
|
|
|
265
267
|
warehouseId: string | null;
|
|
266
268
|
quantity: number;
|
|
267
269
|
}[];
|
|
268
|
-
id: string;
|
|
269
270
|
email: string | null;
|
|
271
|
+
id: string;
|
|
270
272
|
brandId: string;
|
|
271
273
|
deliveryZoneId: string;
|
|
272
274
|
recoveryAttempts: number;
|