@jsdev_ninja/core 0.13.16 → 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
+ }
@@ -934,6 +934,111 @@ export declare const OrderSchema: z.ZodObject<{
934
934
  };
935
935
  warning?: string | undefined;
936
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
+ }>>;
937
1042
  }, "strip", z.ZodTypeAny, {
938
1043
  type: "Order";
939
1044
  status: "draft" | "completed" | "pending" | "processing" | "in_delivery" | "delivered" | "cancelled" | "refunded";
@@ -1070,9 +1175,10 @@ export declare const OrderSchema: z.ZodObject<{
1070
1175
  } | undefined;
1071
1176
  organizationId?: string | undefined;
1072
1177
  };
1178
+ organizationId?: string | undefined;
1179
+ nameOnInvoice?: string | undefined;
1073
1180
  originalAmount?: number | undefined;
1074
1181
  actualAmount?: number | undefined;
1075
- nameOnInvoice?: string | undefined;
1076
1182
  clientComment?: string | undefined;
1077
1183
  deliveryNote?: {
1078
1184
  doc_uuid: string;
@@ -1097,6 +1203,34 @@ export declare const OrderSchema: z.ZodObject<{
1097
1203
  };
1098
1204
  warning?: string | undefined;
1099
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;
1100
1234
  }, {
1101
1235
  type: "Order";
1102
1236
  status: "draft" | "completed" | "pending" | "processing" | "in_delivery" | "delivered" | "cancelled" | "refunded";
@@ -1233,9 +1367,10 @@ export declare const OrderSchema: z.ZodObject<{
1233
1367
  } | undefined;
1234
1368
  organizationId?: string | undefined;
1235
1369
  };
1370
+ organizationId?: string | undefined;
1371
+ nameOnInvoice?: string | undefined;
1236
1372
  originalAmount?: number | undefined;
1237
1373
  actualAmount?: number | undefined;
1238
- nameOnInvoice?: string | undefined;
1239
1374
  clientComment?: string | undefined;
1240
1375
  deliveryNote?: {
1241
1376
  doc_uuid: string;
@@ -1260,6 +1395,34 @@ export declare const OrderSchema: z.ZodObject<{
1260
1395
  };
1261
1396
  warning?: string | undefined;
1262
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;
1263
1426
  }>;
1264
1427
  export type TOrder = z.infer<typeof OrderSchema>;
1265
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;AAcxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCtB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -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
  // pending - order created / by user
7
9
  // processing order accepted by store by admin
8
10
  // delivered - order delivered by admin
@@ -42,4 +44,7 @@ export const OrderSchema = z.object({
42
44
  nameOnInvoice: z.string().optional(),
43
45
  clientComment: z.string().optional(),
44
46
  deliveryNote: DeliveryNoteSchema.optional(),
47
+ invoice: InvoiceSchema.optional(),
48
+ organizationId: z.string().optional(),
49
+ billingAccount: BillingAccountSchema.optional(),
45
50
  });
@@ -1,4 +1,17 @@
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;
@@ -25,8 +38,8 @@ export declare const OrganizationSchema: z.ZodObject<{
25
38
  id: string;
26
39
  name: string;
27
40
  }[];
28
- nameOnInvoice?: string | undefined;
29
41
  discountPercentage?: number | undefined;
42
+ nameOnInvoice?: string | undefined;
30
43
  }, {
31
44
  id: string;
32
45
  name: string;
@@ -35,8 +48,8 @@ export declare const OrganizationSchema: z.ZodObject<{
35
48
  id: string;
36
49
  name: string;
37
50
  }[];
38
- nameOnInvoice?: string | undefined;
39
51
  discountPercentage?: number | undefined;
52
+ nameOnInvoice?: string | undefined;
40
53
  }>;
41
54
  export declare const NewOrganizationSchema: z.ZodObject<Omit<{
42
55
  id: z.ZodString;
@@ -63,8 +76,8 @@ export declare const NewOrganizationSchema: z.ZodObject<Omit<{
63
76
  id: string;
64
77
  name: string;
65
78
  }[];
66
- nameOnInvoice?: string | undefined;
67
79
  discountPercentage?: number | undefined;
80
+ nameOnInvoice?: string | undefined;
68
81
  }, {
69
82
  name: string;
70
83
  billingAccounts: {
@@ -72,9 +85,10 @@ export declare const NewOrganizationSchema: z.ZodObject<Omit<{
72
85
  id: string;
73
86
  name: string;
74
87
  }[];
75
- nameOnInvoice?: string | undefined;
76
88
  discountPercentage?: number | undefined;
89
+ nameOnInvoice?: string | undefined;
77
90
  }>;
91
+ export type TBillingAccount = z.infer<typeof BillingAccountSchema>;
78
92
  export type TNewOrganization = z.infer<typeof NewOrganizationSchema>;
79
93
  export type TOrganization = z.infer<typeof OrganizationSchema>;
80
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY7B,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,14 +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(),
8
- billingAccounts: z.array(z.object({
9
- number: z.string(),
10
- name: z.string(),
11
- id: z.string(),
12
- })),
13
+ billingAccounts: z.array(BillingAccountSchema),
13
14
  });
14
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,21 +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(),
9
- billingAccounts: z.array(
10
- z.object({
11
- number: z.string(),
12
- name: z.string(),
13
- id: z.string(),
14
- })
15
- ),
15
+ billingAccounts: z.array(BillingAccountSchema),
16
16
  });
17
17
 
18
18
  export const NewOrganizationSchema = OrganizationSchema.omit({ id: true });
19
19
 
20
+ export type TBillingAccount = z.infer<typeof BillingAccountSchema>;
20
21
  export type TNewOrganization = z.infer<typeof NewOrganizationSchema>;
21
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.16",
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",