@managesome/eposmatic-toolkit 0.2.769 → 0.2.771

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.
Files changed (57) hide show
  1. package/lib/helpers/utils/receipt-engine.js +10 -2
  2. package/lib/tests/classic-specials-quantity.test.js +7 -4
  3. package/lib/tests/receipt-engine.test.js +79 -0
  4. package/package.json +1 -1
  5. package/lib/constants/MATERIALIZED_REPORTS.d.ts +0 -44
  6. package/lib/constants/MATERIALIZED_REPORTS.js +0 -58
  7. package/lib/constants/WAREHOUSE_INVOICE.d.ts +0 -14
  8. package/lib/constants/WAREHOUSE_INVOICE.js +0 -35
  9. package/lib/helpers/offer/generate-offer.d.ts +0 -11
  10. package/lib/helpers/offer/generate-offer.js +0 -143
  11. package/lib/helpers/offer/index.d.ts +0 -1
  12. package/lib/helpers/offer/index.js +0 -17
  13. package/lib/helpers/order/generate-warehouse-invoice.d.ts +0 -11
  14. package/lib/helpers/order/generate-warehouse-invoice.js +0 -196
  15. package/lib/helpers/store/all-warehouse-invoice-actions.d.ts +0 -13
  16. package/lib/helpers/store/all-warehouse-invoice-actions.js +0 -58
  17. package/lib/helpers/store/common-warehouse-invoice-actions.d.ts +0 -31
  18. package/lib/helpers/store/common-warehouse-invoice-actions.js +0 -545
  19. package/lib/helpers/store/warehouse-invoice-cart-actions.d.ts +0 -24
  20. package/lib/helpers/store/warehouse-invoice-cart-actions.js +0 -486
  21. package/lib/helpers/types/sockets.d.ts +0 -6
  22. package/lib/helpers/types/sockets.js +0 -2
  23. package/lib/helpers/types/warehouse-invoice-cart-actions.d.ts +0 -26
  24. package/lib/helpers/types/warehouse-invoice-cart-actions.js +0 -2
  25. package/lib/helpers/utils/materialized-report-helpers.d.ts +0 -35
  26. package/lib/helpers/utils/materialized-report-helpers.js +0 -73
  27. package/lib/helpers/utils/void-warehouse-invoice-items-helpers.d.ts +0 -3
  28. package/lib/helpers/utils/void-warehouse-invoice-items-helpers.js +0 -38
  29. package/lib/helpers/utils/void-warehouse-invoice-items-report-helpers.d.ts +0 -13
  30. package/lib/helpers/utils/void-warehouse-invoice-items-report-helpers.js +0 -22
  31. package/lib/helpers/utils/warehouse-invoice-order-engine.d.ts +0 -11
  32. package/lib/helpers/utils/warehouse-invoice-order-engine.js +0 -39
  33. package/lib/helpers/utils/warehouse-invoice-x-report-helpers.d.ts +0 -58
  34. package/lib/helpers/utils/warehouse-invoice-x-report-helpers.js +0 -1432
  35. package/lib/schemas/models/inventory_department_transactions.d.ts +0 -86
  36. package/lib/schemas/models/inventory_department_transactions.js +0 -116
  37. package/lib/schemas/models/inventory_department_utilities.d.ts +0 -108
  38. package/lib/schemas/models/inventory_department_utilities.js +0 -88
  39. package/lib/schemas/models/inventory_departments.d.ts +0 -53
  40. package/lib/schemas/models/inventory_departments.js +0 -58
  41. package/lib/schemas/models/inventory_entries.d.ts +0 -152
  42. package/lib/schemas/models/inventory_entries.js +0 -142
  43. package/lib/schemas/models/materialized_reports.d.ts +0 -277
  44. package/lib/schemas/models/materialized_reports.js +0 -60
  45. package/lib/schemas/models/warehouse_invoices.d.ts +0 -2675
  46. package/lib/schemas/models/warehouse_invoices.js +0 -327
  47. package/lib/schemas/models/warehouse_void_invoice_items.d.ts +0 -176
  48. package/lib/schemas/models/warehouse_void_invoice_items.js +0 -176
  49. package/lib/schemas/types/inventory_entries.d.ts +0 -41
  50. package/lib/schemas/types/inventory_entries.js +0 -2
  51. package/lib/schemas/types/materialized_reports.d.ts +0 -82
  52. package/lib/schemas/types/materialized_reports.js +0 -2
  53. package/lib/schemas/types/warehouse_invoices.d.ts +0 -69
  54. package/lib/schemas/types/warehouse_invoices.js +0 -2
  55. package/lib/schemas/types/warehouse_void_invoice_items.d.ts +0 -37
  56. package/lib/schemas/types/warehouse_void_invoice_items.js +0 -2
  57. package/lib/tests/materialized-report-helpers.test.d.ts +0 -1
@@ -1,82 +0,0 @@
1
- import { MATERIALIZE_SOURCE_ENUM, REPORT_QUERY_FIELD_ENUM, TENANT_PROCESS_ENUM } from '../../constants';
2
- import { ILocalTimeFields } from '../../helpers';
3
- /** A single aggregated bucket inside a materialized sales overview doc. */
4
- export interface ISalesOverviewBucket {
5
- _id: string;
6
- count: number;
7
- grossAmount: number;
8
- }
9
- /**
10
- * The materialized sales overview report document.
11
- *
12
- * One document exists per (tenant, query_field, period) — i.e. 6 documents
13
- * per tenant-day (localDate / localWeek / localMonth / localQuarter /
14
- * localSemester / localYear). The payload preserves the output shape of the
15
- * live getSalesOverview aggregation (ISalesOverview) while adding richer
16
- * fields for analytics.
17
- */
18
- export interface ITenantSalesOverviewReport extends ILocalTimeFields {
19
- _id: string;
20
- tenant_id: string;
21
- /** Which local-time granularity this doc was compiled for. */
22
- query_field: REPORT_QUERY_FIELD_ENUM;
23
- /** Inclusive bounds of the period this doc covers ('YYYY-MM-DD'). */
24
- period_start_local_date: string;
25
- period_end_local_date: string;
26
- total_sales: ISalesOverviewBucket;
27
- cancelled_orders: ISalesOverviewBucket;
28
- total_payment_sales: ISalesOverviewBucket[];
29
- sales_by_platform: ISalesOverviewBucket[];
30
- complimentary_amount: number;
31
- unpaid_amount: number;
32
- amount_collected: number;
33
- net_sales: number;
34
- average_order_value: number;
35
- covers: number;
36
- first_order_at: Date | null;
37
- last_order_at: Date | null;
38
- compiled_at: Date;
39
- compile_source: MATERIALIZE_SOURCE_ENUM;
40
- createdAt: Date;
41
- updatedAt: Date;
42
- }
43
- /**
44
- * The day-end materialization pipeline tracker. One document per tenant.
45
- *
46
- * running_process is the process currently being compiled (null when idle).
47
- * completed_processes maps each process enum to its completion state for the
48
- * current run — the anti-loop mechanism: a handler only enqueues the next
49
- * process at the moment it flips its own flag from false to true, and ignores
50
- * duplicate Cloud Task deliveries when its flag is already true.
51
- */
52
- export interface ITenantProcesses {
53
- _id: string;
54
- tenant_id: string;
55
- /** The business day ('YYYY-MM-DD') being materialized. */
56
- localDate: string;
57
- running_process: TENANT_PROCESS_ENUM | null;
58
- total_processes: number;
59
- current_process: number;
60
- completed_processes: Record<TENANT_PROCESS_ENUM, boolean>;
61
- started_at: Date | null;
62
- completed_at: Date | null;
63
- createdAt: Date;
64
- updatedAt: Date;
65
- }
66
- /** Request body for the POS_DAY_END worker endpoint. */
67
- export interface IWorker_PosDayEnd {
68
- tenant_id: string;
69
- /** The business day that just closed ('YYYY-MM-DD'). */
70
- localDate: string;
71
- }
72
- /** Request body for the MATERIALIZE_SALES_OVERVIEW_REPORT worker endpoint. */
73
- export interface IWorker_MaterializeSalesOverviewReport {
74
- tenant_id: string;
75
- localDate: string;
76
- source?: MATERIALIZE_SOURCE_ENUM;
77
- }
78
- /** Request body for the RESET_TENANT_PROCESSES worker endpoint. */
79
- export interface IWorker_ResetTenantProcesses {
80
- tenant_id: string;
81
- localDate: string;
82
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,69 +0,0 @@
1
- import { WAREHOUSE_INVOICE_STATUS_ENUM } from '../../constants';
2
- import { IOrderPayment, IStaffDetails } from './orders';
3
- export interface IWarehouseClientInvoiceItem {
4
- _id: string;
5
- item_id: string;
6
- is_ready?: boolean;
7
- void_reason?: string;
8
- name: string;
9
- price: number;
10
- subtotal: number;
11
- quantity: number;
12
- _net_amount: number;
13
- _gross_amount: number;
14
- _gst_amount: number;
15
- _discount_amount: number;
16
- special_instructions: string;
17
- }
18
- export interface IWarehouseClientInvoiceCategory {
19
- name: string;
20
- category_id: string;
21
- items: IWarehouseClientInvoiceItem[];
22
- }
23
- export interface IWarehouseClientInvoiceIteration {
24
- categories: IWarehouseClientInvoiceCategory[];
25
- payments: IOrderPayment[];
26
- staff_details: IStaffDetails;
27
- is_gst_inclusive?: boolean;
28
- gst?: number;
29
- gst_amount?: number;
30
- special_instructions: string;
31
- order_status: WAREHOUSE_INVOICE_STATUS_ENUM;
32
- /**
33
- * price is the total price of the all items in the order
34
- * without any discounts
35
- */
36
- price: number;
37
- /**
38
- * amount_earned is the total amount amount_earned by the store
39
- */
40
- amount_earned: number;
41
- /**
42
- * grand_total is the final amount of the order including all taxes and discounts
43
- */
44
- grand_total: number;
45
- tax_number: string;
46
- updatedAt: Date;
47
- }
48
- export interface IWarehouseClientInvoice extends IWarehouseClientInvoiceIteration {
49
- _id: string;
50
- warehouse_id: string;
51
- client_id: string;
52
- client_name: string;
53
- iterations: IWarehouseClientInvoiceIteration[];
54
- /**
55
- * amount_collected is the total amount collected from the consumer
56
- */
57
- amount_collected: number;
58
- order_number: number | null;
59
- delete_reason?: string | null;
60
- cancel_reason?: string | null;
61
- is_deleted: boolean;
62
- order_status_updated_at: Date;
63
- is_reopened?: boolean;
64
- deferred_settlement?: boolean;
65
- order_settled_at: Date;
66
- order_settled_at_mins: number;
67
- createdAt_mins: number;
68
- createdAt: Date;
69
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,37 +0,0 @@
1
- import { VOID_WAREHOUSE_INVOICE_ITEM_TYPE_ENUM } from '../../constants';
2
- export interface IWarehouseVoidInvoiceItemAdjustment {
3
- _id: string;
4
- order_id: string;
5
- order_number: number | null;
6
- order_item_id: string;
7
- quantity: number;
8
- subtotal: number;
9
- staff_id: string;
10
- staff_name: string;
11
- }
12
- export interface IWarehouseVoidInvoiceItem {
13
- _id: string;
14
- warehouse_id: string;
15
- order_id: string;
16
- order_number: number | null;
17
- item_id: string;
18
- order_item_id: string;
19
- void_type: VOID_WAREHOUSE_INVOICE_ITEM_TYPE_ENUM;
20
- client_id: string;
21
- client_name: string;
22
- staff_id: string;
23
- staff_name: string;
24
- void_reason: string;
25
- iteration: number;
26
- name: string;
27
- quantity: number;
28
- subtotal: number;
29
- description: string;
30
- total_adjusted_quantity: number;
31
- total_adjusted_subtotal: number;
32
- adjustments?: IWarehouseVoidInvoiceItemAdjustment[] | null;
33
- order_punched_at: Date;
34
- createdAt_mins: number;
35
- createdAt: Date;
36
- updatedAt: Date;
37
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export {};