@managemint-solutions/entities 1.36.0 → 1.46.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.
Files changed (39) hide show
  1. package/dist/audit-trail/enum/index.d.ts +13 -3
  2. package/dist/audit-trail/enum/index.js +10 -0
  3. package/dist/audit-trail/index.d.ts +14 -1
  4. package/dist/clients/dto/index.d.ts +5 -2
  5. package/dist/clients/index.d.ts +17 -1
  6. package/dist/documents/dto/index.d.ts +148 -0
  7. package/dist/documents/dto/index.js +2 -0
  8. package/dist/documents/enum/index.d.ts +127 -0
  9. package/dist/documents/enum/index.js +140 -0
  10. package/dist/documents/index.d.ts +390 -0
  11. package/dist/documents/index.js +2 -0
  12. package/dist/leads/index.d.ts +2 -0
  13. package/dist/notifications/enum/index.d.ts +4 -0
  14. package/dist/notifications/enum/index.js +4 -0
  15. package/dist/organization/payouts/dto/index.d.ts +15 -0
  16. package/dist/organization/payouts/dto/index.js +2 -0
  17. package/dist/organization/payouts/enum/index.d.ts +11 -0
  18. package/dist/organization/payouts/enum/index.js +16 -0
  19. package/dist/organization/payouts/index.d.ts +21 -0
  20. package/dist/organization/payouts/index.js +2 -0
  21. package/dist/payments/enum/index.d.ts +22 -0
  22. package/dist/payments/enum/index.js +29 -0
  23. package/dist/payments/index.d.ts +25 -0
  24. package/dist/payments/index.js +2 -0
  25. package/dist/paystack/enum/index.d.ts +8 -0
  26. package/dist/paystack/enum/index.js +11 -1
  27. package/dist/paystack/index.d.ts +63 -6
  28. package/dist/paystack/webhook/index.d.ts +9 -2
  29. package/dist/projects/index.d.ts +2 -0
  30. package/dist/tasks/index.d.ts +2 -0
  31. package/dist/users/index.d.ts +1 -0
  32. package/dist/users/permissions/dto/index.d.ts +4 -0
  33. package/dist/visibility/dto/index.d.ts +13 -0
  34. package/dist/visibility/dto/index.js +2 -0
  35. package/dist/visibility/enum/index.d.ts +17 -0
  36. package/dist/visibility/enum/index.js +22 -0
  37. package/dist/visibility/index.d.ts +13 -0
  38. package/dist/visibility/index.js +2 -0
  39. package/package.json +1 -1
@@ -4,7 +4,9 @@ export declare enum AuditTrailAction {
4
4
  ARCHIVE = "ARCHIVE",
5
5
  UNARCHIVE = "UNARCHIVE",
6
6
  DELETE = "DELETE",
7
- RESTORE = "RESTORE"
7
+ RESTORE = "RESTORE",
8
+ /** A document emailed: its changes hold recipients, cc, subject and pay_now as sent. */
9
+ SEND = "SEND"
8
10
  }
9
11
  export declare enum AuditTrailEntityType {
10
12
  ORGANIZATION = "organizations",
@@ -28,11 +30,19 @@ export declare enum AuditTrailEntityType {
28
30
  BILLING_TRANSACTIONS = "billing_transactions",
29
31
  INVOICE = "invoices",
30
32
  NOTIFICATION = "notifications",
31
- USER_API_CREDENTIAL = "user_api_credentials"
33
+ USER_API_CREDENTIAL = "user_api_credentials",
34
+ DOCUMENT_TEMPLATES = "document_templates",
35
+ DOCUMENTS = "documents",
36
+ VISIBILITY = "visibility",
37
+ PAYMENTS = "payments"
32
38
  }
33
39
  export declare enum AuditTrailChangeType {
34
40
  TEXT = "text",
35
41
  DATE = "date",
36
42
  DATETIME = "datetime",
37
- REDACTED = "redacted"
43
+ REDACTED = "redacted",
44
+ /** One block of a template or document: `block` says what happened to it. */
45
+ BLOCK = "block",
46
+ /** One variable definition of a template or document: `variable` says what happened to it. */
47
+ VARIABLE = "variable"
38
48
  }
@@ -9,6 +9,8 @@ var AuditTrailAction;
9
9
  AuditTrailAction["UNARCHIVE"] = "UNARCHIVE";
10
10
  AuditTrailAction["DELETE"] = "DELETE";
11
11
  AuditTrailAction["RESTORE"] = "RESTORE";
12
+ /** A document emailed: its changes hold recipients, cc, subject and pay_now as sent. */
13
+ AuditTrailAction["SEND"] = "SEND";
12
14
  })(AuditTrailAction || (exports.AuditTrailAction = AuditTrailAction = {}));
13
15
  var AuditTrailEntityType;
14
16
  (function (AuditTrailEntityType) {
@@ -34,6 +36,10 @@ var AuditTrailEntityType;
34
36
  AuditTrailEntityType["INVOICE"] = "invoices";
35
37
  AuditTrailEntityType["NOTIFICATION"] = "notifications";
36
38
  AuditTrailEntityType["USER_API_CREDENTIAL"] = "user_api_credentials";
39
+ AuditTrailEntityType["DOCUMENT_TEMPLATES"] = "document_templates";
40
+ AuditTrailEntityType["DOCUMENTS"] = "documents";
41
+ AuditTrailEntityType["VISIBILITY"] = "visibility";
42
+ AuditTrailEntityType["PAYMENTS"] = "payments";
37
43
  })(AuditTrailEntityType || (exports.AuditTrailEntityType = AuditTrailEntityType = {}));
38
44
  var AuditTrailChangeType;
39
45
  (function (AuditTrailChangeType) {
@@ -41,4 +47,8 @@ var AuditTrailChangeType;
41
47
  AuditTrailChangeType["DATE"] = "date";
42
48
  AuditTrailChangeType["DATETIME"] = "datetime";
43
49
  AuditTrailChangeType["REDACTED"] = "redacted";
50
+ /** One block of a template or document: `block` says what happened to it. */
51
+ AuditTrailChangeType["BLOCK"] = "block";
52
+ /** One variable definition of a template or document: `variable` says what happened to it. */
53
+ AuditTrailChangeType["VARIABLE"] = "variable";
44
54
  })(AuditTrailChangeType || (exports.AuditTrailChangeType = AuditTrailChangeType = {}));
@@ -1,3 +1,4 @@
1
+ import type { DocumentBlockChange, DocumentVariableChange } from "../documents";
1
2
  import { UserIdentity } from "../users";
2
3
  import { AuditTrailAction, AuditTrailChangeType, AuditTrailEntityType } from "./enum";
3
4
  export type AuditTrailEntity = {
@@ -7,9 +8,15 @@ export type AuditTrailEntity = {
7
8
  action: AuditTrailAction;
8
9
  entity_type: AuditTrailEntityType;
9
10
  entity_id: string;
11
+ /**
12
+ * As stored. A template's or document's `blocks`, `variables` and `variable_values` keep
13
+ * `'[redacted]'` on both sides and say what changed in `diff` instead: DocumentBlockChange[],
14
+ * DocumentVariableChange[] and DocumentValueChange[]. Its `email` keeps only the keys that moved.
15
+ */
10
16
  changes: Record<string, {
11
17
  old: any;
12
18
  new: any;
19
+ diff?: unknown[];
13
20
  }>;
14
21
  related_entity_type: AuditTrailEntityType | null;
15
22
  related_entity_id: string | null;
@@ -18,7 +25,9 @@ export type AuditTrailEntity = {
18
25
  * One changed field as a record's history shows it: the column, its readable label, and both
19
26
  * sides already turned into display text (a status id into the status label, a boolean into
20
27
  * Yes/No). `DATE` and `DATETIME` values stay ISO strings for the portal to format; `REDACTED`
21
- * carries no values, only that the field changed.
28
+ * carries no values, only that the field changed. `BLOCK` and `VARIABLE` carry no text either
29
+ * (`old` and `new` are null): their `block` or `variable` says, as data, what happened to one
30
+ * block or one variable definition of a template or document.
22
31
  */
23
32
  export type AuditTrailChange = {
24
33
  field: string;
@@ -26,6 +35,10 @@ export type AuditTrailChange = {
26
35
  type: AuditTrailChangeType;
27
36
  old: string | null;
28
37
  new: string | null;
38
+ /** On a `BLOCK` change only. */
39
+ block?: DocumentBlockChange;
40
+ /** On a `VARIABLE` change only. */
41
+ variable?: DocumentVariableChange;
29
42
  };
30
43
  /**
31
44
  * One entry in a record's history. `entity_type` is what changed: the record itself, or a row
@@ -1,4 +1,5 @@
1
1
  import { UUID } from "crypto";
2
+ import type { ClientBillingDetails } from '..';
2
3
  export type GetClientsDto = {
3
4
  search?: string | null;
4
5
  page: number;
@@ -15,7 +16,9 @@ export type StaffGetClientsDto = GetClientsDto & {
15
16
  export type ClientIdDto = {
16
17
  clientId: string;
17
18
  };
18
- export type CreateClientDto = {
19
+ /** The billing details on a create or a save; each optional, null clears, left out keeps. */
20
+ export type ClientBillingDetailsDto = Partial<ClientBillingDetails>;
21
+ export type CreateClientDto = ClientBillingDetailsDto & {
19
22
  name: string;
20
23
  email: string | null;
21
24
  phone: string | null;
@@ -23,7 +26,7 @@ export type CreateClientDto = {
23
26
  contract_client: boolean;
24
27
  contracted_hours: number | null;
25
28
  };
26
- export type UpdateClientDto = {
29
+ export type UpdateClientDto = ClientBillingDetailsDto & {
27
30
  name: string;
28
31
  email: string | null;
29
32
  phone: string | null;
@@ -16,7 +16,21 @@ export type ClientSummary = {
16
16
  /** Present on staff reads only. */
17
17
  organization?: OrganizationIdentity;
18
18
  };
19
- export type ClientEntity = {
19
+ /**
20
+ * What a document bills a client by: an address in the organization's own address shape, a
21
+ * registration number and a VAT number. Every one optional (null when not given).
22
+ */
23
+ export type ClientBillingDetails = {
24
+ address_line_1: string | null;
25
+ address_line_2: string | null;
26
+ city: string | null;
27
+ state: string | null;
28
+ post_code: string | null;
29
+ country: string | null;
30
+ registration_number: string | null;
31
+ vat_number: string | null;
32
+ };
33
+ export type ClientEntity = ClientBillingDetails & {
20
34
  mms_id: UUID;
21
35
  created_at: Date;
22
36
  name: string;
@@ -38,4 +52,6 @@ export type ClientEntity = {
38
52
  deleted_by: UserIdentity | null;
39
53
  restored_at: Date | null;
40
54
  restored_by: UserIdentity | null;
55
+ /** Present on staff reads only. */
56
+ organization?: OrganizationIdentity;
41
57
  };
@@ -0,0 +1,148 @@
1
+ import type { DocumentBlock, DocumentEmail, DocumentVariable, DocumentVariableValues } from '..';
2
+ import { DocumentPaymentFilter, DocumentRepeat, DocumentStatus, DocumentVisibility } from '../enum';
3
+ export type GetDocumentTemplatesDto = {
4
+ /** Matches the name and the category. */
5
+ search?: string | null;
6
+ category?: string | null;
7
+ archive: boolean;
8
+ page: number;
9
+ page_size: number;
10
+ };
11
+ export type DocumentTemplateIdDto = {
12
+ templateId: string;
13
+ };
14
+ /**
15
+ * A whole template. Every variable a block uses must be declared in `variables` or be a system
16
+ * variable, and a line's quantity or price may only point at a number or money variable.
17
+ */
18
+ export type CreateDocumentTemplateDto = {
19
+ name: string;
20
+ category?: string;
21
+ number_prefix?: string;
22
+ /** Omitted is ORGANIZATION. After create it changes only through the sharing route. */
23
+ visibility?: DocumentVisibility;
24
+ variables: DocumentVariable[];
25
+ blocks: DocumentBlock[];
26
+ };
27
+ /**
28
+ * Saving replaces the whole template, so the checks above always see it complete. Its visibility
29
+ * is not part of a save - it changes only through the sharing route.
30
+ */
31
+ export type UpdateDocumentTemplateDto = Omit<CreateDocumentTemplateDto, 'visibility'>;
32
+ export type GetDocumentsDto = {
33
+ /** Matches the title and the number. */
34
+ search?: string | null;
35
+ category?: string | null;
36
+ status?: DocumentStatus | null;
37
+ client_id?: string | null;
38
+ template_id?: string | null;
39
+ /** True lists recurring parents only; otherwise parents are left out. */
40
+ recurring?: boolean;
41
+ /** The drafts and documents one recurring parent made. */
42
+ repeat_from?: string | null;
43
+ /** Paid (paid twice included), or unpaid: issued, a total above zero, nothing settled. */
44
+ payment?: DocumentPaymentFilter | null;
45
+ page: number;
46
+ page_size: number;
47
+ };
48
+ /**
49
+ * A recurring parent's schedule, or a draft's issue date - on create and on a draft save. A
50
+ * parent needs `repeat_next_at` (its first issue date) and cannot have `issue_at`; null clears.
51
+ */
52
+ export type DocumentScheduleDto = {
53
+ repeat?: DocumentRepeat | null;
54
+ repeat_next_at?: string | null;
55
+ repeat_until?: string | null;
56
+ repeat_paused?: boolean;
57
+ issue_at?: string | null;
58
+ email?: DocumentEmail | null;
59
+ };
60
+ export type DocumentIdDto = {
61
+ documentId: string;
62
+ };
63
+ /**
64
+ * A new draft. With a template, it copies the template's blocks, variables, category and prefix,
65
+ * and starts from the template's defaults overlaid by `variable_values`. Without one, it starts
66
+ * blank and is built on the draft itself.
67
+ */
68
+ export type CreateDocumentDto = DocumentScheduleDto & {
69
+ template_id?: string | null;
70
+ client_id?: string | null;
71
+ title?: string;
72
+ /** Required once the document has a line items block. */
73
+ currency?: string | null;
74
+ variable_values?: DocumentVariableValues;
75
+ /** A blank draft's setting; one made from a template takes the template's (and its shares). */
76
+ visibility?: DocumentVisibility;
77
+ };
78
+ /**
79
+ * A draft's edits, whole, under the same checks as a template. Only drafts can be updated. Its
80
+ * visibility is not part of a save - it changes only through the sharing route.
81
+ */
82
+ export type UpdateDocumentDto = DocumentScheduleDto & {
83
+ client_id: string | null;
84
+ title: string;
85
+ category: string;
86
+ number_prefix: string;
87
+ currency: string | null;
88
+ variables: DocumentVariable[];
89
+ variable_values: DocumentVariableValues;
90
+ blocks: DocumentBlock[];
91
+ };
92
+ export type VoidDocumentDto = {
93
+ reason: string;
94
+ };
95
+ /** The image an image block is about to upload; only its extension is kept. */
96
+ export type DocumentImageNameDto = {
97
+ name: string;
98
+ };
99
+ /**
100
+ * Image blocks' paths to sign for reading (`documents/images/<id>.<ext>`, as an upload target
101
+ * returned them) - for a page the caller renders itself, such as the portal's live preview.
102
+ */
103
+ export type DocumentImageUrlsDto = {
104
+ paths: string[];
105
+ };
106
+ /**
107
+ * The organization owner moves one person's private templates and documents to another, without
108
+ * seeing them - for someone who has left.
109
+ */
110
+ export type ReassignPrivateDocumentsDto = {
111
+ from_user_id: string;
112
+ to_user_id: string;
113
+ };
114
+ /**
115
+ * Emails an issued document, its PDF attached - the stored DocumentEmail shape. `{{key}}`s in the
116
+ * subject and message are filled from the document's values. `pay_now` adds the public pay link,
117
+ * and is refused unless the document's `pay_now_available`.
118
+ */
119
+ export type SendDocumentDto = DocumentEmail;
120
+ /** A public pay link's token (`/pay/<token>`): the document's mms_id, a dot, and the api's signature of it. */
121
+ export type DocumentPayTokenDto = {
122
+ token: string;
123
+ };
124
+ /**
125
+ * The pay page's read. `reference` is what Paystack hands back on its return to the page
126
+ * (`?reference=`): with it, the api asks Paystack about that checkout and settles it before
127
+ * answering, so the page says paid without waiting for the webhook.
128
+ */
129
+ export type DocumentPayQueryDto = {
130
+ reference?: string;
131
+ };
132
+ /** The payer's email, for Paystack's receipt. */
133
+ export type PayDocumentDto = {
134
+ email: string;
135
+ };
136
+ /**
137
+ * Marks an issued document paid by hand - an EFT the organization received: the whole total, in
138
+ * the document's currency, on `paid_at` (YYYY-MM-DD).
139
+ */
140
+ export type RecordDocumentPaymentDto = {
141
+ paid_at: string;
142
+ /** The bank reference, up to 100 characters. */
143
+ reference?: string | null;
144
+ };
145
+ export type DocumentPaymentIdDto = {
146
+ documentId: string;
147
+ paymentId: string;
148
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,127 @@
1
+ /** Where a document is in its life. Stored as plain text; the sdk DTO validates it against this list. */
2
+ export declare enum DocumentStatus {
3
+ /** Editable; no number yet. */
4
+ DRAFT = "draft",
5
+ /** Numbered and frozen; it never changes again, it can only be voided. */
6
+ ISSUED = "issued",
7
+ /** Cancelled after issue, with a reason. Kept, never deleted. */
8
+ VOID = "void"
9
+ }
10
+ /**
11
+ * Who sees a template or document. A document made from a template starts with the template's.
12
+ * Stored as plain text; the sdk DTOs validate it against this list.
13
+ */
14
+ export declare enum DocumentVisibility {
15
+ /** Everyone in the organization, governed by the documents permissions. */
16
+ ORGANIZATION = "organization",
17
+ /** Its creator and the people it is shared with - not the organization's owners or admins. */
18
+ PRIVATE = "private"
19
+ }
20
+ /**
21
+ * The kinds of block a template or document is built from. A new kind is a member here and a
22
+ * shape in ../index.ts - never a migration, because blocks are stored as JSON.
23
+ */
24
+ export declare enum DocumentBlockType {
25
+ /** Rich text: paragraphs, headings, lists, emphasis, links and variables. */
26
+ TEXT = "text",
27
+ /** Label and value pairs, such as "Start date: 1 November 2026". */
28
+ FIELDS = "fields",
29
+ /** Priced lines with quantity, unit price, discount and tax, and their totals. */
30
+ LINE_ITEMS = "line_items",
31
+ /** A plain table of text cells. */
32
+ TABLE = "table",
33
+ /** Signature lines for the named parties. */
34
+ SIGNATURE = "signature",
35
+ /** An uploaded image, such as a logo or a diagram. */
36
+ IMAGE = "image",
37
+ /** Starts a new page in the PDF. */
38
+ PAGE_BREAK = "page_break",
39
+ /** Left and right text repeated at the top of every PDF page; one per document. */
40
+ HEADER = "header",
41
+ /** Left and right text repeated at the foot of every PDF page; one per document. */
42
+ FOOTER = "footer",
43
+ /** Two or three columns side by side, each a heading and plain text - "Bill from" and "Bill to". */
44
+ COLUMNS = "columns"
45
+ }
46
+ /** What a variable holds, which decides its input and how its value prints. */
47
+ export declare enum DocumentVariableType {
48
+ TEXT = "text",
49
+ NUMBER = "number",
50
+ /** Integer cents, printed in the document's currency. */
51
+ MONEY = "money",
52
+ /** A calendar date, YYYY-MM-DD, printed like "1 November 2026". */
53
+ DATE = "date"
54
+ }
55
+ /**
56
+ * The variables the api fills in itself, so a template never declares them. A draft shows them
57
+ * live; issuing freezes their values on the document.
58
+ */
59
+ export declare enum DocumentSystemVariable {
60
+ ORGANIZATION_NAME = "organization_name",
61
+ ORGANIZATION_ADDRESS = "organization_address",
62
+ CLIENT_NAME = "client_name",
63
+ CLIENT_EMAIL = "client_email",
64
+ CLIENT_PHONE = "client_phone",
65
+ DOCUMENT_NUMBER = "document_number",
66
+ /** The date the document was issued (today on a draft). */
67
+ ISSUE_DATE = "issue_date",
68
+ /** The issue date's month name and year, for wording such as "Support for October 2026". */
69
+ MONTH = "month",
70
+ YEAR = "year",
71
+ /** The PDF page being printed; only inside a header or footer. */
72
+ PAGE_NUMBER = "page_number",
73
+ /** How many pages the PDF has; only inside a header or footer. */
74
+ PAGE_COUNT = "page_count",
75
+ ORGANIZATION_REGISTRATION_NUMBER = "organization_registration_number",
76
+ ORGANIZATION_VAT_NUMBER = "organization_vat_number",
77
+ ORGANIZATION_EMAIL = "organization_email",
78
+ ORGANIZATION_PHONE = "organization_phone",
79
+ /** The client's address lines, joined as the organization's are. */
80
+ CLIENT_ADDRESS = "client_address",
81
+ CLIENT_REGISTRATION_NUMBER = "client_registration_number",
82
+ CLIENT_VAT_NUMBER = "client_vat_number"
83
+ }
84
+ /** Where a document stands on its public pay page (`GET /pay/:token`). */
85
+ export declare enum DocumentPayStatus {
86
+ /** Issued, in rands, a total above zero, unpaid, and the organization takes payouts. */
87
+ PAYABLE = "payable",
88
+ /** At least one payment has settled. */
89
+ PAID = "paid",
90
+ VOID = "void",
91
+ /** Issued but not payable online: another currency, nothing to pay, or payouts are off. */
92
+ UNAVAILABLE = "unavailable"
93
+ }
94
+ /** How often a recurring document makes its next draft. Stored as plain text. */
95
+ export declare enum DocumentRepeat {
96
+ WEEKLY = "weekly",
97
+ /** The same day each month; a month-end date stays on the last day of the month. */
98
+ MONTHLY = "monthly",
99
+ QUARTERLY = "quarterly",
100
+ YEARLY = "yearly"
101
+ }
102
+ /**
103
+ * Where an issued document's money stands, worked out by the api from its payments: null unless
104
+ * it is issued with a total above zero.
105
+ */
106
+ export declare enum DocumentPaymentStatus {
107
+ UNPAID = "unpaid",
108
+ PAID = "paid",
109
+ /** Two payments settled - two people paid at once; the owner refunds one. */
110
+ PAID_TWICE = "paid_twice"
111
+ }
112
+ /** How one block or variable moved between two saves, as a record's history records it. */
113
+ export declare enum DocumentChangeKind {
114
+ ADDED = "added",
115
+ REMOVED = "removed",
116
+ /** Only its place in the list changed (blocks only). */
117
+ MOVED = "moved",
118
+ /** Its content changed - and, for a block, maybe its place too. */
119
+ CHANGED = "changed"
120
+ }
121
+ /** The documents list's payment filter (`GetDocumentsDto.payment`). */
122
+ export declare enum DocumentPaymentFilter {
123
+ /** Has a settled payment - paid twice included. */
124
+ PAID = "paid",
125
+ /** Issued, a total above zero, and no settled payment yet. */
126
+ UNPAID = "unpaid"
127
+ }
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentPaymentFilter = exports.DocumentChangeKind = exports.DocumentPaymentStatus = exports.DocumentRepeat = exports.DocumentPayStatus = exports.DocumentSystemVariable = exports.DocumentVariableType = exports.DocumentBlockType = exports.DocumentVisibility = exports.DocumentStatus = void 0;
4
+ /** Where a document is in its life. Stored as plain text; the sdk DTO validates it against this list. */
5
+ var DocumentStatus;
6
+ (function (DocumentStatus) {
7
+ /** Editable; no number yet. */
8
+ DocumentStatus["DRAFT"] = "draft";
9
+ /** Numbered and frozen; it never changes again, it can only be voided. */
10
+ DocumentStatus["ISSUED"] = "issued";
11
+ /** Cancelled after issue, with a reason. Kept, never deleted. */
12
+ DocumentStatus["VOID"] = "void";
13
+ })(DocumentStatus || (exports.DocumentStatus = DocumentStatus = {}));
14
+ /**
15
+ * Who sees a template or document. A document made from a template starts with the template's.
16
+ * Stored as plain text; the sdk DTOs validate it against this list.
17
+ */
18
+ var DocumentVisibility;
19
+ (function (DocumentVisibility) {
20
+ /** Everyone in the organization, governed by the documents permissions. */
21
+ DocumentVisibility["ORGANIZATION"] = "organization";
22
+ /** Its creator and the people it is shared with - not the organization's owners or admins. */
23
+ DocumentVisibility["PRIVATE"] = "private";
24
+ })(DocumentVisibility || (exports.DocumentVisibility = DocumentVisibility = {}));
25
+ /**
26
+ * The kinds of block a template or document is built from. A new kind is a member here and a
27
+ * shape in ../index.ts - never a migration, because blocks are stored as JSON.
28
+ */
29
+ var DocumentBlockType;
30
+ (function (DocumentBlockType) {
31
+ /** Rich text: paragraphs, headings, lists, emphasis, links and variables. */
32
+ DocumentBlockType["TEXT"] = "text";
33
+ /** Label and value pairs, such as "Start date: 1 November 2026". */
34
+ DocumentBlockType["FIELDS"] = "fields";
35
+ /** Priced lines with quantity, unit price, discount and tax, and their totals. */
36
+ DocumentBlockType["LINE_ITEMS"] = "line_items";
37
+ /** A plain table of text cells. */
38
+ DocumentBlockType["TABLE"] = "table";
39
+ /** Signature lines for the named parties. */
40
+ DocumentBlockType["SIGNATURE"] = "signature";
41
+ /** An uploaded image, such as a logo or a diagram. */
42
+ DocumentBlockType["IMAGE"] = "image";
43
+ /** Starts a new page in the PDF. */
44
+ DocumentBlockType["PAGE_BREAK"] = "page_break";
45
+ /** Left and right text repeated at the top of every PDF page; one per document. */
46
+ DocumentBlockType["HEADER"] = "header";
47
+ /** Left and right text repeated at the foot of every PDF page; one per document. */
48
+ DocumentBlockType["FOOTER"] = "footer";
49
+ /** Two or three columns side by side, each a heading and plain text - "Bill from" and "Bill to". */
50
+ DocumentBlockType["COLUMNS"] = "columns";
51
+ })(DocumentBlockType || (exports.DocumentBlockType = DocumentBlockType = {}));
52
+ /** What a variable holds, which decides its input and how its value prints. */
53
+ var DocumentVariableType;
54
+ (function (DocumentVariableType) {
55
+ DocumentVariableType["TEXT"] = "text";
56
+ DocumentVariableType["NUMBER"] = "number";
57
+ /** Integer cents, printed in the document's currency. */
58
+ DocumentVariableType["MONEY"] = "money";
59
+ /** A calendar date, YYYY-MM-DD, printed like "1 November 2026". */
60
+ DocumentVariableType["DATE"] = "date";
61
+ })(DocumentVariableType || (exports.DocumentVariableType = DocumentVariableType = {}));
62
+ /**
63
+ * The variables the api fills in itself, so a template never declares them. A draft shows them
64
+ * live; issuing freezes their values on the document.
65
+ */
66
+ var DocumentSystemVariable;
67
+ (function (DocumentSystemVariable) {
68
+ DocumentSystemVariable["ORGANIZATION_NAME"] = "organization_name";
69
+ DocumentSystemVariable["ORGANIZATION_ADDRESS"] = "organization_address";
70
+ DocumentSystemVariable["CLIENT_NAME"] = "client_name";
71
+ DocumentSystemVariable["CLIENT_EMAIL"] = "client_email";
72
+ DocumentSystemVariable["CLIENT_PHONE"] = "client_phone";
73
+ DocumentSystemVariable["DOCUMENT_NUMBER"] = "document_number";
74
+ /** The date the document was issued (today on a draft). */
75
+ DocumentSystemVariable["ISSUE_DATE"] = "issue_date";
76
+ /** The issue date's month name and year, for wording such as "Support for October 2026". */
77
+ DocumentSystemVariable["MONTH"] = "month";
78
+ DocumentSystemVariable["YEAR"] = "year";
79
+ /** The PDF page being printed; only inside a header or footer. */
80
+ DocumentSystemVariable["PAGE_NUMBER"] = "page_number";
81
+ /** How many pages the PDF has; only inside a header or footer. */
82
+ DocumentSystemVariable["PAGE_COUNT"] = "page_count";
83
+ DocumentSystemVariable["ORGANIZATION_REGISTRATION_NUMBER"] = "organization_registration_number";
84
+ DocumentSystemVariable["ORGANIZATION_VAT_NUMBER"] = "organization_vat_number";
85
+ DocumentSystemVariable["ORGANIZATION_EMAIL"] = "organization_email";
86
+ DocumentSystemVariable["ORGANIZATION_PHONE"] = "organization_phone";
87
+ /** The client's address lines, joined as the organization's are. */
88
+ DocumentSystemVariable["CLIENT_ADDRESS"] = "client_address";
89
+ DocumentSystemVariable["CLIENT_REGISTRATION_NUMBER"] = "client_registration_number";
90
+ DocumentSystemVariable["CLIENT_VAT_NUMBER"] = "client_vat_number";
91
+ })(DocumentSystemVariable || (exports.DocumentSystemVariable = DocumentSystemVariable = {}));
92
+ /** Where a document stands on its public pay page (`GET /pay/:token`). */
93
+ var DocumentPayStatus;
94
+ (function (DocumentPayStatus) {
95
+ /** Issued, in rands, a total above zero, unpaid, and the organization takes payouts. */
96
+ DocumentPayStatus["PAYABLE"] = "payable";
97
+ /** At least one payment has settled. */
98
+ DocumentPayStatus["PAID"] = "paid";
99
+ DocumentPayStatus["VOID"] = "void";
100
+ /** Issued but not payable online: another currency, nothing to pay, or payouts are off. */
101
+ DocumentPayStatus["UNAVAILABLE"] = "unavailable";
102
+ })(DocumentPayStatus || (exports.DocumentPayStatus = DocumentPayStatus = {}));
103
+ /** How often a recurring document makes its next draft. Stored as plain text. */
104
+ var DocumentRepeat;
105
+ (function (DocumentRepeat) {
106
+ DocumentRepeat["WEEKLY"] = "weekly";
107
+ /** The same day each month; a month-end date stays on the last day of the month. */
108
+ DocumentRepeat["MONTHLY"] = "monthly";
109
+ DocumentRepeat["QUARTERLY"] = "quarterly";
110
+ DocumentRepeat["YEARLY"] = "yearly";
111
+ })(DocumentRepeat || (exports.DocumentRepeat = DocumentRepeat = {}));
112
+ /**
113
+ * Where an issued document's money stands, worked out by the api from its payments: null unless
114
+ * it is issued with a total above zero.
115
+ */
116
+ var DocumentPaymentStatus;
117
+ (function (DocumentPaymentStatus) {
118
+ DocumentPaymentStatus["UNPAID"] = "unpaid";
119
+ DocumentPaymentStatus["PAID"] = "paid";
120
+ /** Two payments settled - two people paid at once; the owner refunds one. */
121
+ DocumentPaymentStatus["PAID_TWICE"] = "paid_twice";
122
+ })(DocumentPaymentStatus || (exports.DocumentPaymentStatus = DocumentPaymentStatus = {}));
123
+ /** How one block or variable moved between two saves, as a record's history records it. */
124
+ var DocumentChangeKind;
125
+ (function (DocumentChangeKind) {
126
+ DocumentChangeKind["ADDED"] = "added";
127
+ DocumentChangeKind["REMOVED"] = "removed";
128
+ /** Only its place in the list changed (blocks only). */
129
+ DocumentChangeKind["MOVED"] = "moved";
130
+ /** Its content changed - and, for a block, maybe its place too. */
131
+ DocumentChangeKind["CHANGED"] = "changed";
132
+ })(DocumentChangeKind || (exports.DocumentChangeKind = DocumentChangeKind = {}));
133
+ /** The documents list's payment filter (`GetDocumentsDto.payment`). */
134
+ var DocumentPaymentFilter;
135
+ (function (DocumentPaymentFilter) {
136
+ /** Has a settled payment - paid twice included. */
137
+ DocumentPaymentFilter["PAID"] = "paid";
138
+ /** Issued, a total above zero, and no settled payment yet. */
139
+ DocumentPaymentFilter["UNPAID"] = "unpaid";
140
+ })(DocumentPaymentFilter || (exports.DocumentPaymentFilter = DocumentPaymentFilter = {}));