sinfactura-types 1.10.331 → 1.10.333

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.
@@ -27,6 +27,23 @@ declare global {
27
27
  * a mutation of this one, so the original booking's history survives.
28
28
  */
29
29
  type AppointmentStatus = 'REQUESTED' | 'CONFIRMED' | 'CHECKED_IN' | 'IN_PROGRESS' | 'COMPLETED' | 'CANCELLED' | 'NO_SHOW' | 'RESCHEDULED';
30
+ /**
31
+ * Why a `CANCELLED` booking is not an ordinary cancellation — see
32
+ * {@link Appointment.cancelReason}, which carries the full rule.
33
+ *
34
+ * - `'recurrence-exception'` — the operator added this date to the series'
35
+ * skip list («omitir fechas»). Omitting a date from a series is not a
36
+ * cancellation of a booking, and a client must not toast it as one.
37
+ *
38
+ * ⚠️ **Type-only, deliberately — unlike {@link SERIES_SCOPES} and
39
+ * `APPOINTMENT_ICS_FEED_SCOPES`, which are runtime tuples.** Those two are
40
+ * INBOUND vocabularies: a string arrives from outside the type system and has
41
+ * to be tested for membership. This one is written by the api and only ever
42
+ * read, so there is nothing to validate at runtime and a published tuple
43
+ * would invite a client to treat the set as closed — which is the opposite of
44
+ * the "treat an unrecognised member as non-ordinary" rule above.
45
+ */
46
+ type AppointmentCancelReason = 'recurrence-exception';
30
47
  /**
31
48
  * A scheduled booking. Phase 1 is an INTERNAL operations tool: every frame
32
49
  * is operator-audience, and no customer-facing booking surface consumes
@@ -180,6 +197,38 @@ declare global {
180
197
  rescheduledFrom?: string;
181
198
  cancelledAt?: number;
182
199
  cancelledBy?: string;
200
+ /**
201
+ * WHY this booking was cancelled, where the cause is not an ordinary
202
+ * cancellation.
203
+ *
204
+ * ⚠️ **Absence is the meaningful value: no `cancelReason` means a REAL
205
+ * cancellation** — the operator (or the customer) dropped this booking, and
206
+ * a client should notify exactly as it always has. The field exists because
207
+ * a `CANCELLED` row alone cannot distinguish that from a series being
208
+ * reshaped, so every other operator on the store socket got told "an
209
+ * appointment was cancelled" for a date that was merely omitted.
210
+ *
211
+ * ⚠️ **Written by exactly ONE path**: the skip-list leg of
212
+ * `POST /appointments/{id}` with `scope: 'series'` — adding a date to
213
+ * {@link Appointment.recurrenceExceptions} cancels the live occurrence
214
+ * standing on it and stamps `'recurrence-exception'`. Every other cancel
215
+ * writer (the operator `DELETE`, the customer-facing web `DELETE`, a scoped
216
+ * status edit) leaves the attribute ABSENT rather than writing a default, so
217
+ * a row without it is not a row whose reason was lost.
218
+ *
219
+ * ⚠️ **Forward-only** — rows cancelled before this shipped carry nothing,
220
+ * and nothing backfills them. A historical `CANCELLED` occurrence of a
221
+ * skipped date is therefore indistinguishable from a real cancellation, by
222
+ * design.
223
+ *
224
+ * ⚠️ **NOT `cancelledBy`**, which is the ACTOR's user id and is stamped on
225
+ * every cancellation including this one. Who, and why, are two fields.
226
+ *
227
+ * A union rather than a single literal so a future cause is additive; treat
228
+ * an unrecognised member as "some non-ordinary cause" rather than falling
229
+ * back to the cancellation toast.
230
+ */
231
+ cancelReason?: AppointmentCancelReason;
183
232
  checkedInAt?: number;
184
233
  completedAt?: number;
185
234
  createdAt: number;
@@ -799,6 +799,60 @@ declare global {
799
799
  */
800
800
  complete: boolean;
801
801
  }
802
+ /**
803
+ * The channel one `POST /marketing/copy` request generates for.
804
+ *
805
+ * ⚠️ ONE channel per request, and `'email'` ONLY in v1 — the storefront and
806
+ * social channels are separate, independently shippable widenings. Keeping
807
+ * the field singular (never an array) is what makes adding a member additive
808
+ * for every existing caller: a widened union cannot change the shape of a
809
+ * request that already names `'email'`.
810
+ *
811
+ * ⚠️ Distinct from {@link CampaignChannel}, which is a DELIVERY channel. A
812
+ * generated suggestion is never sent by this endpoint, so the two vocabularies
813
+ * are free to diverge and must not be merged.
814
+ */
815
+ type MarketingCopyChannel = 'email';
816
+ /** Register of the generated copy. es-AR voseo regardless of tone. */
817
+ type MarketingCopyTone = 'neutral' | 'friendly' | 'urgent';
818
+ interface MarketingCopySuggestion {
819
+ /**
820
+ * SEGMENT-WIDE copy, never personalised text — and never a placeholder
821
+ * either.
822
+ *
823
+ * ⚠️ **There is no send-time substitution anywhere on this platform.** The
824
+ * campaign worker mails a template's subject and body exactly as stored, so
825
+ * a `{{nombre}}` here would be delivered as those literal characters to
826
+ * every recipient. The generator refuses any `{{…}}` for that reason, and
827
+ * the copy is written to read correctly with no recipient name at all.
828
+ * Carrying no person is also what makes one generation reusable across a
829
+ * whole segment.
830
+ *
831
+ * Email only; a channel with no subject line omits it.
832
+ */
833
+ subject?: string;
834
+ /** Segment-wide copy, same rule as {@link MarketingCopySuggestion.subject}. */
835
+ body: string;
836
+ /**
837
+ * Every factual claim the copy makes, each VERBATIM from the grounding
838
+ * source the tenant supplied.
839
+ *
840
+ * ⚠️ A claim the source does not contain is DROPPED server-side rather than
841
+ * returned flagged, so an empty array means the copy asserts no facts — not
842
+ * that the belt was skipped.
843
+ */
844
+ claims: string[];
845
+ }
846
+ interface MarketingCopyResponse {
847
+ channel: MarketingCopyChannel;
848
+ tone: MarketingCopyTone;
849
+ suggestions: MarketingCopySuggestion[];
850
+ /**
851
+ * `true` when the response came from the tenant's own response cache and
852
+ * SPENT NOTHING — no ceiling read, no model call, no meter write.
853
+ */
854
+ cached: boolean;
855
+ }
802
856
  }
803
857
  /**
804
858
  * The {@link AutomationTrigger} vocabulary as a RUNTIME value, so the api's Zod
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.331",
3
+ "version": "1.10.333",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",