@kevludwig/lexware-office 0.1.3 → 0.1.4
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/reminders.d.ts +28 -0
- package/dist/reminders.js +18 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { DEFAULT_APP_URL, DEFAULT_BASE_URL, LexwareApiError, createLexwareClient
|
|
|
2
2
|
export { contactEmail, createCustomer, findContactByNumber, findContactsByName, MIN_NAME_SEARCH_LENGTH, getContact, resolveContactByName, type Contact, type CreatedCustomer, type NewCustomer, } from "./contacts.ts";
|
|
3
3
|
export { addDays, berlinDay, daysSince } from "./dates.ts";
|
|
4
4
|
export { downloadInvoicePdf, findOverdueInvoice, findOverdueInvoices, type OverdueInvoice, } from "./receivables.ts";
|
|
5
|
-
export { DEFAULT_REMINDER_POLICY, daysPastReminderDue, earliestReminderDate, isDueImmediately, isOpenForReminder, reminderDueDate, reminderLedger, selectDueReminders, type DueReminder, type ReminderHold, type ReminderLedger, type ReminderPolicy, type ReminderRecord, type ReminderSelection, type ReminderStatus, mailContentSha256, sendReminder, type ReminderTarget, type SendReminderOutcome, } from "./reminders.ts";
|
|
5
|
+
export { DEFAULT_REMINDER_POLICY, daysPastReminderDue, earliestReminderDate, isDueImmediately, isOpenForReminder, reminderDueDate, reminderLedger, selectDueReminders, type DueReminder, type ReminderHold, type ReminderLedger, type ReminderPolicy, type ReminderRecord, type ReminderSelection, type ReminderStatus, mailContentSha256, paymentReminderEffect, sendReminder, type PaymentReminderEffect, type ReminderTarget, type SendReminderOutcome, } from "./reminders.ts";
|
|
6
6
|
export { MailNotSentError, defaultReminderMail, reminderSubject, type ReminderMail, type ReminderMailData, type ReminderSender, type RenderReminderMail, type SendReminderMail, } from "./reminder-mail.ts";
|
|
7
7
|
export { keySegment, memoryStore, type JsonStore } from "./store.ts";
|
|
8
8
|
export { DUPLICATE_TOTAL_TOLERANCE, ITEMS_TOTAL_TOLERANCE, netTotal, round2, taxFromGross, taxFromNet, type PricedLine, } from "./money.ts";
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { DEFAULT_APP_URL, DEFAULT_BASE_URL, LexwareApiError, createLexwareClient
|
|
|
2
2
|
export { contactEmail, createCustomer, findContactByNumber, findContactsByName, MIN_NAME_SEARCH_LENGTH, getContact, resolveContactByName, } from "./contacts.js";
|
|
3
3
|
export { addDays, berlinDay, daysSince } from "./dates.js";
|
|
4
4
|
export { downloadInvoicePdf, findOverdueInvoice, findOverdueInvoices, } from "./receivables.js";
|
|
5
|
-
export { DEFAULT_REMINDER_POLICY, daysPastReminderDue, earliestReminderDate, isDueImmediately, isOpenForReminder, reminderDueDate, reminderLedger, selectDueReminders, mailContentSha256, sendReminder, } from "./reminders.js";
|
|
5
|
+
export { DEFAULT_REMINDER_POLICY, daysPastReminderDue, earliestReminderDate, isDueImmediately, isOpenForReminder, reminderDueDate, reminderLedger, selectDueReminders, mailContentSha256, paymentReminderEffect, sendReminder, } from "./reminders.js";
|
|
6
6
|
export { MailNotSentError, defaultReminderMail, reminderSubject, } from "./reminder-mail.js";
|
|
7
7
|
export { keySegment, memoryStore } from "./store.js";
|
|
8
8
|
export { DUPLICATE_TOTAL_TOLERANCE, ITEMS_TOTAL_TOLERANCE, netTotal, round2, taxFromGross, taxFromNet, } from "./money.js";
|
package/dist/reminders.d.ts
CHANGED
|
@@ -140,6 +140,34 @@ export type SendReminderOutcome = {
|
|
|
140
140
|
sent: false;
|
|
141
141
|
reason: "paid" | "taken";
|
|
142
142
|
};
|
|
143
|
+
/**
|
|
144
|
+
* What a sent payment reminder did, in a fixed shape an app's protocol keeps
|
|
145
|
+
* as it is. `amount` and `contentSha256` are null only when the effect is
|
|
146
|
+
* reconstructed after the fact and they are no longer known — never guessed.
|
|
147
|
+
*/
|
|
148
|
+
export interface PaymentReminderEffect {
|
|
149
|
+
kind: "payment_reminder";
|
|
150
|
+
to: string;
|
|
151
|
+
cc: string[];
|
|
152
|
+
test: boolean;
|
|
153
|
+
/** The invoice's voucher number. */
|
|
154
|
+
invoice: string;
|
|
155
|
+
invoiceId: string;
|
|
156
|
+
/** The open amount the mail stated. */
|
|
157
|
+
amount: number | null;
|
|
158
|
+
currency: string;
|
|
159
|
+
/** sha256 of the mail's content, see mailContentSha256. */
|
|
160
|
+
contentSha256: string | null;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The effect of a reminder sent to `target`. Pass the send's outcome; pass
|
|
164
|
+
* null to reconstruct it from the target alone, which leaves amount and hash
|
|
165
|
+
* unknown (null).
|
|
166
|
+
*/
|
|
167
|
+
export declare function paymentReminderEffect(target: ReminderTarget, sent: {
|
|
168
|
+
openAmount: number;
|
|
169
|
+
contentSha256: string;
|
|
170
|
+
} | null): PaymentReminderEffect;
|
|
143
171
|
/**
|
|
144
172
|
* Sends one reminder, at most once per round: re-checks that the invoice is
|
|
145
173
|
* still overdue, claims the round, renders and sends with the invoice PDF,
|
package/dist/reminders.js
CHANGED
|
@@ -122,6 +122,24 @@ export async function selectDueReminders(client, ledger, options = {}) {
|
|
|
122
122
|
held: checked.flatMap(({ invoice, hold }) => (hold ? [{ invoice, hold }] : [])),
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* The effect of a reminder sent to `target`. Pass the send's outcome; pass
|
|
127
|
+
* null to reconstruct it from the target alone, which leaves amount and hash
|
|
128
|
+
* unknown (null).
|
|
129
|
+
*/
|
|
130
|
+
export function paymentReminderEffect(target, sent) {
|
|
131
|
+
return {
|
|
132
|
+
kind: "payment_reminder",
|
|
133
|
+
to: target.to,
|
|
134
|
+
cc: [...(target.cc ?? [])],
|
|
135
|
+
test: target.test,
|
|
136
|
+
invoice: target.voucherNumber,
|
|
137
|
+
invoiceId: target.invoiceId,
|
|
138
|
+
amount: sent?.openAmount ?? null,
|
|
139
|
+
currency: target.currency,
|
|
140
|
+
contentSha256: sent?.contentSha256 ?? null,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
125
143
|
/**
|
|
126
144
|
* Sends one reminder, at most once per round: re-checks that the invoice is
|
|
127
145
|
* still overdue, claims the round, renders and sends with the invoice PDF,
|
package/package.json
CHANGED