sinfactura-types 1.10.419 → 1.10.421

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.
@@ -431,6 +431,12 @@ declare global {
431
431
  * its slotting settings survive being switched off and back on.
432
432
  */
433
433
  enabled?: boolean;
434
+ /**
435
+ * How many days after today (Buenos Aires) a SHOPPER may book this type, or
436
+ * move a booking to. Absent or `0` means no limit. Staff are never bound by
437
+ * it, and the customer availability read stops at the same day.
438
+ */
439
+ maxAdvanceDays?: number;
434
440
  }
435
441
  /**
436
442
  * A generated, potentially-bookable window from
@@ -871,6 +877,19 @@ declare global {
871
877
  * waiting for no-shows to leave the window, or by staff lifting the block
872
878
  * (`POST /appointments/no-show-policy/lift`); never raised by the operator
873
879
  * create route.
880
+ * - `APPOINTMENT_OUTSIDE_WORKING_HOURS` · 409 — CUSTOMER create and reschedule
881
+ * only: the window is not a slot the type's weekly hours or an `EXTRA_HOURS`
882
+ * override generate that day. A type with no config has no hours, so every
883
+ * customer booking of it refuses; staff routes never raise this.
884
+ * - `APPOINTMENT_TOO_FAR_AHEAD` · 409 — CUSTOMER create and reschedule only:
885
+ * the date is past the type's `maxAdvanceDays` horizon.
886
+ * - `APPOINTMENT_ORDER_NOT_FOUND` · 404 — CUSTOMER create with an `orderId`
887
+ * that is not the caller's own order in this store. Someone else's order
888
+ * answers the same way on purpose.
889
+ * - `APPOINTMENT_ORDER_NOT_SCHEDULABLE` · 409 — the caller's order is
890
+ * cancelled, disabled or already delivered.
891
+ * - `APPOINTMENT_ORDER_ALREADY_SCHEDULED` · 409 — the order already carries a
892
+ * turno; reschedule that one instead.
874
893
  * - `APPOINTMENT_STATUS_TRANSITION_ILLEGAL` · 409
875
894
  * - `APPOINTMENT_VERSION_CONFLICT` · 409 — re-read and retry.
876
895
  * - `APPOINTMENT_RESCHEDULE_NOOP` · 400 — the new window equals the old one.
@@ -935,7 +954,7 @@ declare global {
935
954
  * `GET /availability`, an operator queuing a party against a full slot rather
936
955
  * than configuring the schedule — so its five refusals are listed above.
937
956
  */
938
- export declare const APPOINTMENT_ERROR_CODES: readonly ["APPOINTMENT_NOT_FOUND", "APPOINTMENT_ID_REQUIRED", "APPOINTMENT_TYPE_DISABLED", "APPOINTMENT_SLOT_UNAVAILABLE", "APPOINTMENT_LEAD_TIME_NOT_MET", "APPOINTMENT_SELF_BOOKING_BLOCKED", "APPOINTMENT_CANCEL_CUTOFF_PASSED", "APPOINTMENT_STATUS_TRANSITION_ILLEGAL", "APPOINTMENT_VERSION_CONFLICT", "APPOINTMENT_RESCHEDULE_NOOP", "APPOINTMENT_WAITLIST_PARTY_REQUIRED", "APPOINTMENT_WAITLIST_SLOT_AVAILABLE", "APPOINTMENT_WAITLIST_ALREADY_JOINED", "APPOINTMENT_WAITLIST_FULL", "APPOINTMENT_WAITLIST_ENTRY_NOT_FOUND", "INVALID_CURSOR", "RECURRENCE_RULE_MALFORMED", "RECURRENCE_RULE_UNSUPPORTED", "RECURRENCE_UNBOUNDED", "RECURRENCE_TOO_MANY", "APPOINTMENT_NOT_IN_SERIES", "RECURRENCE_SCOPE_REQUIRES_RULE_EDIT", "APPOINTMENT_STATUS_NOT_SCOPEABLE", "RECURRENCE_EXCEPTIONS_UNSUPPORTED", "RECURRENCE_EXCEPTIONS_SCOPE_REQUIRED", "VALIDATION_FAILED", "ROLE_FORBIDDEN", "APPOINTMENT_FEED_SECRET_NOT_CONFIGURED", "APPOINTMENT_FEED_IDENTITY_INVALID"];
957
+ export declare const APPOINTMENT_ERROR_CODES: readonly ["APPOINTMENT_NOT_FOUND", "APPOINTMENT_ID_REQUIRED", "APPOINTMENT_TYPE_DISABLED", "APPOINTMENT_SLOT_UNAVAILABLE", "APPOINTMENT_LEAD_TIME_NOT_MET", "APPOINTMENT_SELF_BOOKING_BLOCKED", "APPOINTMENT_CANCEL_CUTOFF_PASSED", "APPOINTMENT_OUTSIDE_WORKING_HOURS", "APPOINTMENT_TOO_FAR_AHEAD", "APPOINTMENT_ORDER_NOT_FOUND", "APPOINTMENT_ORDER_NOT_SCHEDULABLE", "APPOINTMENT_ORDER_ALREADY_SCHEDULED", "APPOINTMENT_STATUS_TRANSITION_ILLEGAL", "APPOINTMENT_VERSION_CONFLICT", "APPOINTMENT_RESCHEDULE_NOOP", "APPOINTMENT_WAITLIST_PARTY_REQUIRED", "APPOINTMENT_WAITLIST_SLOT_AVAILABLE", "APPOINTMENT_WAITLIST_ALREADY_JOINED", "APPOINTMENT_WAITLIST_FULL", "APPOINTMENT_WAITLIST_ENTRY_NOT_FOUND", "INVALID_CURSOR", "RECURRENCE_RULE_MALFORMED", "RECURRENCE_RULE_UNSUPPORTED", "RECURRENCE_UNBOUNDED", "RECURRENCE_TOO_MANY", "APPOINTMENT_NOT_IN_SERIES", "RECURRENCE_SCOPE_REQUIRES_RULE_EDIT", "APPOINTMENT_STATUS_NOT_SCOPEABLE", "RECURRENCE_EXCEPTIONS_UNSUPPORTED", "RECURRENCE_EXCEPTIONS_SCOPE_REQUIRED", "VALIDATION_FAILED", "ROLE_FORBIDDEN", "APPOINTMENT_FEED_SECRET_NOT_CONFIGURED", "APPOINTMENT_FEED_IDENTITY_INVALID"];
939
958
  export type AppointmentErrorCode = (typeof APPOINTMENT_ERROR_CODES)[number];
940
959
  /**
941
960
  * Which occurrences of a recurring booking an edit applies to —
@@ -24,6 +24,19 @@
24
24
  * waiting for no-shows to leave the window, or by staff lifting the block
25
25
  * (`POST /appointments/no-show-policy/lift`); never raised by the operator
26
26
  * create route.
27
+ * - `APPOINTMENT_OUTSIDE_WORKING_HOURS` · 409 — CUSTOMER create and reschedule
28
+ * only: the window is not a slot the type's weekly hours or an `EXTRA_HOURS`
29
+ * override generate that day. A type with no config has no hours, so every
30
+ * customer booking of it refuses; staff routes never raise this.
31
+ * - `APPOINTMENT_TOO_FAR_AHEAD` · 409 — CUSTOMER create and reschedule only:
32
+ * the date is past the type's `maxAdvanceDays` horizon.
33
+ * - `APPOINTMENT_ORDER_NOT_FOUND` · 404 — CUSTOMER create with an `orderId`
34
+ * that is not the caller's own order in this store. Someone else's order
35
+ * answers the same way on purpose.
36
+ * - `APPOINTMENT_ORDER_NOT_SCHEDULABLE` · 409 — the caller's order is
37
+ * cancelled, disabled or already delivered.
38
+ * - `APPOINTMENT_ORDER_ALREADY_SCHEDULED` · 409 — the order already carries a
39
+ * turno; reschedule that one instead.
27
40
  * - `APPOINTMENT_STATUS_TRANSITION_ILLEGAL` · 409
28
41
  * - `APPOINTMENT_VERSION_CONFLICT` · 409 — re-read and retry.
29
42
  * - `APPOINTMENT_RESCHEDULE_NOOP` · 400 — the new window equals the old one.
@@ -96,6 +109,11 @@ export const APPOINTMENT_ERROR_CODES = [
96
109
  'APPOINTMENT_LEAD_TIME_NOT_MET',
97
110
  'APPOINTMENT_SELF_BOOKING_BLOCKED',
98
111
  'APPOINTMENT_CANCEL_CUTOFF_PASSED',
112
+ 'APPOINTMENT_OUTSIDE_WORKING_HOURS',
113
+ 'APPOINTMENT_TOO_FAR_AHEAD',
114
+ 'APPOINTMENT_ORDER_NOT_FOUND',
115
+ 'APPOINTMENT_ORDER_NOT_SCHEDULABLE',
116
+ 'APPOINTMENT_ORDER_ALREADY_SCHEDULED',
99
117
  'APPOINTMENT_STATUS_TRANSITION_ILLEGAL',
100
118
  'APPOINTMENT_VERSION_CONFLICT',
101
119
  'APPOINTMENT_RESCHEDULE_NOOP',
@@ -27,6 +27,19 @@ exports.APPOINTMENT_ICS_FEED_DAYS_AHEAD = exports.APPOINTMENT_ICS_FEED_DAYS_BACK
27
27
  * waiting for no-shows to leave the window, or by staff lifting the block
28
28
  * (`POST /appointments/no-show-policy/lift`); never raised by the operator
29
29
  * create route.
30
+ * - `APPOINTMENT_OUTSIDE_WORKING_HOURS` · 409 — CUSTOMER create and reschedule
31
+ * only: the window is not a slot the type's weekly hours or an `EXTRA_HOURS`
32
+ * override generate that day. A type with no config has no hours, so every
33
+ * customer booking of it refuses; staff routes never raise this.
34
+ * - `APPOINTMENT_TOO_FAR_AHEAD` · 409 — CUSTOMER create and reschedule only:
35
+ * the date is past the type's `maxAdvanceDays` horizon.
36
+ * - `APPOINTMENT_ORDER_NOT_FOUND` · 404 — CUSTOMER create with an `orderId`
37
+ * that is not the caller's own order in this store. Someone else's order
38
+ * answers the same way on purpose.
39
+ * - `APPOINTMENT_ORDER_NOT_SCHEDULABLE` · 409 — the caller's order is
40
+ * cancelled, disabled or already delivered.
41
+ * - `APPOINTMENT_ORDER_ALREADY_SCHEDULED` · 409 — the order already carries a
42
+ * turno; reschedule that one instead.
30
43
  * - `APPOINTMENT_STATUS_TRANSITION_ILLEGAL` · 409
31
44
  * - `APPOINTMENT_VERSION_CONFLICT` · 409 — re-read and retry.
32
45
  * - `APPOINTMENT_RESCHEDULE_NOOP` · 400 — the new window equals the old one.
@@ -99,6 +112,11 @@ exports.APPOINTMENT_ERROR_CODES = [
99
112
  'APPOINTMENT_LEAD_TIME_NOT_MET',
100
113
  'APPOINTMENT_SELF_BOOKING_BLOCKED',
101
114
  'APPOINTMENT_CANCEL_CUTOFF_PASSED',
115
+ 'APPOINTMENT_OUTSIDE_WORKING_HOURS',
116
+ 'APPOINTMENT_TOO_FAR_AHEAD',
117
+ 'APPOINTMENT_ORDER_NOT_FOUND',
118
+ 'APPOINTMENT_ORDER_NOT_SCHEDULABLE',
119
+ 'APPOINTMENT_ORDER_ALREADY_SCHEDULED',
102
120
  'APPOINTMENT_STATUS_TRANSITION_ILLEGAL',
103
121
  'APPOINTMENT_VERSION_CONFLICT',
104
122
  'APPOINTMENT_RESCHEDULE_NOOP',
@@ -20,9 +20,11 @@ declare global {
20
20
  *
21
21
  * ⚠️ `'transactional'` is the bulk of the population — an invoice copy, an
22
22
  * order confirmation, a receipt. `'reminder'` is a deliberate collections
23
- * chase, and it has exactly ONE producer: the operator-triggered dunning
24
- * send. Nothing automatic writes it, so a `'reminder'` row always means a
25
- * person decided to chase this customer.
23
+ * chase, written by ONE consumer (the dunning send) for TWO triggers: an
24
+ * operator's click, and the store's own opt-in automatic cadence
25
+ * (`Store.config.paymentReminders`). A `'reminder'` row therefore means the
26
+ * customer WAS chased, not that a person decided to — `userId` is present
27
+ * exactly when a person did, and absent on an automatic chase.
26
28
  *
27
29
  * ⚠️ This discriminant is the whole reason `Customer.lastReminderAt` can be
28
30
  * trusted. Feeding that field from transactional sends would tell a
@@ -78,8 +80,9 @@ declare global {
78
80
  to: string;
79
81
  /**
80
82
  * The staff member who caused the send, when there was one. ABSENT for a
81
- * queue-triggered transactional send, which has no acting user — do not
82
- * read absence as a system identity.
83
+ * queue-triggered transactional send and for an automatic payment
84
+ * reminder, neither of which has an acting user — do not read absence as
85
+ * a system identity.
83
86
  */
84
87
  userId?: string;
85
88
  /** Denormalized at write time so the row survives a rename, as the activity trail does. */
package/dist/store.d.ts CHANGED
@@ -161,6 +161,34 @@ declare global {
161
161
  interface ReportDigestConfig {
162
162
  frequency: 'none' | 'daily' | 'weekly' | 'monthly';
163
163
  }
164
+ /**
165
+ * The store's opt-in for AUTOMATIC payment-reminder emails to customers who
166
+ * owe it money. ABSENT, or `frequency` absent or `'none'`, means nothing
167
+ * automatic is ever sent — a store row predating the field must never start
168
+ * chasing its customers because a field appeared.
169
+ *
170
+ * - `frequency` — `'weekly'` chases on Mondays, `'monthly'` on the 1st, both
171
+ * in Buenos Aires time; each customer is chased at most once per period.
172
+ * - `minBalance` — only a customer whose `balance` is at least this much is
173
+ * chased. Absent means any positive balance.
174
+ * - `minAgeDays` — only a customer whose OLDEST still-open tracked debit is at
175
+ * least this many days old is chased. ⚠️ A debt the open-debit summary
176
+ * cannot age (arrears predating the summary, or a capped summary) proves no
177
+ * age, so a store that sets this does not auto-chase such a customer — the
178
+ * operator can still chase them by hand.
179
+ *
180
+ * ⚠️ A customer who complains about (marks as spam) an automatic reminder
181
+ * stops receiving AUTOMATIC reminders; one the shop sends by hand still goes.
182
+ * There is no customer-facing opt-out switch.
183
+ *
184
+ * The chase is gated on the `advancedReports` entitlement, resolved per store
185
+ * at send time and failing CLOSED.
186
+ */
187
+ interface PaymentRemindersConfig {
188
+ frequency?: 'none' | 'weekly' | 'monthly';
189
+ minBalance?: number;
190
+ minAgeDays?: number;
191
+ }
164
192
  /**
165
193
  * Cut-offs and window for the periodic ABC (Pareto) classification of the
166
194
  * catalogue. Every member is optional and absence falls back to the api's
@@ -467,6 +495,16 @@ declare global {
467
495
  * send to everyone.
468
496
  */
469
497
  reportDigest?: ReportDigestConfig;
498
+ /**
499
+ * Automatic payment reminders to the store's debtors — see
500
+ * `PaymentRemindersConfig`. Opt-in: absent sends nothing.
501
+ *
502
+ * ⚠️ Writable at the PRIVILEGED tier, like `reportDigest` above — it
503
+ * decides whether the platform emails the store's customers about money
504
+ * on the store's behalf, so it is an ADMIN/SUPERVISOR/MANAGER setting
505
+ * with a `STORE_CONFIG_FORBIDDEN` refusal, never a per-user preference.
506
+ */
507
+ paymentReminders?: PaymentRemindersConfig;
470
508
  /**
471
509
  * Cut-offs and window for the periodic ABC classification job.
472
510
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.419",
3
+ "version": "1.10.421",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",