aivilife-contracts 5.0.0 → 5.2.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/README.md +35 -3
- package/dist/cart/index.d.mts +87 -0
- package/dist/cart/index.d.ts +87 -0
- package/dist/cart/index.js +77 -0
- package/dist/cart/index.js.map +1 -0
- package/dist/cart/index.mjs +70 -0
- package/dist/cart/index.mjs.map +1 -0
- package/dist/cart.enums-Q3FbqDWC.d.mts +7 -0
- package/dist/cart.enums-Q3FbqDWC.d.ts +7 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +378 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +344 -30
- package/dist/index.mjs.map +1 -1
- package/dist/order/index.d.mts +542 -0
- package/dist/order/index.d.ts +542 -0
- package/dist/order/index.js +720 -0
- package/dist/order/index.js.map +1 -0
- package/dist/order/index.mjs +690 -0
- package/dist/order/index.mjs.map +1 -0
- package/package.json +11 -1
package/dist/index.mjs
CHANGED
|
@@ -709,6 +709,123 @@ var LocalizedProductSchema = ProductSchema.omit({
|
|
|
709
709
|
categories: z.array(LocalizedProductCategorySchema)
|
|
710
710
|
});
|
|
711
711
|
|
|
712
|
+
// src/cart/cart.enums.ts
|
|
713
|
+
var CartItemAvailability = /* @__PURE__ */ ((CartItemAvailability2) => {
|
|
714
|
+
CartItemAvailability2["AVAILABLE"] = "AVAILABLE";
|
|
715
|
+
CartItemAvailability2["PRODUCT_UNAVAILABLE"] = "PRODUCT_UNAVAILABLE";
|
|
716
|
+
CartItemAvailability2["VARIANT_UNAVAILABLE"] = "VARIANT_UNAVAILABLE";
|
|
717
|
+
return CartItemAvailability2;
|
|
718
|
+
})(CartItemAvailability || {});
|
|
719
|
+
var PublicIdSchema2 = z.uuid();
|
|
720
|
+
var QuantitySchema = z.number().int().min(1).max(999);
|
|
721
|
+
var DecimalSchema = z.string().regex(/^\d{1,16}(?:\.\d{1,2})?$/);
|
|
722
|
+
var AddCartItemRequestSchema = z.object({
|
|
723
|
+
variantPublicId: PublicIdSchema2,
|
|
724
|
+
quantity: QuantitySchema.default(1)
|
|
725
|
+
});
|
|
726
|
+
var UpdateCartItemRequestSchema = z.object({
|
|
727
|
+
quantity: QuantitySchema,
|
|
728
|
+
version: z.number().int().positive()
|
|
729
|
+
});
|
|
730
|
+
var CartItemPublicIdParamSchema = z.object({
|
|
731
|
+
itemPublicId: PublicIdSchema2
|
|
732
|
+
});
|
|
733
|
+
var CartItemSchema = z.object({
|
|
734
|
+
publicId: PublicIdSchema2,
|
|
735
|
+
quantity: QuantitySchema,
|
|
736
|
+
version: z.number().int().positive(),
|
|
737
|
+
availability: z.enum(CartItemAvailability),
|
|
738
|
+
product: z.object({
|
|
739
|
+
publicId: PublicIdSchema2,
|
|
740
|
+
slug: z.string(),
|
|
741
|
+
name: z.string(),
|
|
742
|
+
coverContentUrl: z.string().nullable()
|
|
743
|
+
}),
|
|
744
|
+
variant: z.object({
|
|
745
|
+
publicId: PublicIdSchema2,
|
|
746
|
+
sku: z.string(),
|
|
747
|
+
quantity: z.string(),
|
|
748
|
+
unit: z.enum(ProductUnit),
|
|
749
|
+
priceUsd: DecimalSchema,
|
|
750
|
+
pv: DecimalSchema
|
|
751
|
+
}),
|
|
752
|
+
lineTotalUsd: DecimalSchema,
|
|
753
|
+
lineTotalPv: DecimalSchema,
|
|
754
|
+
createdAt: z.string().datetime(),
|
|
755
|
+
updatedAt: z.string().datetime()
|
|
756
|
+
});
|
|
757
|
+
var CartSchema = z.object({
|
|
758
|
+
publicId: PublicIdSchema2.nullable(),
|
|
759
|
+
items: z.array(CartItemSchema),
|
|
760
|
+
totalQuantity: z.number().int().nonnegative(),
|
|
761
|
+
subtotalUsd: DecimalSchema,
|
|
762
|
+
totalPv: DecimalSchema,
|
|
763
|
+
hasUnavailableItems: z.boolean(),
|
|
764
|
+
updatedAt: z.string().datetime().nullable()
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
// src/order/order.enums.ts
|
|
768
|
+
var OrderDeliveryMethod = /* @__PURE__ */ ((OrderDeliveryMethod2) => {
|
|
769
|
+
OrderDeliveryMethod2["PICKUP"] = "PICKUP";
|
|
770
|
+
return OrderDeliveryMethod2;
|
|
771
|
+
})(OrderDeliveryMethod || {});
|
|
772
|
+
var OrderPaymentMethod = /* @__PURE__ */ ((OrderPaymentMethod2) => {
|
|
773
|
+
OrderPaymentMethod2["CASH"] = "CASH";
|
|
774
|
+
OrderPaymentMethod2["MAIN_WALLET"] = "MAIN_WALLET";
|
|
775
|
+
return OrderPaymentMethod2;
|
|
776
|
+
})(OrderPaymentMethod || {});
|
|
777
|
+
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
778
|
+
OrderStatus2["PENDING_PAYMENT"] = "PENDING_PAYMENT";
|
|
779
|
+
OrderStatus2["PROCESSING"] = "PROCESSING";
|
|
780
|
+
OrderStatus2["READY_FOR_PICKUP"] = "READY_FOR_PICKUP";
|
|
781
|
+
OrderStatus2["COMPLETED"] = "COMPLETED";
|
|
782
|
+
OrderStatus2["CANCELLED"] = "CANCELLED";
|
|
783
|
+
return OrderStatus2;
|
|
784
|
+
})(OrderStatus || {});
|
|
785
|
+
var OrderPaymentStatus = /* @__PURE__ */ ((OrderPaymentStatus2) => {
|
|
786
|
+
OrderPaymentStatus2["AWAITING_RECEIPT"] = "AWAITING_RECEIPT";
|
|
787
|
+
OrderPaymentStatus2["UNDER_REVIEW"] = "UNDER_REVIEW";
|
|
788
|
+
OrderPaymentStatus2["REJECTED"] = "REJECTED";
|
|
789
|
+
OrderPaymentStatus2["PAID"] = "PAID";
|
|
790
|
+
OrderPaymentStatus2["CANCELLED"] = "CANCELLED";
|
|
791
|
+
return OrderPaymentStatus2;
|
|
792
|
+
})(OrderPaymentStatus || {});
|
|
793
|
+
var OrderReceiptStatus = /* @__PURE__ */ ((OrderReceiptStatus2) => {
|
|
794
|
+
OrderReceiptStatus2["UNDER_REVIEW"] = "UNDER_REVIEW";
|
|
795
|
+
OrderReceiptStatus2["APPROVED"] = "APPROVED";
|
|
796
|
+
OrderReceiptStatus2["REJECTED"] = "REJECTED";
|
|
797
|
+
return OrderReceiptStatus2;
|
|
798
|
+
})(OrderReceiptStatus || {});
|
|
799
|
+
var OrderReceiptDecision = /* @__PURE__ */ ((OrderReceiptDecision2) => {
|
|
800
|
+
OrderReceiptDecision2["APPROVE"] = "APPROVE";
|
|
801
|
+
OrderReceiptDecision2["REJECT"] = "REJECT";
|
|
802
|
+
return OrderReceiptDecision2;
|
|
803
|
+
})(OrderReceiptDecision || {});
|
|
804
|
+
var OrderStockAvailability = /* @__PURE__ */ ((OrderStockAvailability2) => {
|
|
805
|
+
OrderStockAvailability2["AVAILABLE"] = "AVAILABLE";
|
|
806
|
+
OrderStockAvailability2["OUT_OF_STOCK"] = "OUT_OF_STOCK";
|
|
807
|
+
OrderStockAvailability2["INSUFFICIENT_STOCK"] = "INSUFFICIENT_STOCK";
|
|
808
|
+
return OrderStockAvailability2;
|
|
809
|
+
})(OrderStockAvailability || {});
|
|
810
|
+
var OrderEventType = /* @__PURE__ */ ((OrderEventType2) => {
|
|
811
|
+
OrderEventType2["CREATED"] = "CREATED";
|
|
812
|
+
OrderEventType2["WALLET_DEBITED"] = "WALLET_DEBITED";
|
|
813
|
+
OrderEventType2["RECEIPT_UPLOADED"] = "RECEIPT_UPLOADED";
|
|
814
|
+
OrderEventType2["PAYMENT_APPROVED"] = "PAYMENT_APPROVED";
|
|
815
|
+
OrderEventType2["PAYMENT_REJECTED"] = "PAYMENT_REJECTED";
|
|
816
|
+
OrderEventType2["CANCELLED_TIMEOUT"] = "CANCELLED_TIMEOUT";
|
|
817
|
+
OrderEventType2["WALLET_REFUNDED"] = "WALLET_REFUNDED";
|
|
818
|
+
return OrderEventType2;
|
|
819
|
+
})(OrderEventType || {});
|
|
820
|
+
var OrderNotificationType = /* @__PURE__ */ ((OrderNotificationType2) => {
|
|
821
|
+
OrderNotificationType2["ORDER_CREATED"] = "ORDER_CREATED";
|
|
822
|
+
OrderNotificationType2["RECEIPT_RECEIVED"] = "RECEIPT_RECEIVED";
|
|
823
|
+
OrderNotificationType2["PAYMENT_APPROVED"] = "PAYMENT_APPROVED";
|
|
824
|
+
OrderNotificationType2["PAYMENT_REJECTED"] = "PAYMENT_REJECTED";
|
|
825
|
+
OrderNotificationType2["ORDER_CANCELLED"] = "ORDER_CANCELLED";
|
|
826
|
+
return OrderNotificationType2;
|
|
827
|
+
})(OrderNotificationType || {});
|
|
828
|
+
|
|
712
829
|
// src/warehouse/warehouse.enums.ts
|
|
713
830
|
var WarehouseStatus = {
|
|
714
831
|
DRAFT: "DRAFT",
|
|
@@ -760,7 +877,9 @@ var WarehouseWeekday = {
|
|
|
760
877
|
SATURDAY: "SATURDAY",
|
|
761
878
|
SUNDAY: "SUNDAY"
|
|
762
879
|
};
|
|
763
|
-
|
|
880
|
+
|
|
881
|
+
// src/warehouse/warehouse.schemas.ts
|
|
882
|
+
var PublicIdSchema3 = z.uuid();
|
|
764
883
|
var CodeSchema2 = z.string().trim().toUpperCase().regex(/^[A-Z0-9][A-Z0-9_-]{1,63}$/);
|
|
765
884
|
var DateSchema = z.iso.date();
|
|
766
885
|
var DateTimeSchema = z.iso.datetime();
|
|
@@ -814,11 +933,11 @@ var CreateWarehouseRequestSchema = WarehouseFieldsSchema.extend({
|
|
|
814
933
|
});
|
|
815
934
|
var UpdateWarehouseRequestSchema = WarehouseFieldsSchema.partial().extend({ version: z.number().int().positive() }).required({ version: true });
|
|
816
935
|
var WarehousePublicIdParamSchema = z.object({
|
|
817
|
-
publicId:
|
|
936
|
+
publicId: PublicIdSchema3
|
|
818
937
|
});
|
|
819
938
|
var WarehouseAssignmentParamSchema = z.object({
|
|
820
|
-
publicId:
|
|
821
|
-
assignmentPublicId:
|
|
939
|
+
publicId: PublicIdSchema3,
|
|
940
|
+
assignmentPublicId: PublicIdSchema3
|
|
822
941
|
});
|
|
823
942
|
var WarehouseListQuerySchema = BaseListQuerySchema.extend({
|
|
824
943
|
status: z.enum(WarehouseStatus).optional(),
|
|
@@ -835,7 +954,7 @@ var AssignWarehouseUserRequestSchema = z.object({
|
|
|
835
954
|
type: z.enum(WarehouseAssignmentType)
|
|
836
955
|
});
|
|
837
956
|
var WarehouseRequestLineInputSchema = z.object({
|
|
838
|
-
variantPublicId:
|
|
957
|
+
variantPublicId: PublicIdSchema3,
|
|
839
958
|
quantity: z.number().int().positive().max(1e9),
|
|
840
959
|
expiresAt: DateSchema.nullable().optional(),
|
|
841
960
|
batchNumber: NullableTrimmedSchema(120),
|
|
@@ -843,8 +962,8 @@ var WarehouseRequestLineInputSchema = z.object({
|
|
|
843
962
|
});
|
|
844
963
|
var CreateWarehouseOperationRequestSchema = z.object({
|
|
845
964
|
type: z.enum(WarehouseRequestType),
|
|
846
|
-
sourceWarehousePublicId:
|
|
847
|
-
destinationWarehousePublicId:
|
|
965
|
+
sourceWarehousePublicId: PublicIdSchema3.nullable().optional(),
|
|
966
|
+
destinationWarehousePublicId: PublicIdSchema3.nullable().optional(),
|
|
848
967
|
writeOffReason: z.enum(WarehouseWriteOffReason).nullable().optional(),
|
|
849
968
|
comment: z.string().trim().max(2e3).nullable().optional(),
|
|
850
969
|
lines: z.array(WarehouseRequestLineInputSchema).min(1).max(500)
|
|
@@ -903,16 +1022,16 @@ var CreateWarehouseOperationRequestSchema = z.object({
|
|
|
903
1022
|
}
|
|
904
1023
|
});
|
|
905
1024
|
var WarehouseOperationPublicIdParamSchema = z.object({
|
|
906
|
-
publicId:
|
|
1025
|
+
publicId: PublicIdSchema3
|
|
907
1026
|
});
|
|
908
1027
|
var WarehouseOperationAttachmentParamSchema = z.object({
|
|
909
|
-
publicId:
|
|
910
|
-
attachmentPublicId:
|
|
1028
|
+
publicId: PublicIdSchema3,
|
|
1029
|
+
attachmentPublicId: PublicIdSchema3
|
|
911
1030
|
});
|
|
912
1031
|
var WarehouseOperationListQuerySchema = BaseListQuerySchema.extend({
|
|
913
1032
|
type: z.enum(WarehouseRequestType).optional(),
|
|
914
1033
|
status: z.enum(WarehouseRequestStatus).optional(),
|
|
915
|
-
warehousePublicId:
|
|
1034
|
+
warehousePublicId: PublicIdSchema3.optional(),
|
|
916
1035
|
createdByUserId: z.coerce.number().int().positive().optional()
|
|
917
1036
|
});
|
|
918
1037
|
var WarehouseOperationCommentSchema = z.object({
|
|
@@ -929,13 +1048,13 @@ var ReportWarehouseDiscrepancyRequestSchema = z.object({
|
|
|
929
1048
|
comment: z.string().trim().min(1).max(2e3)
|
|
930
1049
|
});
|
|
931
1050
|
var WarehouseStockListQuerySchema = BaseListQuerySchema.extend({
|
|
932
|
-
warehousePublicId:
|
|
933
|
-
variantPublicId:
|
|
1051
|
+
warehousePublicId: PublicIdSchema3.optional(),
|
|
1052
|
+
variantPublicId: PublicIdSchema3.optional(),
|
|
934
1053
|
expired: z.union([z.boolean(), z.enum(["true", "false"]).transform((v) => v === "true")]).optional(),
|
|
935
1054
|
expiresBefore: DateSchema.optional()
|
|
936
1055
|
});
|
|
937
1056
|
var WarehouseSchema = z.object({
|
|
938
|
-
publicId:
|
|
1057
|
+
publicId: PublicIdSchema3,
|
|
939
1058
|
code: CodeSchema2,
|
|
940
1059
|
name: z.string(),
|
|
941
1060
|
status: z.enum(WarehouseStatus),
|
|
@@ -962,16 +1081,16 @@ var WarehouseUserLookupSchema = z.object({
|
|
|
962
1081
|
role: z.string()
|
|
963
1082
|
});
|
|
964
1083
|
var WarehouseAssignmentSchema = z.object({
|
|
965
|
-
publicId:
|
|
966
|
-
warehousePublicId:
|
|
1084
|
+
publicId: PublicIdSchema3,
|
|
1085
|
+
warehousePublicId: PublicIdSchema3,
|
|
967
1086
|
type: z.enum(WarehouseAssignmentType),
|
|
968
1087
|
user: WarehouseUserLookupSchema,
|
|
969
1088
|
assignedByLogin: z.string(),
|
|
970
1089
|
assignedAt: DateTimeSchema
|
|
971
1090
|
});
|
|
972
1091
|
var WarehouseOperationLineSchema = z.object({
|
|
973
|
-
publicId:
|
|
974
|
-
variantPublicId:
|
|
1092
|
+
publicId: PublicIdSchema3,
|
|
1093
|
+
variantPublicId: PublicIdSchema3,
|
|
975
1094
|
sku: z.string(),
|
|
976
1095
|
quantity: z.number().int().positive(),
|
|
977
1096
|
expiresAt: DateSchema.nullable(),
|
|
@@ -979,7 +1098,7 @@ var WarehouseOperationLineSchema = z.object({
|
|
|
979
1098
|
comment: z.string().nullable()
|
|
980
1099
|
});
|
|
981
1100
|
var WarehouseOperationEventSchema = z.object({
|
|
982
|
-
publicId:
|
|
1101
|
+
publicId: PublicIdSchema3,
|
|
983
1102
|
fromStatus: z.enum(WarehouseRequestStatus).nullable(),
|
|
984
1103
|
toStatus: z.enum(WarehouseRequestStatus),
|
|
985
1104
|
actorUserId: z.number().int().positive(),
|
|
@@ -988,7 +1107,7 @@ var WarehouseOperationEventSchema = z.object({
|
|
|
988
1107
|
createdAt: DateTimeSchema
|
|
989
1108
|
});
|
|
990
1109
|
var WarehouseOperationAttachmentSchema = z.object({
|
|
991
|
-
publicId:
|
|
1110
|
+
publicId: PublicIdSchema3,
|
|
992
1111
|
mimeType: z.string(),
|
|
993
1112
|
sizeBytes: z.number().int().positive(),
|
|
994
1113
|
originalName: z.string().nullable(),
|
|
@@ -997,7 +1116,7 @@ var WarehouseOperationAttachmentSchema = z.object({
|
|
|
997
1116
|
createdAt: DateTimeSchema
|
|
998
1117
|
});
|
|
999
1118
|
var WarehouseOperationSchema = z.object({
|
|
1000
|
-
publicId:
|
|
1119
|
+
publicId: PublicIdSchema3,
|
|
1001
1120
|
type: z.enum(WarehouseRequestType),
|
|
1002
1121
|
status: z.enum(WarehouseRequestStatus),
|
|
1003
1122
|
sourceWarehouse: WarehouseSchema.nullable(),
|
|
@@ -1021,11 +1140,11 @@ var WarehouseOperationSchema = z.object({
|
|
|
1021
1140
|
updatedAt: DateTimeSchema
|
|
1022
1141
|
});
|
|
1023
1142
|
var WarehouseStockSchema = z.object({
|
|
1024
|
-
publicId:
|
|
1143
|
+
publicId: PublicIdSchema3,
|
|
1025
1144
|
warehouse: WarehouseSchema,
|
|
1026
|
-
variantPublicId:
|
|
1145
|
+
variantPublicId: PublicIdSchema3,
|
|
1027
1146
|
sku: z.string(),
|
|
1028
|
-
productPublicId:
|
|
1147
|
+
productPublicId: PublicIdSchema3,
|
|
1029
1148
|
productCode: z.string(),
|
|
1030
1149
|
batchNumber: z.string().nullable(),
|
|
1031
1150
|
expiresAt: DateSchema,
|
|
@@ -1037,11 +1156,11 @@ var WarehouseStockSchema = z.object({
|
|
|
1037
1156
|
updatedAt: DateTimeSchema
|
|
1038
1157
|
});
|
|
1039
1158
|
var WarehouseMovementSchema = z.object({
|
|
1040
|
-
publicId:
|
|
1041
|
-
warehousePublicId:
|
|
1042
|
-
operationPublicId:
|
|
1043
|
-
variantPublicId:
|
|
1044
|
-
inventoryBatchPublicId:
|
|
1159
|
+
publicId: PublicIdSchema3,
|
|
1160
|
+
warehousePublicId: PublicIdSchema3,
|
|
1161
|
+
operationPublicId: PublicIdSchema3,
|
|
1162
|
+
variantPublicId: PublicIdSchema3,
|
|
1163
|
+
inventoryBatchPublicId: PublicIdSchema3.nullable(),
|
|
1045
1164
|
type: z.enum(WarehouseMovementType),
|
|
1046
1165
|
quantityDelta: z.number().int(),
|
|
1047
1166
|
balanceAfter: z.number().int().nonnegative(),
|
|
@@ -1050,6 +1169,201 @@ var WarehouseMovementSchema = z.object({
|
|
|
1050
1169
|
createdAt: DateTimeSchema
|
|
1051
1170
|
});
|
|
1052
1171
|
|
|
1053
|
-
|
|
1172
|
+
// src/order/order.schemas.ts
|
|
1173
|
+
var PublicIdSchema4 = z.uuid();
|
|
1174
|
+
var DateTimeSchema2 = z.iso.datetime();
|
|
1175
|
+
var MoneySchema2 = z.string().regex(/^\d{1,16}\.\d{2}$/);
|
|
1176
|
+
var DecimalSchema2 = z.string().regex(/^\d{1,16}(?:\.\d{1,3})?$/);
|
|
1177
|
+
var OrderNumberSchema = z.string().regex(/^AV-\d{8}-[A-Z0-9]{6}$/);
|
|
1178
|
+
var CheckoutWarehouseQuerySchema = z.object({
|
|
1179
|
+
countryCode: z.string().trim().toUpperCase().length(2),
|
|
1180
|
+
city: z.string().trim().min(1).max(160)
|
|
1181
|
+
});
|
|
1182
|
+
var CheckoutLocationSchema = z.object({
|
|
1183
|
+
countryCode: z.string().length(2),
|
|
1184
|
+
country: z.string(),
|
|
1185
|
+
cities: z.array(z.string()).min(1)
|
|
1186
|
+
});
|
|
1187
|
+
var CheckoutSnapshotSchema = z.object({
|
|
1188
|
+
cart: CartSchema,
|
|
1189
|
+
locations: z.array(CheckoutLocationSchema),
|
|
1190
|
+
mainWallet: z.object({
|
|
1191
|
+
balanceUsd: MoneySchema2,
|
|
1192
|
+
availableBalanceUsd: MoneySchema2
|
|
1193
|
+
}),
|
|
1194
|
+
paymentMethods: z.array(z.enum(OrderPaymentMethod)),
|
|
1195
|
+
reserveDurationHours: z.literal(24)
|
|
1196
|
+
});
|
|
1197
|
+
var CheckoutWarehouseAvailabilitySchema = z.object({
|
|
1198
|
+
variantPublicId: PublicIdSchema4,
|
|
1199
|
+
requestedQuantity: z.number().int().positive(),
|
|
1200
|
+
availableQuantity: z.number().int().nonnegative(),
|
|
1201
|
+
availability: z.enum(OrderStockAvailability)
|
|
1202
|
+
});
|
|
1203
|
+
var CheckoutWarehouseSchema = z.object({
|
|
1204
|
+
publicId: PublicIdSchema4,
|
|
1205
|
+
code: z.string(),
|
|
1206
|
+
name: z.string(),
|
|
1207
|
+
countryCode: z.string().length(2),
|
|
1208
|
+
country: z.string(),
|
|
1209
|
+
city: z.string(),
|
|
1210
|
+
address: z.string(),
|
|
1211
|
+
phoneNumber: z.string(),
|
|
1212
|
+
mapUrl: z.url(),
|
|
1213
|
+
timezone: z.string(),
|
|
1214
|
+
schedule: WarehouseWeeklyScheduleSchema,
|
|
1215
|
+
canFulfill: z.boolean(),
|
|
1216
|
+
items: z.array(CheckoutWarehouseAvailabilitySchema)
|
|
1217
|
+
});
|
|
1218
|
+
var CheckoutWarehouseListSchema = z.array(CheckoutWarehouseSchema);
|
|
1219
|
+
var CreateOrderRequestSchema = z.object({
|
|
1220
|
+
warehousePublicId: PublicIdSchema4,
|
|
1221
|
+
deliveryMethod: z.literal("PICKUP" /* PICKUP */),
|
|
1222
|
+
paymentMethod: z.enum(OrderPaymentMethod),
|
|
1223
|
+
walletAmountUsd: MoneySchema2.optional(),
|
|
1224
|
+
idempotencyKey: PublicIdSchema4
|
|
1225
|
+
}).superRefine((value, context) => {
|
|
1226
|
+
if (value.paymentMethod === "CASH" /* CASH */ && value.walletAmountUsd) {
|
|
1227
|
+
context.addIssue({
|
|
1228
|
+
code: "custom",
|
|
1229
|
+
path: ["walletAmountUsd"],
|
|
1230
|
+
message: "\u0414\u043B\u044F \u043E\u043F\u043B\u0430\u0442\u044B \u043D\u0430\u043B\u0438\u0447\u043D\u044B\u043C\u0438 \u0441\u0443\u043C\u043C\u0430 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430 \u043D\u0435 \u043F\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044F"
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
if (value.paymentMethod === "MAIN_WALLET" /* MAIN_WALLET */ && (!value.walletAmountUsd || value.walletAmountUsd === "0.00")) {
|
|
1234
|
+
context.addIssue({
|
|
1235
|
+
code: "custom",
|
|
1236
|
+
path: ["walletAmountUsd"],
|
|
1237
|
+
message: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0441\u0443\u043C\u043C\u0443 \u043E\u043F\u043B\u0430\u0442\u044B \u0441 \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0433\u043E \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430"
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
var OrderPublicIdParamSchema = z.object({ publicId: PublicIdSchema4 });
|
|
1242
|
+
var OrderReceiptParamSchema = z.object({
|
|
1243
|
+
publicId: PublicIdSchema4,
|
|
1244
|
+
receiptPublicId: PublicIdSchema4
|
|
1245
|
+
});
|
|
1246
|
+
var OrderWarehouseSchema = z.object({
|
|
1247
|
+
publicId: PublicIdSchema4,
|
|
1248
|
+
code: z.string(),
|
|
1249
|
+
name: z.string(),
|
|
1250
|
+
countryCode: z.string().length(2),
|
|
1251
|
+
country: z.string(),
|
|
1252
|
+
city: z.string(),
|
|
1253
|
+
address: z.string(),
|
|
1254
|
+
phoneNumber: z.string(),
|
|
1255
|
+
mapUrl: z.url(),
|
|
1256
|
+
timezone: z.string(),
|
|
1257
|
+
schedule: WarehouseWeeklyScheduleSchema
|
|
1258
|
+
});
|
|
1259
|
+
var OrderItemSchema = z.object({
|
|
1260
|
+
publicId: PublicIdSchema4,
|
|
1261
|
+
productPublicId: PublicIdSchema4,
|
|
1262
|
+
variantPublicId: PublicIdSchema4,
|
|
1263
|
+
productName: z.string(),
|
|
1264
|
+
sku: z.string(),
|
|
1265
|
+
variantQuantity: DecimalSchema2,
|
|
1266
|
+
unit: z.enum(ProductUnit),
|
|
1267
|
+
quantity: z.number().int().positive(),
|
|
1268
|
+
unitPriceUsd: MoneySchema2,
|
|
1269
|
+
lineTotalUsd: MoneySchema2,
|
|
1270
|
+
unitPv: MoneySchema2,
|
|
1271
|
+
lineTotalPv: MoneySchema2,
|
|
1272
|
+
coverContentUrl: z.string().nullable()
|
|
1273
|
+
});
|
|
1274
|
+
var OrderReceiptSchema = z.object({
|
|
1275
|
+
publicId: PublicIdSchema4,
|
|
1276
|
+
status: z.enum(OrderReceiptStatus),
|
|
1277
|
+
originalName: z.string().nullable(),
|
|
1278
|
+
mimeType: z.string(),
|
|
1279
|
+
sizeBytes: z.number().int().positive(),
|
|
1280
|
+
version: z.number().int().positive(),
|
|
1281
|
+
rejectionReason: z.string().nullable(),
|
|
1282
|
+
reviewedAt: DateTimeSchema2.nullable(),
|
|
1283
|
+
createdAt: DateTimeSchema2,
|
|
1284
|
+
contentUrl: z.string()
|
|
1285
|
+
});
|
|
1286
|
+
var OrderEventSchema = z.object({
|
|
1287
|
+
publicId: PublicIdSchema4,
|
|
1288
|
+
type: z.enum(OrderEventType),
|
|
1289
|
+
actorLogin: z.string().nullable(),
|
|
1290
|
+
comment: z.string().nullable(),
|
|
1291
|
+
createdAt: DateTimeSchema2
|
|
1292
|
+
});
|
|
1293
|
+
var OrderSchema = z.object({
|
|
1294
|
+
publicId: PublicIdSchema4,
|
|
1295
|
+
number: OrderNumberSchema,
|
|
1296
|
+
status: z.enum(OrderStatus),
|
|
1297
|
+
paymentStatus: z.enum(OrderPaymentStatus),
|
|
1298
|
+
deliveryMethod: z.enum(OrderDeliveryMethod),
|
|
1299
|
+
paymentMethod: z.enum(OrderPaymentMethod),
|
|
1300
|
+
locale: z.string().length(2),
|
|
1301
|
+
baseCurrencyCode: z.string().length(3),
|
|
1302
|
+
displayCurrencyCode: z.string().length(3),
|
|
1303
|
+
displayRate: z.string(),
|
|
1304
|
+
subtotalUsd: MoneySchema2,
|
|
1305
|
+
totalPv: MoneySchema2,
|
|
1306
|
+
walletPaidUsd: MoneySchema2,
|
|
1307
|
+
walletRefundedUsd: MoneySchema2,
|
|
1308
|
+
cashDueUsd: MoneySchema2,
|
|
1309
|
+
reserveExpiresAt: DateTimeSchema2.nullable(),
|
|
1310
|
+
paidAt: DateTimeSchema2.nullable(),
|
|
1311
|
+
cancelledAt: DateTimeSchema2.nullable(),
|
|
1312
|
+
cancellationReason: z.string().nullable(),
|
|
1313
|
+
warehouse: OrderWarehouseSchema,
|
|
1314
|
+
items: z.array(OrderItemSchema).min(1),
|
|
1315
|
+
receipts: z.array(OrderReceiptSchema),
|
|
1316
|
+
events: z.array(OrderEventSchema),
|
|
1317
|
+
createdAt: DateTimeSchema2,
|
|
1318
|
+
updatedAt: DateTimeSchema2
|
|
1319
|
+
});
|
|
1320
|
+
var OrderListItemSchema = OrderSchema.omit({
|
|
1321
|
+
receipts: true,
|
|
1322
|
+
events: true
|
|
1323
|
+
});
|
|
1324
|
+
var OrderListQuerySchema = BaseListQuerySchema.extend({
|
|
1325
|
+
status: z.enum(OrderStatus).optional(),
|
|
1326
|
+
paymentStatus: z.enum(OrderPaymentStatus).optional()
|
|
1327
|
+
});
|
|
1328
|
+
var OrderListResponseSchema = z.object({
|
|
1329
|
+
items: z.array(OrderListItemSchema),
|
|
1330
|
+
meta: z.object({
|
|
1331
|
+
page: z.number().int().positive(),
|
|
1332
|
+
limit: z.number().int().positive(),
|
|
1333
|
+
total: z.number().int().nonnegative(),
|
|
1334
|
+
pageCount: z.number().int().nonnegative()
|
|
1335
|
+
})
|
|
1336
|
+
});
|
|
1337
|
+
var ReviewOrderReceiptRequestSchema = z.object({
|
|
1338
|
+
decision: z.enum(OrderReceiptDecision),
|
|
1339
|
+
version: z.number().int().positive(),
|
|
1340
|
+
rejectionReason: z.string().trim().min(1).max(2e3).optional()
|
|
1341
|
+
}).superRefine((value, context) => {
|
|
1342
|
+
if (value.decision === "REJECT" /* REJECT */ && !value.rejectionReason) {
|
|
1343
|
+
context.addIssue({
|
|
1344
|
+
code: "custom",
|
|
1345
|
+
path: ["rejectionReason"],
|
|
1346
|
+
message: "\u041F\u0440\u0438\u0447\u0438\u043D\u0430 \u043E\u0442\u043A\u043B\u043E\u043D\u0435\u043D\u0438\u044F \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u0430"
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
if (value.decision === "APPROVE" /* APPROVE */ && value.rejectionReason) {
|
|
1350
|
+
context.addIssue({
|
|
1351
|
+
code: "custom",
|
|
1352
|
+
path: ["rejectionReason"],
|
|
1353
|
+
message: "\u041F\u0440\u0438\u0447\u0438\u043D\u0430 \u043D\u0435 \u043F\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044F \u043F\u0440\u0438 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0438"
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
var OrderNotificationSchema = z.object({
|
|
1358
|
+
publicId: PublicIdSchema4,
|
|
1359
|
+
orderPublicId: PublicIdSchema4,
|
|
1360
|
+
orderNumber: OrderNumberSchema,
|
|
1361
|
+
type: z.enum(OrderNotificationType),
|
|
1362
|
+
isRead: z.boolean(),
|
|
1363
|
+
createdAt: DateTimeSchema2
|
|
1364
|
+
});
|
|
1365
|
+
var OrderNotificationListSchema = z.array(OrderNotificationSchema);
|
|
1366
|
+
|
|
1367
|
+
export { AddCartItemRequestSchema, AppLocale, AppLocaleSchema, AssignWarehouseUserRequestSchema, AuthUserSchema, BaseListQuerySchema, BinaryBranch, BinaryBranchSchema, CartItemAvailability, CartItemPublicIdParamSchema, CartItemSchema, CartSchema, ChangePasswordRequestSchema, CheckoutLocationSchema, CheckoutSnapshotSchema, CheckoutWarehouseAvailabilitySchema, CheckoutWarehouseListSchema, CheckoutWarehouseQuerySchema, CheckoutWarehouseSchema, CitiesResponseSchema, CityResponseSchema, ConfirmEmailChangeSchema, ConfirmEmailSchema, CountriesResponseSchema, CountryResponseSchema, CreateCurrencyRequestSchema, CreateExternalProductVideoRequestSchema, CreateMarketingInvitationRequestSchema, CreateMarketingInvitationResponseSchema, CreateOrderRequestSchema, CreateProductCategoryRequestSchema, CreateProductRequestSchema, CreateProductVariantRequestSchema, CreateUserRequestSchema, CreateWalletTransactionRequestSchema, CreateWarehouseOperationRequestSchema, CreateWarehouseRequestSchema, CurrencyCodeParamSchema, CurrencyCodeSchema, CurrencyListResponseSchema, CurrencySchema, DateFromSchema, DateToSchema, DbIdSchema, ExchangeRateListResponseSchema, ExchangeRateSchema, ExchangeRateSourceSchema, ExecuteWarehouseOperationRequestSchema, FileIdParamSchema, ForgotPasswordSchema, GetCitiesQuerySchema, GetUserWalletByTypeParamsSchema, GetUserWalletTransactionsParamsSchema, GetUserWalletsParamsSchema, INT4_MAX, InvitationMarketingPlacementSchema, LimitSchema, LocalizedProductCategorySchema, LocalizedProductSchema, ManualMarketingPlacementSchema, MarketingInvitationTokenSchema, MarketingMemberStatus, MarketingMemberStatusSchema, MarketingPlacementIdentitySchema, MarketingPlacementPreviewSchema, MarketingPublicIdentifierSchema, MoneyAmountSchema, MoneyAmountStringSchema, MoneyViewSchema, OrderDeliveryMethod, OrderEventSchema, OrderEventType, OrderItemSchema, OrderListItemSchema, OrderListQuerySchema, OrderListResponseSchema, OrderNotificationListSchema, OrderNotificationSchema, OrderNotificationType, OrderPaymentMethod, OrderPaymentStatus, OrderPublicIdParamSchema, OrderReceiptDecision, OrderReceiptParamSchema, OrderReceiptSchema, OrderReceiptStatus, OrderSchema, OrderStatus, OrderStockAvailability, OrderWarehouseSchema, PageSchema, PaginationQuerySchema, ProductCategorySchema, ProductCategoryTranslationInputSchema, ProductListQuerySchema, ProductMediaPublicIdParamSchema, ProductMediaRole, ProductMediaSchema, ProductMediaType, ProductPublicIdParamSchema, ProductSchema, ProductSlugParamSchema, ProductStatus, ProductTranslationInputSchema, ProductUnit, ProductVariantInputSchema, ProductVariantPublicIdParamSchema, ProductVariantSchema, RatePerBaseSchema, RefreshResponseSchema, RegistrationAvailabilityRequestSchema, RegistrationAvailabilityResponseSchema, RegistrationEmailSchema, RegistrationLoginSchema, RegistrationPasswordSchema, RegistrationPhoneNumberSchema, RejectWarehouseOperationRequestSchema, ReportWarehouseDiscrepancyRequestSchema, RequestEmailChangeSchema, RequestEmailVerificationSchema, ResetPasswordSchema, ReviewOrderReceiptRequestSchema, SearchSchema, SignInRequestSchema, SignInResponseSchema, SignUpRequestSchema, SortOrderSchema, SupportedLocales, UpdateCartItemRequestSchema, UpdateCurrencyRequestSchema, UpdateExchangeRateRequestSchema, UpdateProductCategoryRequestSchema, UpdateProductMediaRequestSchema, UpdateProductRequestSchema, UpdateProductVariantRequestSchema, UpdateUserRequestSchema, UpdateWarehouseRequestSchema, UploadProductImageRequestSchema, UploadProductVideoRequestSchema, UserFileListSchema, UserFileSchema, UserFileType, UserListResponseSchema, UserRole, UserSchema, WalletCurrency, WalletCurrencySchema, WalletListResponseSchema, WalletOperationKeySchema, WalletSchema, WalletStatus, WalletStatusSchema, WalletTransactionDetailsListResponseSchema, WalletTransactionDetailsSchema, WalletTransactionDirection, WalletTransactionDirectionSchema, WalletTransactionListResponseSchema, WalletTransactionReason, WalletTransactionReasonSchema, WalletTransactionSchema, WalletTransactionSourceUserSchema, WalletTransactionStatus, WalletTransactionStatusSchema, WalletTransactionsListQuerySchema, WalletType, WalletTypeSchema, WarehouseAssignmentParamSchema, WarehouseAssignmentSchema, WarehouseAssignmentType, WarehouseDayScheduleSchema, WarehouseListQuerySchema, WarehouseMovementSchema, WarehouseMovementType, WarehouseOperationAttachmentParamSchema, WarehouseOperationAttachmentSchema, WarehouseOperationCommentSchema, WarehouseOperationEventSchema, WarehouseOperationLineSchema, WarehouseOperationListQuerySchema, WarehouseOperationPublicIdParamSchema, WarehouseOperationSchema, WarehousePublicIdParamSchema, WarehouseRequestLineInputSchema, WarehouseRequestStatus, WarehouseRequestType, WarehouseSchema, WarehouseStatus, WarehouseStockListQuerySchema, WarehouseStockSchema, WarehouseUserLookupSchema, WarehouseUserSearchQuerySchema, WarehouseWeekday, WarehouseWeeklyScheduleSchema, WarehouseWriteOffReason };
|
|
1054
1368
|
//# sourceMappingURL=index.mjs.map
|
|
1055
1369
|
//# sourceMappingURL=index.mjs.map
|