@mohasinac/appkit 4.17.0 → 4.19.0
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/_internal/client/features/lottery/LotteryAdminEditView.js +3 -1
- package/dist/_internal/client/features/lottery/LotteryPullForm.js +3 -1
- package/dist/_internal/shared/features/lottery/config-form.d.ts +58 -0
- package/dist/_internal/shared/features/lottery/config-form.js +71 -0
- package/dist/client.d.ts +8 -0
- package/dist/client.js +8 -0
- package/dist/features/account/schemas/index.d.ts +23 -0
- package/dist/features/account/schemas/index.js +21 -0
- package/dist/features/admin/components/AdminAdEditorView.js +4 -2
- package/dist/features/admin/components/AdminAddressEditorView.js +4 -2
- package/dist/features/admin/components/AdminEmployeeEditorView.js +3 -1
- package/dist/features/admin/components/AdminFeatureFlagsView.js +4 -2
- package/dist/features/admin/components/AdminOrderEditorView.js +4 -2
- package/dist/features/admin/components/AdminSiteSettingsView.js +8 -6
- package/dist/features/admin/components/AdminSiteView.js +4 -2
- package/dist/features/admin/components/AdminStoreEditorView.js +11 -9
- package/dist/features/admin/components/AdminUserEditorView.js +14 -12
- package/dist/features/admin/components/AdminUsersView.js +4 -2
- package/dist/features/admin/schemas/admin-editor-forms.d.ts +119 -0
- package/dist/features/admin/schemas/admin-editor-forms.js +141 -0
- package/dist/features/admin/schemas/admin-ops-forms.d.ts +123 -0
- package/dist/features/admin/schemas/admin-ops-forms.js +147 -0
- package/dist/features/admin/schemas/admin-user-form.d.ts +82 -0
- package/dist/features/admin/schemas/admin-user-form.js +102 -0
- package/dist/features/admin/schemas/site-settings-form.d.ts +309 -0
- package/dist/features/admin/schemas/site-settings-form.js +159 -0
- package/dist/features/auctions/components/PlaceBidFormClient.js +3 -2
- package/dist/features/orders/schemas/buyer-forms.d.ts +46 -0
- package/dist/features/orders/schemas/buyer-forms.js +81 -0
- package/dist/features/scams/schemas/report-form.d.ts +63 -0
- package/dist/features/scams/schemas/report-form.js +88 -0
- package/dist/features/store-extensions/schemas/sublisting-category-form.d.ts +15 -0
- package/dist/features/store-extensions/schemas/sublisting-category-form.js +41 -0
- package/dist/features/whatsapp-bot/components/SellerWhatsAppSettingsView.js +4 -2
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/schemas/registry.d.ts +682 -0
- package/dist/schemas/registry.js +22 -0
- package/package.json +1 -1
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const siteSettingsFormSchema: z.ZodObject<{
|
|
3
|
+
announcementBar: z.ZodOptional<z.ZodObject<{
|
|
4
|
+
message: z.ZodOptional<z.ZodString>;
|
|
5
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
6
|
+
link: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
7
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
8
|
+
message: z.ZodOptional<z.ZodString>;
|
|
9
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
link: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
11
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
12
|
+
message: z.ZodOptional<z.ZodString>;
|
|
13
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
link: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
15
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
16
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
18
|
+
supportEmail: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
19
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
21
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
22
|
+
supportEmail: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
23
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
25
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
26
|
+
supportEmail: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
27
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
29
|
+
commissions: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
platformFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
gatewayFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
platformFeeMax: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
minPayoutAmount: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
payoutHoldDays: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
codHandlingFee: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
codDepositPercent: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
38
|
+
platformFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
gatewayFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
platformFeeMax: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
minPayoutAmount: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
payoutHoldDays: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
codHandlingFee: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
codDepositPercent: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
46
|
+
platformFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
gatewayFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
platformFeeMax: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
minPayoutAmount: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
payoutHoldDays: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
codHandlingFee: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
codDepositPercent: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
54
|
+
laborRate: z.ZodOptional<z.ZodObject<{
|
|
55
|
+
hourlyRate: z.ZodOptional<z.ZodNumber>;
|
|
56
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
57
|
+
hourlyRate: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
59
|
+
hourlyRate: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
61
|
+
emi: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
surchargePercent: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
surchargeSellerSharePercent: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
minOrderAmount: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
66
|
+
surchargePercent: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
surchargeSellerSharePercent: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
minOrderAmount: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
70
|
+
surchargePercent: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
surchargeSellerSharePercent: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
minOrderAmount: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
74
|
+
gst: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
gstin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
76
|
+
ratePercent: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
78
|
+
gstin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
79
|
+
ratePercent: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
81
|
+
gstin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
82
|
+
ratePercent: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
84
|
+
auctionConfig: z.ZodOptional<z.ZodObject<{
|
|
85
|
+
minBidIncrement: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
extensionMinutes: z.ZodOptional<z.ZodNumber>;
|
|
87
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
88
|
+
minBidIncrement: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
extensionMinutes: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
91
|
+
minBidIncrement: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
extensionMinutes: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
94
|
+
seo: z.ZodOptional<z.ZodObject<{
|
|
95
|
+
title: z.ZodOptional<z.ZodString>;
|
|
96
|
+
description: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
98
|
+
title: z.ZodOptional<z.ZodString>;
|
|
99
|
+
description: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
101
|
+
title: z.ZodOptional<z.ZodString>;
|
|
102
|
+
description: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
104
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
105
|
+
announcementBar: z.ZodOptional<z.ZodObject<{
|
|
106
|
+
message: z.ZodOptional<z.ZodString>;
|
|
107
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
+
link: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
109
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
110
|
+
message: z.ZodOptional<z.ZodString>;
|
|
111
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
112
|
+
link: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
113
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
114
|
+
message: z.ZodOptional<z.ZodString>;
|
|
115
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
link: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
117
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
118
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
119
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
120
|
+
supportEmail: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
121
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
123
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
124
|
+
supportEmail: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
125
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
127
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
128
|
+
supportEmail: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
129
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
130
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
131
|
+
commissions: z.ZodOptional<z.ZodObject<{
|
|
132
|
+
platformFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
133
|
+
gatewayFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
134
|
+
platformFeeMax: z.ZodOptional<z.ZodNumber>;
|
|
135
|
+
minPayoutAmount: z.ZodOptional<z.ZodNumber>;
|
|
136
|
+
payoutHoldDays: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
codHandlingFee: z.ZodOptional<z.ZodNumber>;
|
|
138
|
+
codDepositPercent: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
140
|
+
platformFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
gatewayFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
platformFeeMax: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
minPayoutAmount: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
payoutHoldDays: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
codHandlingFee: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
codDepositPercent: z.ZodOptional<z.ZodNumber>;
|
|
147
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
148
|
+
platformFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
149
|
+
gatewayFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
platformFeeMax: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
minPayoutAmount: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
payoutHoldDays: z.ZodOptional<z.ZodNumber>;
|
|
153
|
+
codHandlingFee: z.ZodOptional<z.ZodNumber>;
|
|
154
|
+
codDepositPercent: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
156
|
+
laborRate: z.ZodOptional<z.ZodObject<{
|
|
157
|
+
hourlyRate: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
159
|
+
hourlyRate: z.ZodOptional<z.ZodNumber>;
|
|
160
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
161
|
+
hourlyRate: z.ZodOptional<z.ZodNumber>;
|
|
162
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
163
|
+
emi: z.ZodOptional<z.ZodObject<{
|
|
164
|
+
surchargePercent: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
surchargeSellerSharePercent: z.ZodOptional<z.ZodNumber>;
|
|
166
|
+
minOrderAmount: z.ZodOptional<z.ZodNumber>;
|
|
167
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
168
|
+
surchargePercent: z.ZodOptional<z.ZodNumber>;
|
|
169
|
+
surchargeSellerSharePercent: z.ZodOptional<z.ZodNumber>;
|
|
170
|
+
minOrderAmount: z.ZodOptional<z.ZodNumber>;
|
|
171
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
172
|
+
surchargePercent: z.ZodOptional<z.ZodNumber>;
|
|
173
|
+
surchargeSellerSharePercent: z.ZodOptional<z.ZodNumber>;
|
|
174
|
+
minOrderAmount: z.ZodOptional<z.ZodNumber>;
|
|
175
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
176
|
+
gst: z.ZodOptional<z.ZodObject<{
|
|
177
|
+
gstin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
178
|
+
ratePercent: z.ZodOptional<z.ZodNumber>;
|
|
179
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
180
|
+
gstin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
181
|
+
ratePercent: z.ZodOptional<z.ZodNumber>;
|
|
182
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
183
|
+
gstin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
184
|
+
ratePercent: z.ZodOptional<z.ZodNumber>;
|
|
185
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
186
|
+
auctionConfig: z.ZodOptional<z.ZodObject<{
|
|
187
|
+
minBidIncrement: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
extensionMinutes: z.ZodOptional<z.ZodNumber>;
|
|
189
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
190
|
+
minBidIncrement: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
extensionMinutes: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
193
|
+
minBidIncrement: z.ZodOptional<z.ZodNumber>;
|
|
194
|
+
extensionMinutes: z.ZodOptional<z.ZodNumber>;
|
|
195
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
196
|
+
seo: z.ZodOptional<z.ZodObject<{
|
|
197
|
+
title: z.ZodOptional<z.ZodString>;
|
|
198
|
+
description: z.ZodOptional<z.ZodString>;
|
|
199
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
200
|
+
title: z.ZodOptional<z.ZodString>;
|
|
201
|
+
description: z.ZodOptional<z.ZodString>;
|
|
202
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
203
|
+
title: z.ZodOptional<z.ZodString>;
|
|
204
|
+
description: z.ZodOptional<z.ZodString>;
|
|
205
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
206
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
207
|
+
announcementBar: z.ZodOptional<z.ZodObject<{
|
|
208
|
+
message: z.ZodOptional<z.ZodString>;
|
|
209
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
210
|
+
link: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
211
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
212
|
+
message: z.ZodOptional<z.ZodString>;
|
|
213
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
214
|
+
link: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
215
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
216
|
+
message: z.ZodOptional<z.ZodString>;
|
|
217
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
218
|
+
link: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
219
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
220
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
221
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
222
|
+
supportEmail: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
223
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
224
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
225
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
226
|
+
supportEmail: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
227
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
228
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
229
|
+
email: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
230
|
+
supportEmail: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
231
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
232
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
233
|
+
commissions: z.ZodOptional<z.ZodObject<{
|
|
234
|
+
platformFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
235
|
+
gatewayFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
236
|
+
platformFeeMax: z.ZodOptional<z.ZodNumber>;
|
|
237
|
+
minPayoutAmount: z.ZodOptional<z.ZodNumber>;
|
|
238
|
+
payoutHoldDays: z.ZodOptional<z.ZodNumber>;
|
|
239
|
+
codHandlingFee: z.ZodOptional<z.ZodNumber>;
|
|
240
|
+
codDepositPercent: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
242
|
+
platformFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
243
|
+
gatewayFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
244
|
+
platformFeeMax: z.ZodOptional<z.ZodNumber>;
|
|
245
|
+
minPayoutAmount: z.ZodOptional<z.ZodNumber>;
|
|
246
|
+
payoutHoldDays: z.ZodOptional<z.ZodNumber>;
|
|
247
|
+
codHandlingFee: z.ZodOptional<z.ZodNumber>;
|
|
248
|
+
codDepositPercent: z.ZodOptional<z.ZodNumber>;
|
|
249
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
250
|
+
platformFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
251
|
+
gatewayFeePercent: z.ZodOptional<z.ZodNumber>;
|
|
252
|
+
platformFeeMax: z.ZodOptional<z.ZodNumber>;
|
|
253
|
+
minPayoutAmount: z.ZodOptional<z.ZodNumber>;
|
|
254
|
+
payoutHoldDays: z.ZodOptional<z.ZodNumber>;
|
|
255
|
+
codHandlingFee: z.ZodOptional<z.ZodNumber>;
|
|
256
|
+
codDepositPercent: z.ZodOptional<z.ZodNumber>;
|
|
257
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
258
|
+
laborRate: z.ZodOptional<z.ZodObject<{
|
|
259
|
+
hourlyRate: z.ZodOptional<z.ZodNumber>;
|
|
260
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
261
|
+
hourlyRate: z.ZodOptional<z.ZodNumber>;
|
|
262
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
263
|
+
hourlyRate: z.ZodOptional<z.ZodNumber>;
|
|
264
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
265
|
+
emi: z.ZodOptional<z.ZodObject<{
|
|
266
|
+
surchargePercent: z.ZodOptional<z.ZodNumber>;
|
|
267
|
+
surchargeSellerSharePercent: z.ZodOptional<z.ZodNumber>;
|
|
268
|
+
minOrderAmount: z.ZodOptional<z.ZodNumber>;
|
|
269
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
270
|
+
surchargePercent: z.ZodOptional<z.ZodNumber>;
|
|
271
|
+
surchargeSellerSharePercent: z.ZodOptional<z.ZodNumber>;
|
|
272
|
+
minOrderAmount: z.ZodOptional<z.ZodNumber>;
|
|
273
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
274
|
+
surchargePercent: z.ZodOptional<z.ZodNumber>;
|
|
275
|
+
surchargeSellerSharePercent: z.ZodOptional<z.ZodNumber>;
|
|
276
|
+
minOrderAmount: z.ZodOptional<z.ZodNumber>;
|
|
277
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
278
|
+
gst: z.ZodOptional<z.ZodObject<{
|
|
279
|
+
gstin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
280
|
+
ratePercent: z.ZodOptional<z.ZodNumber>;
|
|
281
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
282
|
+
gstin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
283
|
+
ratePercent: z.ZodOptional<z.ZodNumber>;
|
|
284
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
285
|
+
gstin: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
286
|
+
ratePercent: z.ZodOptional<z.ZodNumber>;
|
|
287
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
288
|
+
auctionConfig: z.ZodOptional<z.ZodObject<{
|
|
289
|
+
minBidIncrement: z.ZodOptional<z.ZodNumber>;
|
|
290
|
+
extensionMinutes: z.ZodOptional<z.ZodNumber>;
|
|
291
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
292
|
+
minBidIncrement: z.ZodOptional<z.ZodNumber>;
|
|
293
|
+
extensionMinutes: z.ZodOptional<z.ZodNumber>;
|
|
294
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
295
|
+
minBidIncrement: z.ZodOptional<z.ZodNumber>;
|
|
296
|
+
extensionMinutes: z.ZodOptional<z.ZodNumber>;
|
|
297
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
298
|
+
seo: z.ZodOptional<z.ZodObject<{
|
|
299
|
+
title: z.ZodOptional<z.ZodString>;
|
|
300
|
+
description: z.ZodOptional<z.ZodString>;
|
|
301
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
302
|
+
title: z.ZodOptional<z.ZodString>;
|
|
303
|
+
description: z.ZodOptional<z.ZodString>;
|
|
304
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
305
|
+
title: z.ZodOptional<z.ZodString>;
|
|
306
|
+
description: z.ZodOptional<z.ZodString>;
|
|
307
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
308
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
309
|
+
export type SiteSettingsFormValues = z.infer<typeof siteSettingsFormSchema>;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WHY: `AdminSiteSettingsView` is 1826 lines with **21 `<Form>` tags and no
|
|
3
|
+
* schema on any of them**. All 21 are tabs over one document and save
|
|
4
|
+
* through a single `buildFullPayload()` → one PUT, so this is one form
|
|
5
|
+
* wearing twenty-one hats, entirely unvalidated.
|
|
6
|
+
*
|
|
7
|
+
* Live consequences already documented for this exact payload:
|
|
8
|
+
* · `announcementBar` was saved under the key `text` until 2026-08-24 —
|
|
9
|
+
* a key no renderer has ever read — so admin-authored announcements
|
|
10
|
+
* saved successfully and never appeared.
|
|
11
|
+
* · `adSettings`, `integrations`, `platformLimits`, `tagline` and
|
|
12
|
+
* `favicon` were written here while undeclared on
|
|
13
|
+
* `SiteSettingsDocument`, which is how an unmasked ad-credentials
|
|
14
|
+
* blob reached anonymous callers (Recurrent Root Cause #70).
|
|
15
|
+
*
|
|
16
|
+
* WHAT: A schema that validates the fields with real rules and **passes the
|
|
17
|
+
* rest through untouched**.
|
|
18
|
+
*
|
|
19
|
+
* ## 🛑 This one is `.passthrough()`, deliberately, and that is the whole point
|
|
20
|
+
*
|
|
21
|
+
* Everywhere else in this rework an update schema is `.strict()`. Here that
|
|
22
|
+
* would be actively dangerous. `buildFullPayload()` demonstrably writes keys
|
|
23
|
+
* the TypeScript interface does not declare, and a closed schema would SILENTLY
|
|
24
|
+
* STRIP every one of them on the next save — turning a validation improvement
|
|
25
|
+
* into the largest single act of data loss in the codebase. That is the
|
|
26
|
+
* `productBaseSchema` failure, aimed at the site's entire configuration.
|
|
27
|
+
*
|
|
28
|
+
* So: constrain what can be reasoned about (percentages that must be 0–100,
|
|
29
|
+
* money that must be non-negative, a contact email that must be an email), and
|
|
30
|
+
* let the rest pass. Tightening any group is a separate, evidence-led change —
|
|
31
|
+
* per the data-integrity protocol, only after a full-collection round-trip
|
|
32
|
+
* diff proves the schema is a superset of what is stored.
|
|
33
|
+
*
|
|
34
|
+
* EXPORTS: siteSettingsFormSchema, type SiteSettingsFormValues
|
|
35
|
+
*
|
|
36
|
+
* @tag domain:admin
|
|
37
|
+
* @tag layer:schema
|
|
38
|
+
* @tag pattern:none
|
|
39
|
+
* @tag access:isomorphic
|
|
40
|
+
* @tag consumers:AdminSiteSettingsView
|
|
41
|
+
* @tag sideEffects:none
|
|
42
|
+
*/
|
|
43
|
+
import { z } from "zod";
|
|
44
|
+
/** A percentage a human types into a settings box. */
|
|
45
|
+
const percent = (label) => z.coerce
|
|
46
|
+
.number({ invalid_type_error: `${label} must be a number.` })
|
|
47
|
+
.min(0, `${label} cannot be negative.`)
|
|
48
|
+
.max(100, `${label} cannot exceed 100%.`)
|
|
49
|
+
.optional();
|
|
50
|
+
/** A non-negative rupee amount. */
|
|
51
|
+
const money = (label) => z.coerce
|
|
52
|
+
.number({ invalid_type_error: `${label} must be a number.` })
|
|
53
|
+
.min(0, `${label} cannot be negative.`)
|
|
54
|
+
.optional();
|
|
55
|
+
/** An optional email box — blank is allowed, malformed is not. */
|
|
56
|
+
const optionalEmail = z
|
|
57
|
+
.string()
|
|
58
|
+
.trim()
|
|
59
|
+
.toLowerCase()
|
|
60
|
+
.email("That doesn't look like an email address.")
|
|
61
|
+
.optional()
|
|
62
|
+
.or(z.literal(""));
|
|
63
|
+
/** An optional URL box — blank is allowed, malformed is not. */
|
|
64
|
+
const optionalUrl = z
|
|
65
|
+
.string()
|
|
66
|
+
.trim()
|
|
67
|
+
.url("Enter a full URL, including https://.")
|
|
68
|
+
.optional()
|
|
69
|
+
.or(z.literal(""));
|
|
70
|
+
export const siteSettingsFormSchema = z
|
|
71
|
+
.object({
|
|
72
|
+
/*
|
|
73
|
+
* 🛑 `message` is the canonical key. Naming it here is what stops the
|
|
74
|
+
* `text` mistake recurring: a payload carrying `text` still passes (the
|
|
75
|
+
* schema is open), but the one key a renderer reads is now declared, and
|
|
76
|
+
* the form is typed against it.
|
|
77
|
+
*/
|
|
78
|
+
announcementBar: z
|
|
79
|
+
.object({
|
|
80
|
+
message: z.string().trim().max(300, "Keep the announcement under 300 characters.").optional(),
|
|
81
|
+
enabled: z.boolean().optional(),
|
|
82
|
+
link: optionalUrl,
|
|
83
|
+
})
|
|
84
|
+
.passthrough()
|
|
85
|
+
.optional(),
|
|
86
|
+
contact: z
|
|
87
|
+
.object({
|
|
88
|
+
email: optionalEmail,
|
|
89
|
+
supportEmail: optionalEmail,
|
|
90
|
+
phone: z.string().trim().max(40).optional(),
|
|
91
|
+
})
|
|
92
|
+
.passthrough()
|
|
93
|
+
.optional(),
|
|
94
|
+
/*
|
|
95
|
+
* The commission block. Every one of these is a percentage or an amount
|
|
96
|
+
* that multiplies against real orders, and all were free text — a stray
|
|
97
|
+
* keystroke in `platformFeePercent` changes what every seller is charged.
|
|
98
|
+
*/
|
|
99
|
+
commissions: z
|
|
100
|
+
.object({
|
|
101
|
+
platformFeePercent: percent("Platform fee"),
|
|
102
|
+
gatewayFeePercent: percent("Gateway fee"),
|
|
103
|
+
platformFeeMax: money("Platform fee cap"),
|
|
104
|
+
minPayoutAmount: money("Minimum payout"),
|
|
105
|
+
payoutHoldDays: z.coerce.number().int().min(0).max(365).optional(),
|
|
106
|
+
codHandlingFee: money("COD handling fee"),
|
|
107
|
+
codDepositPercent: percent("COD deposit"),
|
|
108
|
+
})
|
|
109
|
+
.passthrough()
|
|
110
|
+
.optional(),
|
|
111
|
+
laborRate: z
|
|
112
|
+
.object({ hourlyRate: money("Hourly rate") })
|
|
113
|
+
.passthrough()
|
|
114
|
+
.optional(),
|
|
115
|
+
emi: z
|
|
116
|
+
.object({
|
|
117
|
+
surchargePercent: percent("EMI surcharge"),
|
|
118
|
+
surchargeSellerSharePercent: percent("Seller share"),
|
|
119
|
+
minOrderAmount: money("Minimum EMI order"),
|
|
120
|
+
})
|
|
121
|
+
.passthrough()
|
|
122
|
+
.optional(),
|
|
123
|
+
gst: z
|
|
124
|
+
.object({
|
|
125
|
+
// 15 characters, the statutory format. A wrong GSTIN appears on every
|
|
126
|
+
// invoice the platform issues.
|
|
127
|
+
gstin: z
|
|
128
|
+
.string()
|
|
129
|
+
.trim()
|
|
130
|
+
.toUpperCase()
|
|
131
|
+
.regex(/^\d{2}[A-Z]{5}\d{4}[A-Z]\d[A-Z\d][A-Z\d]$/, "That is not a valid 15-character GSTIN.")
|
|
132
|
+
.optional()
|
|
133
|
+
.or(z.literal("")),
|
|
134
|
+
ratePercent: percent("GST rate"),
|
|
135
|
+
})
|
|
136
|
+
.passthrough()
|
|
137
|
+
.optional(),
|
|
138
|
+
auctionConfig: z
|
|
139
|
+
.object({
|
|
140
|
+
minBidIncrement: money("Minimum bid increment"),
|
|
141
|
+
extensionMinutes: z.coerce.number().int().min(0).max(1440).optional(),
|
|
142
|
+
})
|
|
143
|
+
.passthrough()
|
|
144
|
+
.optional(),
|
|
145
|
+
seo: z
|
|
146
|
+
.object({
|
|
147
|
+
title: z.string().trim().max(70, "Search engines truncate titles past ~70 characters.").optional(),
|
|
148
|
+
description: z
|
|
149
|
+
.string()
|
|
150
|
+
.trim()
|
|
151
|
+
.max(160, "Search engines truncate descriptions past ~160 characters.")
|
|
152
|
+
.optional(),
|
|
153
|
+
})
|
|
154
|
+
.passthrough()
|
|
155
|
+
.optional(),
|
|
156
|
+
})
|
|
157
|
+
// See the header: OPEN on purpose. `buildFullPayload()` writes keys the
|
|
158
|
+
// document interface does not declare, and closing this would delete them.
|
|
159
|
+
.passthrough();
|
|
@@ -13,6 +13,7 @@ import { useLiveAuctionBid } from "../hooks/useLiveAuctionBid";
|
|
|
13
13
|
import { AUCTION_BUYOUT_WINDOW_MINUTES } from "../../../_internal/shared/checkout/lanes";
|
|
14
14
|
import { BID_PRESET_MULTIPLIERS, isBuyNowAvailable, resolveMinBid, resolveMinBidIncrement, } from "../../../_internal/shared/features/auctions/config";
|
|
15
15
|
import { normalizeError } from "../../../errors/normalize";
|
|
16
|
+
import { FormErrorSummary } from "../../../ui/forms/FormErrorSummary";
|
|
16
17
|
const __P = {
|
|
17
18
|
p5: "p-[var(--appkit-space-5)]",
|
|
18
19
|
};
|
|
@@ -179,10 +180,10 @@ export function PlaceBidFormClient({ productId, currentBid: ssrCurrentBid, start
|
|
|
179
180
|
}
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
|
-
return (_jsxs(Stack, { className: `${__P.p5}`, border: "subtle", gap: "md", rounded: "xl", surface: "muted", children: [_jsxs(Stack, { gap: "xs", children: [_jsxs(Row, { justify: "between", align: "center", children: [_jsx(Text, { size: "xs", color: "muted", children: hasBids ? "Current bid" : "Starting bid" }), _jsx(Text, { size: "xs", color: "muted", children: hasBids ? "Starting bid" : "Minimum bid" })] }), _jsxs(Row, { justify: "between", align: "baseline", children: [_jsx(Span, { size: "xl", weight: "bold", className: "text-primary-600 dark:text-primary-400", children: formatCurrency(currentBid, currency) }), _jsx(Span, { size: "sm", color: "muted", children: formatCurrency(hasBids ? startingBid : minBid, currency) })] }), _jsxs(Text, { size: "xs", color: "faint", children: [bidCount, " ", bidCount === 1 ? "bid" : "bids", " \u00B7 min increment", " ", formatCurrency(minBidIncrement, currency)] })] }), _jsx(LoginRequiredModal, { isOpen: showLoginModal, onClose: () => setShowLoginModal(false), message: "You need to be signed in to place a bid. Please log in or create an account to continue." }), _jsx(Form, { onSubmit: (e) => {
|
|
183
|
+
return (_jsxs(Stack, { className: `${__P.p5}`, border: "subtle", gap: "md", rounded: "xl", surface: "muted", children: [_jsxs(Stack, { gap: "xs", children: [_jsxs(Row, { justify: "between", align: "center", children: [_jsx(Text, { size: "xs", color: "muted", children: hasBids ? "Current bid" : "Starting bid" }), _jsx(Text, { size: "xs", color: "muted", children: hasBids ? "Starting bid" : "Minimum bid" })] }), _jsxs(Row, { justify: "between", align: "baseline", children: [_jsx(Span, { size: "xl", weight: "bold", className: "text-primary-600 dark:text-primary-400", children: formatCurrency(currentBid, currency) }), _jsx(Span, { size: "sm", color: "muted", children: formatCurrency(hasBids ? startingBid : minBid, currency) })] }), _jsxs(Text, { size: "xs", color: "faint", children: [bidCount, " ", bidCount === 1 ? "bid" : "bids", " \u00B7 min increment", " ", formatCurrency(minBidIncrement, currency)] })] }), _jsx(LoginRequiredModal, { isOpen: showLoginModal, onClose: () => setShowLoginModal(false), message: "You need to be signed in to place a bid. Please log in or create an account to continue." }), _jsx(Form, { schema: schema, onSubmit: (e) => {
|
|
183
184
|
// handler wired through render-prop below — keeps setFieldError in scope
|
|
184
185
|
e.preventDefault();
|
|
185
|
-
}, children: ({ setFieldError, clearErrors }) => (_jsxs(Stack, { gap: "sm", children: [_jsxs(Row, { gap: "xs", wrap: true, role: "radiogroup", "aria-label": "Bid amount preset", children: [BID_PRESET_MULTIPLIERS.map((n) => {
|
|
186
|
+
}, children: ({ setFieldError, clearErrors }) => (_jsxs(Stack, { gap: "sm", children: [_jsx(FormErrorSummary, {}), _jsxs(Row, { gap: "xs", wrap: true, role: "radiogroup", "aria-label": "Bid amount preset", children: [BID_PRESET_MULTIPLIERS.map((n) => {
|
|
186
187
|
const amount = presetAmount(n);
|
|
187
188
|
const delta = amount - currentBid;
|
|
188
189
|
// `delta` is 0 only for the opening preset on a bid-free
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Cancelling an order.
|
|
4
|
+
*
|
|
5
|
+
* A reason floor of 5 characters, because this text is what the seller reads
|
|
6
|
+
* to decide whether to restock, refund early or dispute — and "x" tells them
|
|
7
|
+
* nothing. Deliberately low: the buyer is cancelling, not writing an essay,
|
|
8
|
+
* and a high floor would push them to type filler.
|
|
9
|
+
*/
|
|
10
|
+
export declare const orderCancelSchema: z.ZodObject<{
|
|
11
|
+
reason: z.ZodString;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
reason: string;
|
|
14
|
+
}, {
|
|
15
|
+
reason: string;
|
|
16
|
+
}>;
|
|
17
|
+
export type OrderCancelValues = z.infer<typeof orderCancelSchema>;
|
|
18
|
+
/**
|
|
19
|
+
* Uploading proof of a manual (cash / UPI / EMI) payment.
|
|
20
|
+
*
|
|
21
|
+
* ## Every field here is evidence
|
|
22
|
+
*
|
|
23
|
+
* An admin verifies or rejects on this, and a rejection carries a 7-day ban
|
|
24
|
+
* cascade — so the cost of a sloppy submission is real in both directions.
|
|
25
|
+
*
|
|
26
|
+
* `buyerMarkedPaid` and `buyerFraudAgreementAccepted` are `z.literal(true)`
|
|
27
|
+
* rather than `z.boolean()`: an unchecked declaration is not a submission with
|
|
28
|
+
* a `false` in it, it is a form that must not send.
|
|
29
|
+
*/
|
|
30
|
+
export declare const paymentProofSchema: z.ZodObject<{
|
|
31
|
+
transactionId: z.ZodString;
|
|
32
|
+
buyerReportedUpiId: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
33
|
+
buyerMarkedPaid: z.ZodLiteral<true>;
|
|
34
|
+
buyerFraudAgreementAccepted: z.ZodLiteral<true>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
transactionId: string;
|
|
37
|
+
buyerMarkedPaid: true;
|
|
38
|
+
buyerFraudAgreementAccepted: true;
|
|
39
|
+
buyerReportedUpiId?: string | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
transactionId: string;
|
|
42
|
+
buyerMarkedPaid: true;
|
|
43
|
+
buyerFraudAgreementAccepted: true;
|
|
44
|
+
buyerReportedUpiId?: string | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export type PaymentProofValues = z.infer<typeof paymentProofSchema>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WHY: Two buyer-facing order forms rendered `<Form>` with no schema.
|
|
3
|
+
*
|
|
4
|
+
* The manual-payment one is the consequential case. It carries the
|
|
5
|
+
* buyer's own claim that they have paid — a UTR, the UPI ID they sent to,
|
|
6
|
+
* and a fraud declaration — and an admin decides on that evidence whether
|
|
7
|
+
* to release goods. `transactionId` was free text with no floor, so a
|
|
8
|
+
* single character satisfied it and reached the review queue looking like
|
|
9
|
+
* a reference.
|
|
10
|
+
*
|
|
11
|
+
* WHAT: The two schemas, plus a shared `cancellationReason`.
|
|
12
|
+
*
|
|
13
|
+
* EXPORTS:
|
|
14
|
+
* orderCancelSchema, paymentProofSchema, and their inferred value types
|
|
15
|
+
*
|
|
16
|
+
* @tag domain:orders
|
|
17
|
+
* @tag layer:schema
|
|
18
|
+
* @tag pattern:none
|
|
19
|
+
* @tag access:isomorphic
|
|
20
|
+
* @tag consumers:user/orders/[id]/cancel,user/orders/[id]/payment
|
|
21
|
+
* @tag sideEffects:none
|
|
22
|
+
*/
|
|
23
|
+
import { z } from "zod";
|
|
24
|
+
import { annotate } from "../../shell/field-ui-meta";
|
|
25
|
+
/**
|
|
26
|
+
* Cancelling an order.
|
|
27
|
+
*
|
|
28
|
+
* A reason floor of 5 characters, because this text is what the seller reads
|
|
29
|
+
* to decide whether to restock, refund early or dispute — and "x" tells them
|
|
30
|
+
* nothing. Deliberately low: the buyer is cancelling, not writing an essay,
|
|
31
|
+
* and a high floor would push them to type filler.
|
|
32
|
+
*/
|
|
33
|
+
export const orderCancelSchema = z.object({
|
|
34
|
+
reason: annotate(z
|
|
35
|
+
.string()
|
|
36
|
+
.trim()
|
|
37
|
+
.min(5, "Give a short reason — the seller sees this.")
|
|
38
|
+
.max(500, "Keep it under 500 characters."), {
|
|
39
|
+
section: "cancel",
|
|
40
|
+
sectionLabel: "Why are you cancelling?",
|
|
41
|
+
sectionRequired: true,
|
|
42
|
+
quick: true,
|
|
43
|
+
order: 1,
|
|
44
|
+
row: "full",
|
|
45
|
+
kind: "textarea",
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Uploading proof of a manual (cash / UPI / EMI) payment.
|
|
50
|
+
*
|
|
51
|
+
* ## Every field here is evidence
|
|
52
|
+
*
|
|
53
|
+
* An admin verifies or rejects on this, and a rejection carries a 7-day ban
|
|
54
|
+
* cascade — so the cost of a sloppy submission is real in both directions.
|
|
55
|
+
*
|
|
56
|
+
* `buyerMarkedPaid` and `buyerFraudAgreementAccepted` are `z.literal(true)`
|
|
57
|
+
* rather than `z.boolean()`: an unchecked declaration is not a submission with
|
|
58
|
+
* a `false` in it, it is a form that must not send.
|
|
59
|
+
*/
|
|
60
|
+
export const paymentProofSchema = z.object({
|
|
61
|
+
transactionId: annotate(z
|
|
62
|
+
.string()
|
|
63
|
+
.trim()
|
|
64
|
+
.min(4, "Enter the UTR or reference number from your payment app.")
|
|
65
|
+
.max(120, "Keep the reference under 120 characters."), { section: "proof", sectionLabel: "Your payment", sectionRequired: true, quick: true, order: 1, row: "pair" }),
|
|
66
|
+
/*
|
|
67
|
+
* The UPI ID the buyer actually sent to. Compared against the store's
|
|
68
|
+
* displayed one so a mismatch is flagged to the admin — which is why the
|
|
69
|
+
* shape matters, not just its presence.
|
|
70
|
+
*/
|
|
71
|
+
buyerReportedUpiId: annotate(z
|
|
72
|
+
.string()
|
|
73
|
+
.trim()
|
|
74
|
+
.regex(/^[\w.\-_]{2,256}@[a-zA-Z]{2,64}$/, "Enter the UPI ID you paid to, e.g. name@bank.")
|
|
75
|
+
.optional()
|
|
76
|
+
.or(z.literal("")), { section: "proof", order: 2, row: "pair" }),
|
|
77
|
+
buyerMarkedPaid: annotate(z.literal(true, { errorMap: () => ({ message: "Confirm that you have sent the payment." }) }), { section: "declare", sectionLabel: "Declaration", sectionRequired: true, order: 1, row: "full" }),
|
|
78
|
+
buyerFraudAgreementAccepted: annotate(z.literal(true, {
|
|
79
|
+
errorMap: () => ({ message: "You must accept the fraud policy to submit proof." }),
|
|
80
|
+
}), { section: "declare", order: 2, row: "full" }),
|
|
81
|
+
});
|