@jsdev_ninja/core 0.13.15 → 0.13.17

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.
@@ -0,0 +1,95 @@
1
+ import { z } from "zod";
2
+ export declare const InvoiceSchema: z.ZodObject<{
3
+ doc_uuid: z.ZodString;
4
+ pdf_link: z.ZodString;
5
+ pdf_link_copy: z.ZodString;
6
+ doc_number: z.ZodString;
7
+ sent_mails: z.ZodArray<z.ZodString, "many">;
8
+ success: z.ZodBoolean;
9
+ ua_uuid: z.ZodString;
10
+ calculatedData: z.ZodObject<{
11
+ _COMMENT: z.ZodOptional<z.ZodString>;
12
+ transaction_id: z.ZodString;
13
+ date: z.ZodString;
14
+ currency: z.ZodString;
15
+ rate: z.ZodNumber;
16
+ vat: z.ZodString;
17
+ vat_price: z.ZodNumber;
18
+ price_discount: z.ZodNumber;
19
+ price_discount_in_currency: z.ZodNumber;
20
+ price_total: z.ZodString;
21
+ price_total_in_currency: z.ZodNumber;
22
+ }, "strip", z.ZodTypeAny, {
23
+ date: string;
24
+ vat: string;
25
+ currency: string;
26
+ transaction_id: string;
27
+ rate: number;
28
+ vat_price: number;
29
+ price_discount: number;
30
+ price_discount_in_currency: number;
31
+ price_total: string;
32
+ price_total_in_currency: number;
33
+ _COMMENT?: string | undefined;
34
+ }, {
35
+ date: string;
36
+ vat: string;
37
+ currency: string;
38
+ transaction_id: string;
39
+ rate: number;
40
+ vat_price: number;
41
+ price_discount: number;
42
+ price_discount_in_currency: number;
43
+ price_total: string;
44
+ price_total_in_currency: number;
45
+ _COMMENT?: string | undefined;
46
+ }>;
47
+ warning: z.ZodOptional<z.ZodString>;
48
+ }, "strip", z.ZodTypeAny, {
49
+ doc_uuid: string;
50
+ pdf_link: string;
51
+ pdf_link_copy: string;
52
+ doc_number: string;
53
+ sent_mails: string[];
54
+ success: boolean;
55
+ ua_uuid: string;
56
+ calculatedData: {
57
+ date: string;
58
+ vat: string;
59
+ currency: string;
60
+ transaction_id: string;
61
+ rate: number;
62
+ vat_price: number;
63
+ price_discount: number;
64
+ price_discount_in_currency: number;
65
+ price_total: string;
66
+ price_total_in_currency: number;
67
+ _COMMENT?: string | undefined;
68
+ };
69
+ warning?: string | undefined;
70
+ }, {
71
+ doc_uuid: string;
72
+ pdf_link: string;
73
+ pdf_link_copy: string;
74
+ doc_number: string;
75
+ sent_mails: string[];
76
+ success: boolean;
77
+ ua_uuid: string;
78
+ calculatedData: {
79
+ date: string;
80
+ vat: string;
81
+ currency: string;
82
+ transaction_id: string;
83
+ rate: number;
84
+ vat_price: number;
85
+ price_discount: number;
86
+ price_discount_in_currency: number;
87
+ price_total: string;
88
+ price_total_in_currency: number;
89
+ _COMMENT?: string | undefined;
90
+ };
91
+ warning?: string | undefined;
92
+ }>;
93
+ export type TInvoice = z.infer<typeof InvoiceSchema>;
94
+ export declare function isInvoice(data: unknown): data is TInvoice;
95
+ //# sourceMappingURL=Invoice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Invoice.d.ts","sourceRoot":"","sources":["../../lib/entities/Invoice.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUxB,CAAC;AAGH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAGrD,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,QAAQ,CAEzD"}
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { CalculatedDataSchema } from "./DeliveryNote";
3
+ // Main Invoice schema
4
+ export const InvoiceSchema = z.object({
5
+ doc_uuid: z.string().uuid("Document UUID must be a valid UUID"),
6
+ pdf_link: z.string().url("PDF link must be a valid URL"),
7
+ pdf_link_copy: z.string().url("PDF copy link must be a valid URL"),
8
+ doc_number: z.string().min(1, "Document number is required"),
9
+ sent_mails: z.array(z.string().email("Each email must be valid")),
10
+ success: z.boolean(),
11
+ ua_uuid: z.string().uuid("UA UUID must be a valid UUID"),
12
+ calculatedData: CalculatedDataSchema,
13
+ warning: z.string().optional(),
14
+ });
15
+ // Validation functions
16
+ export function isInvoice(data) {
17
+ return InvoiceSchema.safeParse(data).success;
18
+ }
@@ -843,6 +843,202 @@ export declare const OrderSchema: z.ZodObject<{
843
843
  }>;
844
844
  nameOnInvoice: z.ZodOptional<z.ZodString>;
845
845
  clientComment: z.ZodOptional<z.ZodString>;
846
+ deliveryNote: z.ZodOptional<z.ZodObject<{
847
+ doc_uuid: z.ZodString;
848
+ pdf_link: z.ZodString;
849
+ pdf_link_copy: z.ZodString;
850
+ doc_number: z.ZodString;
851
+ sent_mails: z.ZodArray<z.ZodString, "many">;
852
+ success: z.ZodBoolean;
853
+ ua_uuid: z.ZodString;
854
+ calculatedData: z.ZodObject<{
855
+ _COMMENT: z.ZodOptional<z.ZodString>;
856
+ transaction_id: z.ZodString;
857
+ date: z.ZodString;
858
+ currency: z.ZodString;
859
+ rate: z.ZodNumber;
860
+ vat: z.ZodString;
861
+ vat_price: z.ZodNumber;
862
+ price_discount: z.ZodNumber;
863
+ price_discount_in_currency: z.ZodNumber;
864
+ price_total: z.ZodString;
865
+ price_total_in_currency: z.ZodNumber;
866
+ }, "strip", z.ZodTypeAny, {
867
+ date: string;
868
+ vat: string;
869
+ currency: string;
870
+ transaction_id: string;
871
+ rate: number;
872
+ vat_price: number;
873
+ price_discount: number;
874
+ price_discount_in_currency: number;
875
+ price_total: string;
876
+ price_total_in_currency: number;
877
+ _COMMENT?: string | undefined;
878
+ }, {
879
+ date: string;
880
+ vat: string;
881
+ currency: string;
882
+ transaction_id: string;
883
+ rate: number;
884
+ vat_price: number;
885
+ price_discount: number;
886
+ price_discount_in_currency: number;
887
+ price_total: string;
888
+ price_total_in_currency: number;
889
+ _COMMENT?: string | undefined;
890
+ }>;
891
+ warning: z.ZodOptional<z.ZodString>;
892
+ }, "strip", z.ZodTypeAny, {
893
+ doc_uuid: string;
894
+ pdf_link: string;
895
+ pdf_link_copy: string;
896
+ doc_number: string;
897
+ sent_mails: string[];
898
+ success: boolean;
899
+ ua_uuid: string;
900
+ calculatedData: {
901
+ date: string;
902
+ vat: string;
903
+ currency: string;
904
+ transaction_id: string;
905
+ rate: number;
906
+ vat_price: number;
907
+ price_discount: number;
908
+ price_discount_in_currency: number;
909
+ price_total: string;
910
+ price_total_in_currency: number;
911
+ _COMMENT?: string | undefined;
912
+ };
913
+ warning?: string | undefined;
914
+ }, {
915
+ doc_uuid: string;
916
+ pdf_link: string;
917
+ pdf_link_copy: string;
918
+ doc_number: string;
919
+ sent_mails: string[];
920
+ success: boolean;
921
+ ua_uuid: string;
922
+ calculatedData: {
923
+ date: string;
924
+ vat: string;
925
+ currency: string;
926
+ transaction_id: string;
927
+ rate: number;
928
+ vat_price: number;
929
+ price_discount: number;
930
+ price_discount_in_currency: number;
931
+ price_total: string;
932
+ price_total_in_currency: number;
933
+ _COMMENT?: string | undefined;
934
+ };
935
+ warning?: string | undefined;
936
+ }>>;
937
+ invoice: z.ZodOptional<z.ZodObject<{
938
+ doc_uuid: z.ZodString;
939
+ pdf_link: z.ZodString;
940
+ pdf_link_copy: z.ZodString;
941
+ doc_number: z.ZodString;
942
+ sent_mails: z.ZodArray<z.ZodString, "many">;
943
+ success: z.ZodBoolean;
944
+ ua_uuid: z.ZodString;
945
+ calculatedData: z.ZodObject<{
946
+ _COMMENT: z.ZodOptional<z.ZodString>;
947
+ transaction_id: z.ZodString;
948
+ date: z.ZodString;
949
+ currency: z.ZodString;
950
+ rate: z.ZodNumber;
951
+ vat: z.ZodString;
952
+ vat_price: z.ZodNumber;
953
+ price_discount: z.ZodNumber;
954
+ price_discount_in_currency: z.ZodNumber;
955
+ price_total: z.ZodString;
956
+ price_total_in_currency: z.ZodNumber;
957
+ }, "strip", z.ZodTypeAny, {
958
+ date: string;
959
+ vat: string;
960
+ currency: string;
961
+ transaction_id: string;
962
+ rate: number;
963
+ vat_price: number;
964
+ price_discount: number;
965
+ price_discount_in_currency: number;
966
+ price_total: string;
967
+ price_total_in_currency: number;
968
+ _COMMENT?: string | undefined;
969
+ }, {
970
+ date: string;
971
+ vat: string;
972
+ currency: string;
973
+ transaction_id: string;
974
+ rate: number;
975
+ vat_price: number;
976
+ price_discount: number;
977
+ price_discount_in_currency: number;
978
+ price_total: string;
979
+ price_total_in_currency: number;
980
+ _COMMENT?: string | undefined;
981
+ }>;
982
+ warning: z.ZodOptional<z.ZodString>;
983
+ }, "strip", z.ZodTypeAny, {
984
+ doc_uuid: string;
985
+ pdf_link: string;
986
+ pdf_link_copy: string;
987
+ doc_number: string;
988
+ sent_mails: string[];
989
+ success: boolean;
990
+ ua_uuid: string;
991
+ calculatedData: {
992
+ date: string;
993
+ vat: string;
994
+ currency: string;
995
+ transaction_id: string;
996
+ rate: number;
997
+ vat_price: number;
998
+ price_discount: number;
999
+ price_discount_in_currency: number;
1000
+ price_total: string;
1001
+ price_total_in_currency: number;
1002
+ _COMMENT?: string | undefined;
1003
+ };
1004
+ warning?: string | undefined;
1005
+ }, {
1006
+ doc_uuid: string;
1007
+ pdf_link: string;
1008
+ pdf_link_copy: string;
1009
+ doc_number: string;
1010
+ sent_mails: string[];
1011
+ success: boolean;
1012
+ ua_uuid: string;
1013
+ calculatedData: {
1014
+ date: string;
1015
+ vat: string;
1016
+ currency: string;
1017
+ transaction_id: string;
1018
+ rate: number;
1019
+ vat_price: number;
1020
+ price_discount: number;
1021
+ price_discount_in_currency: number;
1022
+ price_total: string;
1023
+ price_total_in_currency: number;
1024
+ _COMMENT?: string | undefined;
1025
+ };
1026
+ warning?: string | undefined;
1027
+ }>>;
1028
+ organizationId: z.ZodOptional<z.ZodString>;
1029
+ billingAccount: z.ZodOptional<z.ZodObject<{
1030
+ number: z.ZodString;
1031
+ name: z.ZodString;
1032
+ id: z.ZodString;
1033
+ }, "strip", z.ZodTypeAny, {
1034
+ number: string;
1035
+ id: string;
1036
+ name: string;
1037
+ }, {
1038
+ number: string;
1039
+ id: string;
1040
+ name: string;
1041
+ }>>;
846
1042
  }, "strip", z.ZodTypeAny, {
847
1043
  type: "Order";
848
1044
  status: "draft" | "completed" | "pending" | "processing" | "in_delivery" | "delivered" | "cancelled" | "refunded";
@@ -979,10 +1175,62 @@ export declare const OrderSchema: z.ZodObject<{
979
1175
  } | undefined;
980
1176
  organizationId?: string | undefined;
981
1177
  };
1178
+ organizationId?: string | undefined;
1179
+ nameOnInvoice?: string | undefined;
982
1180
  originalAmount?: number | undefined;
983
1181
  actualAmount?: number | undefined;
984
- nameOnInvoice?: string | undefined;
985
1182
  clientComment?: string | undefined;
1183
+ deliveryNote?: {
1184
+ doc_uuid: string;
1185
+ pdf_link: string;
1186
+ pdf_link_copy: string;
1187
+ doc_number: string;
1188
+ sent_mails: string[];
1189
+ success: boolean;
1190
+ ua_uuid: string;
1191
+ calculatedData: {
1192
+ date: string;
1193
+ vat: string;
1194
+ currency: string;
1195
+ transaction_id: string;
1196
+ rate: number;
1197
+ vat_price: number;
1198
+ price_discount: number;
1199
+ price_discount_in_currency: number;
1200
+ price_total: string;
1201
+ price_total_in_currency: number;
1202
+ _COMMENT?: string | undefined;
1203
+ };
1204
+ warning?: string | undefined;
1205
+ } | undefined;
1206
+ invoice?: {
1207
+ doc_uuid: string;
1208
+ pdf_link: string;
1209
+ pdf_link_copy: string;
1210
+ doc_number: string;
1211
+ sent_mails: string[];
1212
+ success: boolean;
1213
+ ua_uuid: string;
1214
+ calculatedData: {
1215
+ date: string;
1216
+ vat: string;
1217
+ currency: string;
1218
+ transaction_id: string;
1219
+ rate: number;
1220
+ vat_price: number;
1221
+ price_discount: number;
1222
+ price_discount_in_currency: number;
1223
+ price_total: string;
1224
+ price_total_in_currency: number;
1225
+ _COMMENT?: string | undefined;
1226
+ };
1227
+ warning?: string | undefined;
1228
+ } | undefined;
1229
+ billingAccount?: {
1230
+ number: string;
1231
+ id: string;
1232
+ name: string;
1233
+ } | undefined;
986
1234
  }, {
987
1235
  type: "Order";
988
1236
  status: "draft" | "completed" | "pending" | "processing" | "in_delivery" | "delivered" | "cancelled" | "refunded";
@@ -1119,10 +1367,62 @@ export declare const OrderSchema: z.ZodObject<{
1119
1367
  } | undefined;
1120
1368
  organizationId?: string | undefined;
1121
1369
  };
1370
+ organizationId?: string | undefined;
1371
+ nameOnInvoice?: string | undefined;
1122
1372
  originalAmount?: number | undefined;
1123
1373
  actualAmount?: number | undefined;
1124
- nameOnInvoice?: string | undefined;
1125
1374
  clientComment?: string | undefined;
1375
+ deliveryNote?: {
1376
+ doc_uuid: string;
1377
+ pdf_link: string;
1378
+ pdf_link_copy: string;
1379
+ doc_number: string;
1380
+ sent_mails: string[];
1381
+ success: boolean;
1382
+ ua_uuid: string;
1383
+ calculatedData: {
1384
+ date: string;
1385
+ vat: string;
1386
+ currency: string;
1387
+ transaction_id: string;
1388
+ rate: number;
1389
+ vat_price: number;
1390
+ price_discount: number;
1391
+ price_discount_in_currency: number;
1392
+ price_total: string;
1393
+ price_total_in_currency: number;
1394
+ _COMMENT?: string | undefined;
1395
+ };
1396
+ warning?: string | undefined;
1397
+ } | undefined;
1398
+ invoice?: {
1399
+ doc_uuid: string;
1400
+ pdf_link: string;
1401
+ pdf_link_copy: string;
1402
+ doc_number: string;
1403
+ sent_mails: string[];
1404
+ success: boolean;
1405
+ ua_uuid: string;
1406
+ calculatedData: {
1407
+ date: string;
1408
+ vat: string;
1409
+ currency: string;
1410
+ transaction_id: string;
1411
+ rate: number;
1412
+ vat_price: number;
1413
+ price_discount: number;
1414
+ price_discount_in_currency: number;
1415
+ price_total: string;
1416
+ price_total_in_currency: number;
1417
+ _COMMENT?: string | undefined;
1418
+ };
1419
+ warning?: string | undefined;
1420
+ } | undefined;
1421
+ billingAccount?: {
1422
+ number: string;
1423
+ id: string;
1424
+ name: string;
1425
+ } | undefined;
1126
1426
  }>;
1127
1427
  export type TOrder = z.infer<typeof OrderSchema>;
1128
1428
  //# sourceMappingURL=Order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../lib/entities/Order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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import { z } from "zod";
2
2
  import { ProfileSchema } from "./Profile";
3
3
  import { notEmptyTextSchema } from "./Atoms";
4
4
  import { CartItemProductSchema } from "./Cart";
5
+ import { DeliveryNoteSchema } from "./DeliveryNote";
6
+ import { BillingAccountSchema } from "./Organization";
7
+ import { InvoiceSchema } from "./Invoice";
5
8
  // pending - order created / by user
6
9
  // processing order accepted by store by admin
7
10
  // delivered - order delivered by admin
@@ -40,4 +43,8 @@ export const OrderSchema = z.object({
40
43
  client: ProfileSchema.required({}),
41
44
  nameOnInvoice: z.string().optional(),
42
45
  clientComment: z.string().optional(),
46
+ deliveryNote: DeliveryNoteSchema.optional(),
47
+ invoice: InvoiceSchema.optional(),
48
+ organizationId: z.string().optional(),
49
+ billingAccount: BillingAccountSchema.optional(),
43
50
  });
@@ -1,34 +1,94 @@
1
1
  import { z } from "zod";
2
+ export declare const BillingAccountSchema: z.ZodObject<{
3
+ number: z.ZodString;
4
+ name: z.ZodString;
5
+ id: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ number: string;
8
+ id: string;
9
+ name: string;
10
+ }, {
11
+ number: string;
12
+ id: string;
13
+ name: string;
14
+ }>;
2
15
  export declare const OrganizationSchema: z.ZodObject<{
3
16
  id: z.ZodString;
4
17
  name: z.ZodString;
5
18
  discountPercentage: z.ZodOptional<z.ZodNumber>;
6
19
  nameOnInvoice: z.ZodOptional<z.ZodString>;
20
+ billingAccounts: z.ZodArray<z.ZodObject<{
21
+ number: z.ZodString;
22
+ name: z.ZodString;
23
+ id: z.ZodString;
24
+ }, "strip", z.ZodTypeAny, {
25
+ number: string;
26
+ id: string;
27
+ name: string;
28
+ }, {
29
+ number: string;
30
+ id: string;
31
+ name: string;
32
+ }>, "many">;
7
33
  }, "strip", z.ZodTypeAny, {
8
34
  id: string;
9
35
  name: string;
10
- nameOnInvoice?: string | undefined;
36
+ billingAccounts: {
37
+ number: string;
38
+ id: string;
39
+ name: string;
40
+ }[];
11
41
  discountPercentage?: number | undefined;
42
+ nameOnInvoice?: string | undefined;
12
43
  }, {
13
44
  id: string;
14
45
  name: string;
15
- nameOnInvoice?: string | undefined;
46
+ billingAccounts: {
47
+ number: string;
48
+ id: string;
49
+ name: string;
50
+ }[];
16
51
  discountPercentage?: number | undefined;
52
+ nameOnInvoice?: string | undefined;
17
53
  }>;
18
54
  export declare const NewOrganizationSchema: z.ZodObject<Omit<{
19
55
  id: z.ZodString;
20
56
  name: z.ZodString;
21
57
  discountPercentage: z.ZodOptional<z.ZodNumber>;
22
58
  nameOnInvoice: z.ZodOptional<z.ZodString>;
59
+ billingAccounts: z.ZodArray<z.ZodObject<{
60
+ number: z.ZodString;
61
+ name: z.ZodString;
62
+ id: z.ZodString;
63
+ }, "strip", z.ZodTypeAny, {
64
+ number: string;
65
+ id: string;
66
+ name: string;
67
+ }, {
68
+ number: string;
69
+ id: string;
70
+ name: string;
71
+ }>, "many">;
23
72
  }, "id">, "strip", z.ZodTypeAny, {
24
73
  name: string;
25
- nameOnInvoice?: string | undefined;
74
+ billingAccounts: {
75
+ number: string;
76
+ id: string;
77
+ name: string;
78
+ }[];
26
79
  discountPercentage?: number | undefined;
80
+ nameOnInvoice?: string | undefined;
27
81
  }, {
28
82
  name: string;
29
- nameOnInvoice?: string | undefined;
83
+ billingAccounts: {
84
+ number: string;
85
+ id: string;
86
+ name: string;
87
+ }[];
30
88
  discountPercentage?: number | undefined;
89
+ nameOnInvoice?: string | undefined;
31
90
  }>;
91
+ export type TBillingAccount = z.infer<typeof BillingAccountSchema>;
32
92
  export type TNewOrganization = z.infer<typeof NewOrganizationSchema>;
33
93
  export type TOrganization = z.infer<typeof OrganizationSchema>;
34
94
  //# sourceMappingURL=Organization.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Organization.d.ts","sourceRoot":"","sources":["../../lib/entities/Organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAK7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;EAAwC,CAAC;AAE3E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACrE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"Organization.d.ts","sourceRoot":"","sources":["../../lib/entities/Organization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AAGH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM7B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAwC,CAAC;AAE3E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACnE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACrE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -1,9 +1,15 @@
1
1
  import { z } from "zod";
2
+ export const BillingAccountSchema = z.object({
3
+ number: z.string(),
4
+ name: z.string(),
5
+ id: z.string(),
6
+ });
2
7
  // client organization for clients
3
8
  export const OrganizationSchema = z.object({
4
9
  id: z.string(),
5
10
  name: z.string(),
6
11
  discountPercentage: z.number().positive().min(0).max(100).optional(),
7
12
  nameOnInvoice: z.string().optional(),
13
+ billingAccounts: z.array(BillingAccountSchema),
8
14
  });
9
15
  export const NewOrganizationSchema = OrganizationSchema.omit({ id: true });
@@ -1 +1 @@
1
- {"root":["../lib/index.tsx","../lib/entities/address.ts","../lib/entities/atoms.ts","../lib/entities/cart.ts","../lib/entities/category.ts","../lib/entities/company.ts","../lib/entities/deliverynote.ts","../lib/entities/favoriteproduct.ts","../lib/entities/locale.ts","../lib/entities/order.ts","../lib/entities/organization.ts","../lib/entities/product.ts","../lib/entities/profile.ts","../lib/entities/store.ts","../lib/entities/index.ts","../lib/entities/discount/engine.ts","../lib/entities/discount/factory.ts","../lib/entities/discount/index.ts","../lib/entities/discount/strategy.ts","../lib/entities/discount/types.ts","../lib/entities/discount/utils.ts","../lib/entities/discount/__tests__/engine.test.ts","../lib/entities/discount/__tests__/factory.test.ts","../lib/entities/discount/__tests__/integration.test.ts","../lib/entities/discount/__tests__/simple.test.ts","../lib/entities/discount/__tests__/utils.test.ts","../lib/entities/discount/strategies/bundlestrategy.ts","../lib/entities/discount/strategies/__tests__/bundlestrategy.test.ts","../lib/firebase-api/app.ts","../lib/firebase-api/index.ts","../lib/utils/index.ts"],"version":"5.7.3"}
1
+ {"root":["../lib/index.tsx","../lib/entities/address.ts","../lib/entities/atoms.ts","../lib/entities/cart.ts","../lib/entities/category.ts","../lib/entities/company.ts","../lib/entities/deliverynote.ts","../lib/entities/favoriteproduct.ts","../lib/entities/invoice.ts","../lib/entities/locale.ts","../lib/entities/order.ts","../lib/entities/organization.ts","../lib/entities/product.ts","../lib/entities/profile.ts","../lib/entities/store.ts","../lib/entities/index.ts","../lib/entities/discount/engine.ts","../lib/entities/discount/factory.ts","../lib/entities/discount/index.ts","../lib/entities/discount/strategy.ts","../lib/entities/discount/types.ts","../lib/entities/discount/utils.ts","../lib/entities/discount/__tests__/engine.test.ts","../lib/entities/discount/__tests__/factory.test.ts","../lib/entities/discount/__tests__/integration.test.ts","../lib/entities/discount/__tests__/simple.test.ts","../lib/entities/discount/__tests__/utils.test.ts","../lib/entities/discount/strategies/bundlestrategy.ts","../lib/entities/discount/strategies/__tests__/bundlestrategy.test.ts","../lib/firebase-api/app.ts","../lib/firebase-api/index.ts","../lib/utils/index.ts"],"version":"5.7.3"}
@@ -0,0 +1,23 @@
1
+ import { z } from "zod";
2
+ import { CalculatedDataSchema } from "./DeliveryNote";
3
+
4
+ // Main Invoice schema
5
+ export const InvoiceSchema = z.object({
6
+ doc_uuid: z.string().uuid("Document UUID must be a valid UUID"),
7
+ pdf_link: z.string().url("PDF link must be a valid URL"),
8
+ pdf_link_copy: z.string().url("PDF copy link must be a valid URL"),
9
+ doc_number: z.string().min(1, "Document number is required"),
10
+ sent_mails: z.array(z.string().email("Each email must be valid")),
11
+ success: z.boolean(),
12
+ ua_uuid: z.string().uuid("UA UUID must be a valid UUID"),
13
+ calculatedData: CalculatedDataSchema,
14
+ warning: z.string().optional(),
15
+ });
16
+
17
+ // Type inference
18
+ export type TInvoice = z.infer<typeof InvoiceSchema>;
19
+
20
+ // Validation functions
21
+ export function isInvoice(data: unknown): data is TInvoice {
22
+ return InvoiceSchema.safeParse(data).success;
23
+ }
@@ -3,6 +3,8 @@ import { ProfileSchema } from "./Profile";
3
3
  import { notEmptyTextSchema } from "./Atoms";
4
4
  import { CartItemProductSchema } from "./Cart";
5
5
  import { DeliveryNoteSchema } from "./DeliveryNote";
6
+ import { BillingAccountSchema } from "./Organization";
7
+ import { InvoiceSchema } from "./Invoice";
6
8
 
7
9
  // pending - order created / by user
8
10
  // processing order accepted by store by admin
@@ -45,6 +47,9 @@ export const OrderSchema = z.object({
45
47
  nameOnInvoice: z.string().optional(),
46
48
  clientComment: z.string().optional(),
47
49
  deliveryNote: DeliveryNoteSchema.optional(),
50
+ invoice: InvoiceSchema.optional(),
51
+ organizationId: z.string().optional(),
52
+ billingAccount: BillingAccountSchema.optional(),
48
53
  });
49
54
 
50
55
  export type TOrder = z.infer<typeof OrderSchema>;
@@ -1,14 +1,22 @@
1
1
  import { z } from "zod";
2
2
 
3
+ export const BillingAccountSchema = z.object({
4
+ number: z.string(),
5
+ name: z.string(),
6
+ id: z.string(),
7
+ });
8
+
3
9
  // client organization for clients
4
10
  export const OrganizationSchema = z.object({
5
11
  id: z.string(),
6
12
  name: z.string(),
7
13
  discountPercentage: z.number().positive().min(0).max(100).optional(),
8
14
  nameOnInvoice: z.string().optional(),
15
+ billingAccounts: z.array(BillingAccountSchema),
9
16
  });
10
17
 
11
18
  export const NewOrganizationSchema = OrganizationSchema.omit({ id: true });
12
19
 
20
+ export type TBillingAccount = z.infer<typeof BillingAccountSchema>;
13
21
  export type TNewOrganization = z.infer<typeof NewOrganizationSchema>;
14
22
  export type TOrganization = z.infer<typeof OrganizationSchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsdev_ninja/core",
3
- "version": "0.13.15",
3
+ "version": "0.13.17",
4
4
  "main": "dist/core.cjs.js",
5
5
  "module": "dist/core.es.js",
6
6
  "types": "dist/index.d.ts",