@vectoriox/iox-ui 5.132.0 → 5.134.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 (81) hide show
  1. package/commerce-core/index.d.ts +12 -1
  2. package/composite-core/index.d.ts +44 -22
  3. package/design-core/index.d.ts +436 -35
  4. package/domain-core/index.d.ts +353 -0
  5. package/domain-core/package.json +3 -0
  6. package/fesm2022/vectoriox-iox-ui-actions-core.mjs +2 -0
  7. package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
  8. package/fesm2022/vectoriox-iox-ui-assist-core.mjs +6 -48
  9. package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
  10. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +21 -0
  11. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
  12. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +118 -62
  13. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  14. package/fesm2022/vectoriox-iox-ui-design-core.mjs +895 -416
  15. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  16. package/fesm2022/vectoriox-iox-ui-domain-core.mjs +422 -0
  17. package/fesm2022/vectoriox-iox-ui-domain-core.mjs.map +1 -0
  18. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +13974 -12036
  19. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  20. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +9 -3
  21. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  22. package/fesm2022/vectoriox-iox-ui-mail-core.mjs +288 -2
  23. package/fesm2022/vectoriox-iox-ui-mail-core.mjs.map +1 -1
  24. package/fesm2022/vectoriox-iox-ui.mjs +290 -16
  25. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  26. package/generation-core/index.d.ts +1419 -379
  27. package/harness-core/index.d.ts +6 -1
  28. package/index.d.ts +139 -10
  29. package/mail-core/index.d.ts +315 -39
  30. package/package.json +5 -1
  31. package/src/actions-core/element-actions.ts +2 -0
  32. package/src/assist-core/page-sections.ts +7 -37
  33. package/src/commerce-core/shop-display.ts +21 -0
  34. package/src/composite-core/consent.ts +6 -2
  35. package/src/composite-core/shop-runtime.ts +47 -3
  36. package/src/composite-core/shop.ts +76 -57
  37. package/src/design-core/design-settings.ts +16 -0
  38. package/src/design-core/design-token.model.ts +7 -1
  39. package/src/design-core/flavor-spec.generated.ts +374 -35
  40. package/src/design-core/flavor-tokens.ts +12 -1
  41. package/src/design-core/header-behaviour.ts +32 -0
  42. package/src/design-core/motion-language.ts +115 -0
  43. package/src/design-core/public-api.ts +1 -0
  44. package/src/design-core/style-presets.ts +3 -0
  45. package/src/domain-core/domain-vocabulary.ts +125 -0
  46. package/src/domain-core/domain-wire.ts +95 -0
  47. package/src/domain-core/org-path-redirect.ts +105 -0
  48. package/src/domain-core/public-api.ts +12 -0
  49. package/src/domain-core/web-domain.ts +251 -0
  50. package/src/generation-core/carry-fill.ts +36 -0
  51. package/src/generation-core/carry.ts +398 -0
  52. package/src/generation-core/check-carry.ts +216 -0
  53. package/src/generation-core/check-layout.ts +71 -5
  54. package/src/generation-core/compose-layout.ts +187 -28
  55. package/src/generation-core/compose-site.ts +154 -31
  56. package/src/generation-core/entrances.ts +66 -10
  57. package/src/generation-core/header-edit.ts +299 -0
  58. package/src/generation-core/header-mix.ts +64 -5
  59. package/src/generation-core/layout-fingerprint.ts +5 -1
  60. package/src/generation-core/layout-language.ts +20 -1
  61. package/src/generation-core/layout-space.ts +4 -4
  62. package/src/generation-core/layout-wire.ts +36 -1
  63. package/src/generation-core/node-baselines.generated.ts +1 -0
  64. package/src/generation-core/public-api.ts +7 -0
  65. package/src/generation-core/redesign-additions.ts +273 -0
  66. package/src/generation-core/redesign-run.ts +364 -0
  67. package/src/generation-core/refit-page.ts +151 -0
  68. package/src/generation-core/section-stamp.ts +4 -4
  69. package/src/generation-core/shop-plan.ts +15 -0
  70. package/src/generation-core/site-build-run.ts +20 -3
  71. package/src/generation-core/site-spec.generated.ts +194 -94
  72. package/src/generation-core/site-tree.ts +19 -5
  73. package/src/generation-core/validate-site-plan.ts +37 -3
  74. package/src/harness-core/motion.ts +13 -3
  75. package/src/harness-core/starting-design.ts +1 -1
  76. package/src/mail-core/mail-domain.ts +305 -0
  77. package/src/mail-core/mail-standing.ts +58 -0
  78. package/src/mail-core/mail-vocabulary.ts +3 -0
  79. package/src/mail-core/mail-wire.ts +70 -1
  80. package/src/mail-core/public-api.ts +6 -1
  81. package/styles/iox-design.css +44 -2
@@ -34,6 +34,8 @@ var MailSender;
34
34
  MailSender["FormDelivery"] = "form-delivery";
35
35
  /** the `sendEmail` element action — to the author's fixed address */
36
36
  MailSender["SendEmailAction"] = "send-email-action";
37
+ /** Settings ▸ Email ▸ Send a test email — to the signed-in person's own address only (ML3-D3) */
38
+ MailSender["TestEmail"] = "test-email";
37
39
  })(MailSender || (MailSender = {}));
38
40
  /** ONE table: what kind of mail each sender sends (R-ML1). Only reminders are marketing. */
39
41
  const MAIL_KIND_OF_SENDER = {
@@ -44,6 +46,7 @@ const MAIL_KIND_OF_SENDER = {
44
46
  [MailSender.Reminder]: MailKind.Marketing,
45
47
  [MailSender.FormDelivery]: MailKind.Transactional,
46
48
  [MailSender.SendEmailAction]: MailKind.Transactional,
49
+ [MailSender.TestEmail]: MailKind.Transactional,
47
50
  };
48
51
  function mailKindOf(sender) {
49
52
  return MAIL_KIND_OF_SENDER[sender];
@@ -128,6 +131,22 @@ const RELAY_MAIL_USAGE_PATH = '/instances/me/mail/usage';
128
131
  const RELAY_MAX_MESSAGES = 50;
129
132
  /** RFC 8058 one-click unsubscribe — the only headers a relayed message may carry. */
130
133
  const RELAY_ALLOWED_HEADERS = ['List-Unsubscribe', 'List-Unsubscribe-Post'];
134
+ /** The mailer row's Reply-To (ML3-D1) — absent/blank = the relay's default, the studio's owner. */
135
+ const MAILER_REPLY_TO_KEY = 'replyTo';
136
+ /** At most this many test emails an hour, per studio (ML3-D3) — each counts against the month like any email. */
137
+ const MAIL_TEST_PER_HOUR = 5;
138
+ /** What became of a test email. */
139
+ var MailTestOutcome;
140
+ (function (MailTestOutcome) {
141
+ /** handed to IOX mail's relay or the studio's own Mailjet, which took it */
142
+ MailTestOutcome["Sent"] = "sent";
143
+ /** stored in IOX mail's outbox — the relay could not take it now; it goes when it can */
144
+ MailTestOutcome["Queued"] = "queued";
145
+ /** refused: no route, the relay's reason, Mailjet's words */
146
+ MailTestOutcome["Refused"] = "refused";
147
+ /** this hour's test emails are used */
148
+ MailTestOutcome["Limited"] = "limited";
149
+ })(MailTestOutcome || (MailTestOutcome = {}));
131
150
 
132
151
  /** The studio's own Mailjet keys — the three an own mailer needs (the MAILER connector's `requiredKeys`, ML-D9). */
133
152
  const OWN_MAILER_KEYS = ['publicKey', 'secretKey', 'originatorEmail'];
@@ -171,11 +190,278 @@ function planMailRoute(facts) {
171
190
  return facts.ioxMail ? MailRoute.Iox : MailRoute.None;
172
191
  }
173
192
 
193
+ /**
194
+ * Where a studio's IOX mail stands this month (iox-mail-plan ML-D5, the ML3 board's E2). ONE reading of the relay's
195
+ * usage: the admin's pill, meter and note, System Health, Home and the bell (iox-cms's reconciler) all ask this — none
196
+ * of them compares counts with a quota on its own.
197
+ */
198
+ var MailStanding;
199
+ (function (MailStanding) {
200
+ /** sending, under 80% of the month */
201
+ MailStanding["Healthy"] = "healthy";
202
+ /** 80% of the month's emails used — reminders still go */
203
+ MailStanding["Low"] = "low";
204
+ /** the month's emails used: reminders are paused, receipts and codes continue up to twice the month */
205
+ MailStanding["Full"] = "full";
206
+ /** twice the month's emails sent: nothing more goes until the month resets */
207
+ MailStanding["Ceiling"] = "ceiling";
208
+ /** reminders paused by complaints, bounces or the operator (ML-D7) — receipts and codes unaffected */
209
+ MailStanding["Paused"] = "paused";
210
+ /** IOX mail does not send for this studio: the relay never answered, holds no key, or the plan has none */
211
+ MailStanding["Off"] = "off";
212
+ })(MailStanding || (MailStanding = {}));
213
+ /** The meter turns low — and the bell says so — once this share of the month is used (ML3-D2). */
214
+ const MAIL_LOW_SHARE = 0.8;
215
+ /** The month's emails used so far (both kinds — what the quota counts). */
216
+ function mailEmailsUsed(usage) {
217
+ return Math.max(0, Number(usage?.month?.total ?? 0) || 0);
218
+ }
219
+ /** Emails left this month before reminders pause; null = unlimited (or no usage). */
220
+ function mailEmailsLeft(usage) {
221
+ if (!usage || usage.quota === null || usage.quota === undefined)
222
+ return null;
223
+ return Math.max(usage.quota - mailEmailsUsed(usage), 0);
224
+ }
225
+ /** THE standing rule. The worst line crossed wins: off → ceiling → full → paused → low → healthy. */
226
+ function mailStandingOf(usage) {
227
+ if (!usage || !usage.enabled || !usage.configured)
228
+ return MailStanding.Off;
229
+ const used = mailEmailsUsed(usage);
230
+ if (usage.ceiling !== null && usage.ceiling !== undefined && used >= usage.ceiling)
231
+ return MailStanding.Ceiling;
232
+ if (usage.quota !== null && usage.quota !== undefined && used >= usage.quota)
233
+ return MailStanding.Full;
234
+ if (usage.marketingPaused)
235
+ return MailStanding.Paused;
236
+ if (usage.quota !== null && usage.quota !== undefined && used >= MAIL_LOW_SHARE * usage.quota)
237
+ return MailStanding.Low;
238
+ return MailStanding.Healthy;
239
+ }
240
+ /** Reminders do not go in this standing (receipts and codes still do, except at the ceiling). */
241
+ function remindersStopped(standing) {
242
+ return standing === MailStanding.Full || standing === MailStanding.Ceiling || standing === MailStanding.Paused;
243
+ }
244
+ const MAIL_ADDRESS = /^[^\s@<>(),;:"]+@[^\s@<>(),;:"]+\.[^\s@<>(),;:".]{2,}$/;
245
+ /** A plain address a Reply-To may carry (`name@domain.tld`), trimmed — the admin's field and iox-cms's save both ask it. */
246
+ function isMailAddress(value) {
247
+ return typeof value === 'string' && value.trim().length <= 254 && MAIL_ADDRESS.test(value.trim());
248
+ }
249
+
250
+ /**
251
+ * A studio's OWN sending domain (iox-mail-plan ML4, ML-D2 (b), R-ML3): the owner names an address on its domain, adds the
252
+ * DNS records Mailjet gives, and IOX mail switches the From to that address only once Mailjet says the sender is active
253
+ * AND SPF AND DKIM are ok — never before, and back to `mail.iox.studio` the moment a recheck finds a record gone.
254
+ *
255
+ * ONE judge of Mailjet's `sender` + `dns` answers (`mailSenderProblems`), used by the relay for an IOX-mail domain and by
256
+ * iox-cms for a studio's own Mailjet key (commerce E4's sender check) — the two used to be one private copy each.
257
+ */
258
+ /** Where a studio's own sending domain stands — what Settings ▸ Email ▸ "Send from my own domain" shows. */
259
+ var MailDomainState;
260
+ (function (MailDomainState) {
261
+ /** no own domain — mail goes from `<studio>@mail.iox.studio` */
262
+ MailDomainState["NotSet"] = "not-set";
263
+ /** named; Mailjet has not checked its records yet (never asked, or a check is running) */
264
+ MailDomainState["Waiting"] = "waiting";
265
+ /** the sender is active and SPF + DKIM are ok — mail goes from the studio's own address */
266
+ MailDomainState["Verified"] = "verified";
267
+ /** checked, and a record is missing or wrong — mail keeps going from `mail.iox.studio` */
268
+ MailDomainState["Failed"] = "failed";
269
+ })(MailDomainState || (MailDomainState = {}));
270
+ /** Why a sender is not verified — Mailjet's answers read (the values are commerce E4's, unchanged on the wire). */
271
+ var MailSenderProblem;
272
+ (function (MailSenderProblem) {
273
+ /** no sender address at all */
274
+ MailSenderProblem["NoAddress"] = "no-address";
275
+ /** Mailjet does not know the address as a sender, or has not activated it (the ownership record) */
276
+ MailSenderProblem["SenderInactive"] = "sender-inactive";
277
+ /** the address's domain is not added to Mailjet */
278
+ MailSenderProblem["DomainMissing"] = "domain-missing";
279
+ MailSenderProblem["SpfMissing"] = "spf-missing";
280
+ MailSenderProblem["DkimMissing"] = "dkim-missing";
281
+ })(MailSenderProblem || (MailSenderProblem = {}));
282
+ /** The three records a domain needs — each one TXT. */
283
+ var MailDnsRecordRole;
284
+ (function (MailDnsRecordRole) {
285
+ /** proves the domain is the studio's: Mailjet's ownership token */
286
+ MailDnsRecordRole["Ownership"] = "ownership";
287
+ /** lets Mailjet's servers send for the domain */
288
+ MailDnsRecordRole["Spf"] = "spf";
289
+ /** signs every message with the domain's key */
290
+ MailDnsRecordRole["Dkim"] = "dkim";
291
+ })(MailDnsRecordRole || (MailDnsRecordRole = {}));
292
+ /** Why an address cannot become the studio's sending address. */
293
+ var MailDomainRefusal;
294
+ (function (MailDomainRefusal) {
295
+ /** not one plain address */
296
+ MailDomainRefusal["NotAnAddress"] = "not-an-address";
297
+ /** `iox.studio` or any domain under it — IOX's own */
298
+ MailDomainRefusal["PlatformDomain"] = "platform-domain";
299
+ /** a public mailbox (gmail.com, outlook.com…) — nobody but its provider can add records there */
300
+ MailDomainRefusal["PublicMailbox"] = "public-mailbox";
301
+ /** another studio sends from this domain */
302
+ MailDomainRefusal["Taken"] = "taken";
303
+ /** IOX mail is not on (no key, or the plan has none) */
304
+ MailDomainRefusal["NotEnabled"] = "not-enabled";
305
+ /** Mailjet could not be asked — try again */
306
+ MailDomainRefusal["Upstream"] = "upstream";
307
+ })(MailDomainRefusal || (MailDomainRefusal = {}));
308
+ const ACTIVE = 'active';
309
+ const OK = 'ok';
310
+ const NOT_CHECKED = new Set(['not checked', '']);
311
+ const MAX_ERROR = 300;
312
+ /** Mailjet's SPF include — merged into a domain's existing SPF record, never a second record beside it. */
313
+ const MAILJET_SPF_INCLUDE = 'include:spf.mailjet.com';
314
+ /** How often the owner's "Check DNS" really asks Mailjet; a sooner press answers the last check. */
315
+ const MAIL_DOMAIN_CHECK_MIN_MS = 30_000;
316
+ /** A verified domain is checked again this often — a removed record moves the From back to `mail.iox.studio`. */
317
+ const MAIL_DOMAIN_RECHECK_MS = 24 * 60 * 60 * 1000;
318
+ /** Domains IOX itself sends from — never a studio's own. */
319
+ const PLATFORM_MAIL_DOMAINS = ['iox.studio'];
320
+ /** Public mailbox providers: an address there can never be verified by the studio (no access to the DNS). */
321
+ const PUBLIC_MAILBOX_DOMAINS = [
322
+ 'gmail.com', 'googlemail.com', 'outlook.com', 'hotmail.com', 'live.com', 'msn.com', 'yahoo.com', 'ymail.com',
323
+ 'icloud.com', 'me.com', 'mac.com', 'aol.com', 'proton.me', 'protonmail.com', 'gmx.com', 'gmx.net', 'zoho.com',
324
+ 'yandex.com', 'mail.com', 'walla.co.il', 'walla.com',
325
+ ];
326
+ /** The lower-cased domain of an address, or null. */
327
+ function mailDomainOf(email) {
328
+ const at = String(email ?? '').lastIndexOf('@');
329
+ const domain = at > 0 ? String(email).slice(at + 1).trim().toLowerCase().replace(/\.$/, '') : '';
330
+ return domain || null;
331
+ }
332
+ const under = (domain, parent) => domain === parent || domain.endsWith(`.${parent}`);
333
+ /** Why this address cannot be the studio's own sending address — null when it can (the relay adds `Taken`). */
334
+ function ownAddressRefusal(address, platformDomains = PLATFORM_MAIL_DOMAINS) {
335
+ if (typeof address !== 'string' || !isPlainAddress(address))
336
+ return MailDomainRefusal.NotAnAddress;
337
+ const domain = mailDomainOf(address);
338
+ if (platformDomains.some((p) => under(domain, p.toLowerCase())))
339
+ return MailDomainRefusal.PlatformDomain;
340
+ if (PUBLIC_MAILBOX_DOMAINS.some((p) => under(domain, p)))
341
+ return MailDomainRefusal.PublicMailbox;
342
+ return null;
343
+ }
344
+ const PLAIN_ADDRESS = /^[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]{1,64}@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)+$/;
345
+ function isPlainAddress(value) {
346
+ const v = value.trim();
347
+ return v.length <= 254 && PLAIN_ADDRESS.test(v) && /\.[A-Za-z]{2,}$/.test(v);
348
+ }
349
+ /**
350
+ * THE judge of Mailjet's answers for one address: verified only with an active sender AND SPF ok AND DKIM ok.
351
+ * An empty list is verified. (commerce E4's sender check and the relay's own-domain check both ask this.)
352
+ */
353
+ function mailSenderProblems(email, sender, dns) {
354
+ const problems = [];
355
+ if (!email || !mailDomainOf(email))
356
+ return [MailSenderProblem.NoAddress];
357
+ if (String(sender?.Status ?? '').toLowerCase() !== ACTIVE)
358
+ problems.push(MailSenderProblem.SenderInactive);
359
+ if (!dns)
360
+ problems.push(MailSenderProblem.DomainMissing);
361
+ else {
362
+ if (String(dns.SPFStatus ?? '').toLowerCase() !== OK)
363
+ problems.push(MailSenderProblem.SpfMissing);
364
+ if (String(dns.DKIMStatus ?? '').toLowerCase() !== OK)
365
+ problems.push(MailSenderProblem.DkimMissing);
366
+ }
367
+ return problems;
368
+ }
369
+ /** A record's name relative to its domain — `@` for the domain itself. */
370
+ function relativeDnsHost(name, domain) {
371
+ const full = String(name ?? '').trim().toLowerCase().replace(/\.$/, '');
372
+ if (!full || full === domain)
373
+ return '@';
374
+ return full.endsWith(`.${domain}`) ? full.slice(0, -(domain.length + 1)) : full;
375
+ }
376
+ /**
377
+ * The SPF record to publish: the domain's existing `v=spf1` record with Mailjet's include added before its `all` term
378
+ * (a domain may hold only ONE SPF record — a second one fails both), or Mailjet's own value when there is none.
379
+ */
380
+ function mergedSpf(existing, mailjetValue = `v=spf1 ${MAILJET_SPF_INCLUDE} ~all`) {
381
+ const current = String(existing ?? '').trim().replace(/^"|"$/g, '');
382
+ if (!/^v=spf1(\s|$)/i.test(current))
383
+ return mailjetValue;
384
+ const terms = current.split(/\s+/);
385
+ if (terms.some((t) => t.toLowerCase() === MAILJET_SPF_INCLUDE))
386
+ return terms.join(' ');
387
+ const all = terms.findIndex((t, i) => i > 0 && /^[-~?+]?all$/i.test(t));
388
+ if (all < 0)
389
+ return [...terms, MAILJET_SPF_INCLUDE].join(' ');
390
+ return [...terms.slice(0, all), MAILJET_SPF_INCLUDE, ...terms.slice(all)].join(' ');
391
+ }
392
+ const bounded = (words) => {
393
+ const w = String(words ?? '').replace(/\s+/g, ' ').trim();
394
+ return w ? w.slice(0, MAX_ERROR) : null;
395
+ };
396
+ const statusOk = (status) => {
397
+ const s = String(status ?? '').trim().toLowerCase();
398
+ if (NOT_CHECKED.has(s))
399
+ return null;
400
+ return s === OK;
401
+ };
402
+ /** The three records to copy, each with Mailjet's last word on it. `existingSpf` = the domain's own SPF, when read. */
403
+ function mailDnsRecords(domain, sender, dns, check, existingSpf) {
404
+ if (!dns)
405
+ return [];
406
+ const record = (role, name, value, ok, error) => ({ role, type: 'TXT', name, host: relativeDnsHost(name, domain), value, ok, error: ok === false ? bounded(error) : null });
407
+ const records = [];
408
+ if (dns.OwnerShipToken) {
409
+ const name = String(dns.OwnerShipTokenRecordName || domain).replace(/\.$/, '');
410
+ // a fresh sender is Inactive by birth: the ownership row reads "wrong" only after a check found it so
411
+ const active = String(sender?.Status ?? '').toLowerCase() === ACTIVE;
412
+ records.push(record(MailDnsRecordRole.Ownership, name, dns.OwnerShipToken, active ? true : check ? false : null, check ? 'Mailjet has not found this record yet' : null));
413
+ }
414
+ records.push(record(MailDnsRecordRole.Spf, domain, mergedSpf(existingSpf, dns.SPFRecordValue || undefined), statusOk(check?.SPFStatus ?? dns.SPFStatus), check?.SPFErrors));
415
+ if (dns.DKIMRecordName && dns.DKIMRecordValue) {
416
+ records.push(record(MailDnsRecordRole.Dkim, String(dns.DKIMRecordName).replace(/\.$/, ''), dns.DKIMRecordValue, statusOk(check?.DKIMStatus ?? dns.DKIMStatus), check?.DKIMErrors));
417
+ }
418
+ return records;
419
+ }
420
+ /**
421
+ * A verified domain that a later check failed (ML4-D5): mail went back to the IOX address. THE rule for the bell's
422
+ * "Your own email domain stopped working" and the card's "DNS changed" — `lostAt` stays until it is verified again.
423
+ */
424
+ function mailDomainLost(answer) {
425
+ return !!answer?.lostAt && answer.state !== MailDomainState.Verified;
426
+ }
427
+ /** No own domain. */
428
+ const NO_MAIL_DOMAIN = Object.freeze({
429
+ address: null, domain: null, state: MailDomainState.NotSet, records: [], problems: [], checkedAt: null, verifiedAt: null, lostAt: null,
430
+ });
431
+ /**
432
+ * THE state rule: verified when nothing is wrong; waiting while nothing was checked yet (or Mailjet is checking now);
433
+ * failed once a check found a record missing or wrong.
434
+ */
435
+ function mailDomainState(problems, checked, inProgress = false) {
436
+ if (!problems.length)
437
+ return MailDomainState.Verified;
438
+ if (inProgress || !checked)
439
+ return MailDomainState.Waiting;
440
+ return MailDomainState.Failed;
441
+ }
442
+ /** May mail go from this domain now? Only a verified answer for exactly this address's domain (R-ML3). */
443
+ function mailDomainSends(answer) {
444
+ return answer?.state === MailDomainState.Verified && answer.address ? answer.address.trim().toLowerCase() : null;
445
+ }
446
+ /** Is a verified domain due its daily recheck? */
447
+ function mailDomainRecheckDue(answer, now) {
448
+ if (answer?.state !== MailDomainState.Verified)
449
+ return false;
450
+ const at = answer.checkedAt ? Date.parse(answer.checkedAt) : NaN;
451
+ return !Number.isFinite(at) || now - at >= MAIL_DOMAIN_RECHECK_MS;
452
+ }
453
+ /** The relay's own-domain routes. */
454
+ const RELAY_MAIL_DOMAIN_PATH = '/instances/me/mail/domain';
455
+ const RELAY_MAIL_DOMAIN_CHECK_PATH = '/instances/me/mail/domain/check';
456
+
174
457
  /**
175
458
  * @vectoriox/iox-ui/mail-core — IOX Mail's shared, FRAMEWORK-FREE vocabulary (iox-mail-plan ML2): a message's kind,
176
459
  * who sends it, the relay's wire (`POST /instances/me/mail`, its usage) and refusals, and the ONE route rule — the
177
460
  * studio's own active mailer wins, else IOX mail when the plan has it. The control plane (the relay), iox-cms (the
178
- * transport and the MAILER connector) and the admin (Settings ▸ Email, ML3) speak it. It imports nothing.
461
+ * transport and the MAILER connector) and the admin (Settings ▸ Email, ML3) speak it — and ML3 adds the ONE reading
462
+ * of a studio's month (`mailStandingOf`: low at 80%, full, the 2× ceiling, paused, off), the connector's `MailerDetails`,
463
+ * the Reply-To check and the test email's answer; ML4 the studio's own sending domain (`mail-domain`: ONE judge of
464
+ * Mailjet's sender + DNS answers, the records to copy, the state rule). It imports nothing.
179
465
  * ⚠️ Not re-exported from the main entry. Consumers wire the usual trio — ng-package raw-ts assets, jest
180
466
  * moduleNameMapper, tsconfig paths — or `nest start` dies with ERR_REQUIRE_ESM.
181
467
  */
@@ -184,5 +470,5 @@ function planMailRoute(facts) {
184
470
  * Generated bundle index. Do not edit.
185
471
  */
186
472
 
187
- export { MAIL_KIND_OF_SENDER, MailKind, MailMode, MailRefusal, MailRelayCode, MailResultStatus, MailRoute, MailSender, MailSenderState, MailStream, MarketingPauseReason, OWN_MAILER_KEYS, RELAY_ALLOWED_HEADERS, RELAY_MAIL_PATH, RELAY_MAIL_USAGE_PATH, RELAY_MAX_MESSAGES, RETRYABLE_REFUSALS, SuppressionReason, hasOwnMailerKeys, isRetryableRefusal, mailKindOf, mailModeOf, planMailRoute, requiredMailerKeys };
473
+ export { MAILER_REPLY_TO_KEY, MAILJET_SPF_INCLUDE, MAIL_DOMAIN_CHECK_MIN_MS, MAIL_DOMAIN_RECHECK_MS, MAIL_KIND_OF_SENDER, MAIL_LOW_SHARE, MAIL_TEST_PER_HOUR, MailDnsRecordRole, MailDomainRefusal, MailDomainState, MailKind, MailMode, MailRefusal, MailRelayCode, MailResultStatus, MailRoute, MailSender, MailSenderProblem, MailSenderState, MailStanding, MailStream, MailTestOutcome, MarketingPauseReason, NO_MAIL_DOMAIN, OWN_MAILER_KEYS, PLATFORM_MAIL_DOMAINS, PUBLIC_MAILBOX_DOMAINS, RELAY_ALLOWED_HEADERS, RELAY_MAIL_DOMAIN_CHECK_PATH, RELAY_MAIL_DOMAIN_PATH, RELAY_MAIL_PATH, RELAY_MAIL_USAGE_PATH, RELAY_MAX_MESSAGES, RETRYABLE_REFUSALS, SuppressionReason, hasOwnMailerKeys, isMailAddress, isRetryableRefusal, mailDnsRecords, mailDomainLost, mailDomainOf, mailDomainRecheckDue, mailDomainSends, mailDomainState, mailEmailsLeft, mailEmailsUsed, mailKindOf, mailModeOf, mailSenderProblems, mailStandingOf, mergedSpf, ownAddressRefusal, planMailRoute, relativeDnsHost, remindersStopped, requiredMailerKeys };
188
474
  //# sourceMappingURL=vectoriox-iox-ui-mail-core.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"vectoriox-iox-ui-mail-core.mjs","sources":["../../../projects/iox-ui/src/mail-core/mail-vocabulary.ts","../../../projects/iox-ui/src/mail-core/mail-wire.ts","../../../projects/iox-ui/src/mail-core/mail-route.ts","../../../projects/iox-ui/src/mail-core/public-api.ts","../../../projects/iox-ui/src/mail-core/vectoriox-iox-ui-mail-core.ts"],"sourcesContent":["/**\n * IOX Mail's words (iox-mail-plan ML1/ML2). ONE spelling for the relay (iox-control-plane), the studio (iox-cms) and\n * the admin — none of them re-spells a value.\n */\n\n/** Set by the sender, never guessed (iox-mail-plan §2): reminders are marketing, everything else transactional. */\nexport enum MailKind {\n Transactional = 'transactional',\n Marketing = 'marketing',\n}\n\n/** How a studio's mail goes (ML-D9): IOX's relay, or the studio's own Mailjet keys. */\nexport enum MailMode {\n Iox = 'iox',\n Own = 'own',\n}\n\n/**\n * Every place a studio sends mail from (iox-mail-plan §1: the seven senders). A message names its sender; its kind,\n * and anything else that follows from who sent it, is read from the tables below — never decided at the call site.\n */\nexport enum MailSender {\n /** a team invite (users) */\n Invite = 'invite',\n /** \"Forgot it?\" — a team member's reset link */\n PasswordReset = 'password-reset',\n /** a buyer's sign-in code (commerce E3) */\n SignInCode = 'sign-in-code',\n /** an order email — confirmation, payment, shipping (commerce E1/E2) */\n Order = 'order',\n /** a checkout recovery reminder (commerce E4) */\n Reminder = 'reminder',\n /** a form's \"email me\" delivery to the owner */\n FormDelivery = 'form-delivery',\n /** the `sendEmail` element action — to the author's fixed address */\n SendEmailAction = 'send-email-action',\n}\n\n/** ONE table: what kind of mail each sender sends (R-ML1). Only reminders are marketing. */\nexport const MAIL_KIND_OF_SENDER: Readonly<Record<MailSender, MailKind>> = {\n [MailSender.Invite]: MailKind.Transactional,\n [MailSender.PasswordReset]: MailKind.Transactional,\n [MailSender.SignInCode]: MailKind.Transactional,\n [MailSender.Order]: MailKind.Transactional,\n [MailSender.Reminder]: MailKind.Marketing,\n [MailSender.FormDelivery]: MailKind.Transactional,\n [MailSender.SendEmailAction]: MailKind.Transactional,\n};\n\nexport function mailKindOf(sender: MailSender): MailKind {\n return MAIL_KIND_OF_SENDER[sender];\n}\n\n/** What became of one relayed message. */\nexport enum MailResultStatus {\n Sent = 'sent',\n Refused = 'refused',\n}\n\n/** Why a message was not sent — iox-cms records the reason and says it to the owner (R-ML4). */\nexport enum MailRefusal {\n /** the message itself is malformed (`detail` names the field) */\n Invalid = 'invalid',\n /** it asked a From that is not the studio's IOX address for its stream, nor its own verified domain (R-ML3) */\n From = 'from',\n /** the address bounced hard, complained, or unsubscribed from this studio's marketing (R-ML5) */\n Suppressed = 'suppressed',\n /** this studio's marketing is paused — too many complaints or hard bounces, or the operator (ML-D7) */\n Paused = 'paused',\n /** marketing past 100% of the month's emails (ML-D5) */\n Quota = 'quota',\n /** transactional past twice the month's emails — the abuse ceiling (ML-D5) */\n Ceiling = 'ceiling',\n /** the same message id is being sent by another call right now — retry later */\n InProgress = 'in-progress',\n /** Mailjet refused this message (an address it will not take, a field it rejects) — not retried */\n Rejected = 'rejected',\n /** Mailjet could not be reached or failed — nothing was sent and nothing counted; retry */\n Upstream = 'upstream',\n}\n\n/** The refusals worth retrying later as they are. */\nexport const RETRYABLE_REFUSALS: ReadonlySet<MailRefusal> = new Set([MailRefusal.InProgress, MailRefusal.Upstream]);\n\nexport function isRetryableRefusal(reason: MailRefusal | string | null | undefined): boolean {\n return RETRYABLE_REFUSALS.has(reason as MailRefusal);\n}\n\n/** A whole call the relay cannot take (the HTTP answer carries it as `code`). */\nexport enum MailRelayCode {\n /** no Mailjet key in the control plane yet (ML0) — 503 */\n NotConfigured = 'not-configured',\n /** the studio's plan has no IOX mail — 403 */\n NotEnabled = 'not-enabled',\n}\n\n/** Which of a studio's streams a suppression closes. */\nexport enum MailStream {\n All = 'all',\n Marketing = 'marketing',\n}\n\n/** Why an address is suppressed for a studio (ML-D7). */\nexport enum SuppressionReason {\n HardBounce = 'hard_bounce',\n Spam = 'spam',\n Unsubscribed = 'unsubscribed',\n}\n\n/** Why a studio's marketing is paused. */\nexport enum MarketingPauseReason {\n Complaints = 'complaints',\n Bounces = 'bounces',\n Operator = 'operator',\n}\n\n/** What the relay says about the studio's sender (ML-D10 reads it). */\nexport enum MailSenderState {\n /** the platform key is set and the plan has IOX mail — IOX's verified domains send */\n Ready = 'ready',\n NotConfigured = 'not-configured',\n NotEnabled = 'not-enabled',\n}\n","import { MailKind, MailRefusal, MailResultStatus, MailSenderState, MarketingPauseReason } from './mail-vocabulary';\n\n/**\n * The relay's wire (iox-control-plane `src/mail/`, its `openapi.json` tag `instances`). The studio calls back with its\n * instance token: `Authorization: Bearer <INSTANCE_TOKEN>`.\n */\nexport const RELAY_MAIL_PATH = '/instances/me/mail';\nexport const RELAY_MAIL_USAGE_PATH = '/instances/me/mail/usage';\n\n/** At most this many messages a call. */\nexport const RELAY_MAX_MESSAGES = 50;\n\n/** RFC 8058 one-click unsubscribe — the only headers a relayed message may carry. */\nexport const RELAY_ALLOWED_HEADERS: readonly string[] = ['List-Unsubscribe', 'List-Unsubscribe-Post'];\n\nexport interface RelayAddress {\n email: string;\n name?: string;\n}\n\n/** One message as the studio asks it to be sent. ONE recipient a message. */\nexport interface RelayMessage {\n /** the studio's message id (its outbox row) — the relay sends one id at most once */\n id: string;\n kind: MailKind;\n to: RelayAddress;\n subject: string;\n text?: string;\n html?: string;\n /** absent = the studio's owner */\n replyTo?: RelayAddress;\n /** the From it expects — absent = the studio's stamped address */\n from?: string;\n /** the organization's name — the From's display name (else the studio's label) */\n fromName?: string;\n headers?: Record<string, string>;\n}\n\nexport interface RelayRequest {\n messages: RelayMessage[];\n}\n\nexport interface RelayResult {\n id: string;\n status: MailResultStatus;\n reason: MailRefusal | null;\n retryable: boolean;\n /** the field a malformed message got wrong, or Mailjet's words for a message it refused */\n detail: string | null;\n /** true when this id was already sent by an earlier call — nothing was sent twice */\n duplicate: boolean;\n messageUuid: string | null;\n}\n\n/** This month's counts — what the quota counts is `total`, both kinds. */\nexport interface RelayMonth {\n total: number;\n transactional: number;\n marketing: number;\n /** refusals this month by reason */\n refused: Partial<Record<MailRefusal | string, number>>;\n hardBounced: number;\n softBounced: number;\n blocked: number;\n complained: number;\n unsubscribed: number;\n}\n\n/** `GET /instances/me/mail/usage` (and every send's `usage`). Dates are ISO strings on the wire. */\nexport interface RelayUsage {\n /** the plan has IOX mail (`ioxMail`) */\n enabled: boolean;\n /** the control plane holds a Mailjet key */\n configured: boolean;\n senderState: MailSenderState;\n transactionalFrom: { email: string; name: string };\n marketingFrom: { email: string; name: string };\n defaultReplyTo: string;\n periodStart: string;\n periodEnd: string;\n /** `emailsPerMonth`; null = unlimited */\n quota: number | null;\n /** where transactional stops (2× the quota); null = unlimited */\n ceiling: number | null;\n month: RelayMonth;\n suppressions: number;\n marketingPaused: { at: string; reason: MarketingPauseReason | string } | null;\n}\n\nexport interface RelayResponse {\n results: RelayResult[];\n usage: RelayUsage;\n}\n","import { MailMode } from './mail-vocabulary';\n\n/** The studio's own Mailjet keys — the three an own mailer needs (the MAILER connector's `requiredKeys`, ML-D9). */\nexport const OWN_MAILER_KEYS: readonly string[] = ['publicKey', 'secretKey', 'originatorEmail'];\n\n/** Where one org's mail goes now. */\nexport enum MailRoute {\n /** its own active mailer row — ML-D8: own wins */\n Own = 'own',\n /** IOX's relay */\n Iox = 'iox',\n /** nowhere: no usable own row and no IOX mail in the plan */\n None = 'none',\n}\n\n/** A mailer row's settings, as the route reads them (decrypted; only presence is read). */\nexport interface MailerRowLike {\n mode?: unknown;\n publicKey?: unknown;\n secretKey?: unknown;\n originatorEmail?: unknown;\n}\n\nconst filled = (value: unknown): boolean => typeof value === 'string' && value.trim().length > 0;\n\n/** True when the row holds every key an own mailer needs. */\nexport function hasOwnMailerKeys(row: MailerRowLike | null | undefined): boolean {\n return !!row && OWN_MAILER_KEYS.every((key) => filled((row as Record<string, unknown>)[key]));\n}\n\n/**\n * A row's mode (ML-D9): the one it names; a row that names none is `own` when it holds its keys (every row stored\n * before IOX mail — its owner brought Mailjet), else `iox`. No row at all is `iox`.\n */\nexport function mailModeOf(row: MailerRowLike | null | undefined): MailMode {\n const asked = typeof row?.mode === 'string' ? row.mode.trim().toLowerCase() : '';\n if (asked === MailMode.Own || asked === MailMode.Iox) return asked as MailMode;\n return hasOwnMailerKeys(row) ? MailMode.Own : MailMode.Iox;\n}\n\n/** The keys a row needs to count as configured: its own keys in own mode, none in IOX mode (E1). */\nexport function requiredMailerKeys(row: MailerRowLike | null | undefined): string[] {\n return mailModeOf(row) === MailMode.Own ? [...OWN_MAILER_KEYS] : [];\n}\n\nexport interface MailRouteFacts {\n /** the org's ACTIVE mailer row, decrypted — null when it has none (or none is on) */\n activeRow: MailerRowLike | null;\n /** the plan has IOX mail (`features.ioxMail`) */\n ioxMail: boolean;\n}\n\n/**\n * THE route rule (ML-D8, R-ML1): an active row in own mode with its keys sends as today; anything else — no row, a row\n * turned off, a row set to IOX, a row still missing a key — goes through IOX mail when the plan has it, else nowhere.\n */\nexport function planMailRoute(facts: MailRouteFacts): MailRoute {\n const row = facts.activeRow;\n if (row && mailModeOf(row) === MailMode.Own && hasOwnMailerKeys(row)) return MailRoute.Own;\n return facts.ioxMail ? MailRoute.Iox : MailRoute.None;\n}\n","/**\n * @vectoriox/iox-ui/mail-core — IOX Mail's shared, FRAMEWORK-FREE vocabulary (iox-mail-plan ML2): a message's kind,\n * who sends it, the relay's wire (`POST /instances/me/mail`, its usage) and refusals, and the ONE route rule — the\n * studio's own active mailer wins, else IOX mail when the plan has it. The control plane (the relay), iox-cms (the\n * transport and the MAILER connector) and the admin (Settings ▸ Email, ML3) speak it. It imports nothing.\n * ⚠️ Not re-exported from the main entry. Consumers wire the usual trio — ng-package raw-ts assets, jest\n * moduleNameMapper, tsconfig paths — or `nest start` dies with ERR_REQUIRE_ESM.\n */\nexport * from './mail-vocabulary';\nexport * from './mail-wire';\nexport * from './mail-route';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;AAGG;AAEH;IACY;AAAZ,CAAA,UAAY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AGG;AACG,SAAU,aAAa,CAAC,KAAqB,EAAA;AAC/C,IAAA,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS;AAC3B,IAAA,IAAI,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,GAAG,IAAI,gBAAgB,CAAC,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC,GAAG;AAC1F,IAAA,OAAO,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,GAAG,SAAS,CAAC,IAAI;AACzD;;AC5DA;;;;;;;AAOG;;ACPH;;AAEG;;;;"}
1
+ {"version":3,"file":"vectoriox-iox-ui-mail-core.mjs","sources":["../../../projects/iox-ui/src/mail-core/mail-vocabulary.ts","../../../projects/iox-ui/src/mail-core/mail-wire.ts","../../../projects/iox-ui/src/mail-core/mail-route.ts","../../../projects/iox-ui/src/mail-core/mail-standing.ts","../../../projects/iox-ui/src/mail-core/mail-domain.ts","../../../projects/iox-ui/src/mail-core/public-api.ts","../../../projects/iox-ui/src/mail-core/vectoriox-iox-ui-mail-core.ts"],"sourcesContent":["/**\n * IOX Mail's words (iox-mail-plan ML1/ML2). ONE spelling for the relay (iox-control-plane), the studio (iox-cms) and\n * the admin — none of them re-spells a value.\n */\n\n/** Set by the sender, never guessed (iox-mail-plan §2): reminders are marketing, everything else transactional. */\nexport enum MailKind {\n Transactional = 'transactional',\n Marketing = 'marketing',\n}\n\n/** How a studio's mail goes (ML-D9): IOX's relay, or the studio's own Mailjet keys. */\nexport enum MailMode {\n Iox = 'iox',\n Own = 'own',\n}\n\n/**\n * Every place a studio sends mail from (iox-mail-plan §1: the seven senders). A message names its sender; its kind,\n * and anything else that follows from who sent it, is read from the tables below — never decided at the call site.\n */\nexport enum MailSender {\n /** a team invite (users) */\n Invite = 'invite',\n /** \"Forgot it?\" — a team member's reset link */\n PasswordReset = 'password-reset',\n /** a buyer's sign-in code (commerce E3) */\n SignInCode = 'sign-in-code',\n /** an order email — confirmation, payment, shipping (commerce E1/E2) */\n Order = 'order',\n /** a checkout recovery reminder (commerce E4) */\n Reminder = 'reminder',\n /** a form's \"email me\" delivery to the owner */\n FormDelivery = 'form-delivery',\n /** the `sendEmail` element action — to the author's fixed address */\n SendEmailAction = 'send-email-action',\n /** Settings ▸ Email ▸ Send a test email — to the signed-in person's own address only (ML3-D3) */\n TestEmail = 'test-email',\n}\n\n/** ONE table: what kind of mail each sender sends (R-ML1). Only reminders are marketing. */\nexport const MAIL_KIND_OF_SENDER: Readonly<Record<MailSender, MailKind>> = {\n [MailSender.Invite]: MailKind.Transactional,\n [MailSender.PasswordReset]: MailKind.Transactional,\n [MailSender.SignInCode]: MailKind.Transactional,\n [MailSender.Order]: MailKind.Transactional,\n [MailSender.Reminder]: MailKind.Marketing,\n [MailSender.FormDelivery]: MailKind.Transactional,\n [MailSender.SendEmailAction]: MailKind.Transactional,\n [MailSender.TestEmail]: MailKind.Transactional,\n};\n\nexport function mailKindOf(sender: MailSender): MailKind {\n return MAIL_KIND_OF_SENDER[sender];\n}\n\n/** What became of one relayed message. */\nexport enum MailResultStatus {\n Sent = 'sent',\n Refused = 'refused',\n}\n\n/** Why a message was not sent — iox-cms records the reason and says it to the owner (R-ML4). */\nexport enum MailRefusal {\n /** the message itself is malformed (`detail` names the field) */\n Invalid = 'invalid',\n /** it asked a From that is not the studio's IOX address for its stream, nor its own verified domain (R-ML3) */\n From = 'from',\n /** the address bounced hard, complained, or unsubscribed from this studio's marketing (R-ML5) */\n Suppressed = 'suppressed',\n /** this studio's marketing is paused — too many complaints or hard bounces, or the operator (ML-D7) */\n Paused = 'paused',\n /** marketing past 100% of the month's emails (ML-D5) */\n Quota = 'quota',\n /** transactional past twice the month's emails — the abuse ceiling (ML-D5) */\n Ceiling = 'ceiling',\n /** the same message id is being sent by another call right now — retry later */\n InProgress = 'in-progress',\n /** Mailjet refused this message (an address it will not take, a field it rejects) — not retried */\n Rejected = 'rejected',\n /** Mailjet could not be reached or failed — nothing was sent and nothing counted; retry */\n Upstream = 'upstream',\n}\n\n/** The refusals worth retrying later as they are. */\nexport const RETRYABLE_REFUSALS: ReadonlySet<MailRefusal> = new Set([MailRefusal.InProgress, MailRefusal.Upstream]);\n\nexport function isRetryableRefusal(reason: MailRefusal | string | null | undefined): boolean {\n return RETRYABLE_REFUSALS.has(reason as MailRefusal);\n}\n\n/** A whole call the relay cannot take (the HTTP answer carries it as `code`). */\nexport enum MailRelayCode {\n /** no Mailjet key in the control plane yet (ML0) — 503 */\n NotConfigured = 'not-configured',\n /** the studio's plan has no IOX mail — 403 */\n NotEnabled = 'not-enabled',\n}\n\n/** Which of a studio's streams a suppression closes. */\nexport enum MailStream {\n All = 'all',\n Marketing = 'marketing',\n}\n\n/** Why an address is suppressed for a studio (ML-D7). */\nexport enum SuppressionReason {\n HardBounce = 'hard_bounce',\n Spam = 'spam',\n Unsubscribed = 'unsubscribed',\n}\n\n/** Why a studio's marketing is paused. */\nexport enum MarketingPauseReason {\n Complaints = 'complaints',\n Bounces = 'bounces',\n Operator = 'operator',\n}\n\n/** What the relay says about the studio's sender (ML-D10 reads it). */\nexport enum MailSenderState {\n /** the platform key is set and the plan has IOX mail — IOX's verified domains send */\n Ready = 'ready',\n NotConfigured = 'not-configured',\n NotEnabled = 'not-enabled',\n}\n","import { MailKind, MailMode, MailRefusal, MailResultStatus, MailSenderState, MarketingPauseReason } from './mail-vocabulary';\nimport type { MailRoute } from './mail-route';\nimport type { MailStanding } from './mail-standing';\nimport type { MailDomainAnswer } from './mail-domain';\n\n/**\n * The relay's wire (iox-control-plane `src/mail/`, its `openapi.json` tag `instances`). The studio calls back with its\n * instance token: `Authorization: Bearer <INSTANCE_TOKEN>`.\n */\nexport const RELAY_MAIL_PATH = '/instances/me/mail';\nexport const RELAY_MAIL_USAGE_PATH = '/instances/me/mail/usage';\n\n/** At most this many messages a call. */\nexport const RELAY_MAX_MESSAGES = 50;\n\n/** RFC 8058 one-click unsubscribe — the only headers a relayed message may carry. */\nexport const RELAY_ALLOWED_HEADERS: readonly string[] = ['List-Unsubscribe', 'List-Unsubscribe-Post'];\n\nexport interface RelayAddress {\n email: string;\n name?: string;\n}\n\n/** One message as the studio asks it to be sent. ONE recipient a message. */\nexport interface RelayMessage {\n /** the studio's message id (its outbox row) — the relay sends one id at most once */\n id: string;\n kind: MailKind;\n to: RelayAddress;\n subject: string;\n text?: string;\n html?: string;\n /** absent = the studio's owner */\n replyTo?: RelayAddress;\n /** the From it expects — absent = the studio's stamped address */\n from?: string;\n /** the organization's name — the From's display name (else the studio's label) */\n fromName?: string;\n headers?: Record<string, string>;\n}\n\nexport interface RelayRequest {\n messages: RelayMessage[];\n}\n\nexport interface RelayResult {\n id: string;\n status: MailResultStatus;\n reason: MailRefusal | null;\n retryable: boolean;\n /** the field a malformed message got wrong, or Mailjet's words for a message it refused */\n detail: string | null;\n /** true when this id was already sent by an earlier call — nothing was sent twice */\n duplicate: boolean;\n messageUuid: string | null;\n}\n\n/** This month's counts — what the quota counts is `total`, both kinds. */\nexport interface RelayMonth {\n total: number;\n transactional: number;\n marketing: number;\n /** refusals this month by reason */\n refused: Partial<Record<MailRefusal | string, number>>;\n hardBounced: number;\n softBounced: number;\n blocked: number;\n complained: number;\n unsubscribed: number;\n}\n\n/** `GET /instances/me/mail/usage` (and every send's `usage`). Dates are ISO strings on the wire. */\nexport interface RelayUsage {\n /** the plan has IOX mail (`ioxMail`) */\n enabled: boolean;\n /** the control plane holds a Mailjet key */\n configured: boolean;\n senderState: MailSenderState;\n transactionalFrom: { email: string; name: string };\n marketingFrom: { email: string; name: string };\n defaultReplyTo: string;\n periodStart: string;\n periodEnd: string;\n /** `emailsPerMonth`; null = unlimited */\n quota: number | null;\n /** where transactional stops (2× the quota); null = unlimited */\n ceiling: number | null;\n month: RelayMonth;\n suppressions: number;\n marketingPaused: { at: string; reason: MarketingPauseReason | string } | null;\n /** where the studio's owner changes its plan (the portal's studio page); absent/null = nowhere to send them */\n upgradeUrl?: string | null;\n /**\n * The studio's own sending domain (ML4) — absent from a relay older than ML4. While it is verified, both Froms above\n * are its address (`mailDomainSends`).\n */\n domain?: MailDomainAnswer | null;\n}\n\nexport interface RelayResponse {\n results: RelayResult[];\n usage: RelayUsage;\n}\n\n/** The mailer row's Reply-To (ML3-D1) — absent/blank = the relay's default, the studio's owner. */\nexport const MAILER_REPLY_TO_KEY = 'replyTo';\n\n/**\n * What the MAILER connector reports about itself (its E3 `details`), read by Settings ▸ Email, System Health and Home\n * (iox-mail-plan ML3). Never a key. Own mode carries `mode` alone (plus what Mailjet's check found).\n */\nexport interface MailerDetails {\n mode: MailMode;\n /** IOX mode only: `mailStandingOf(usage)` */\n standing?: MailStanding;\n senderState?: MailSenderState;\n /** the transactional From — `<studio>@mail.iox.studio` */\n from?: string | null;\n /** the reminders' From — `<studio>@news.mail.iox.studio` */\n marketingFrom?: string | null;\n /** where replies go now: the row's `replyTo`, else the relay's default (the owner) */\n replyTo?: string | null;\n /** the row's own Reply-To, as typed — null when it uses the default */\n replyToSet?: string | null;\n quota?: number | null;\n ceiling?: number | null;\n periodStart?: string | null;\n periodEnd?: string | null;\n month?: RelayMonth | null;\n suppressions?: number;\n marketingPaused?: RelayUsage['marketingPaused'];\n /** this studio's emails refused for good in the last seven days (the outbox's own count) */\n notSentThisWeek?: number;\n upgradeUrl?: string | null;\n /** IOX mode only: the own sending domain (ML4) — `NO_MAIL_DOMAIN` when none is set */\n domain?: MailDomainAnswer | null;\n}\n\n/** At most this many test emails an hour, per studio (ML3-D3) — each counts against the month like any email. */\nexport const MAIL_TEST_PER_HOUR = 5;\n\n/** What became of a test email. */\nexport enum MailTestOutcome {\n /** handed to IOX mail's relay or the studio's own Mailjet, which took it */\n Sent = 'sent',\n /** stored in IOX mail's outbox — the relay could not take it now; it goes when it can */\n Queued = 'queued',\n /** refused: no route, the relay's reason, Mailjet's words */\n Refused = 'refused',\n /** this hour's test emails are used */\n Limited = 'limited',\n}\n\n/** `POST admin/api/org/:orgId/connectors/mailer/test-email` — the answer Settings ▸ Email shows in place. */\nexport interface MailTestAnswer {\n outcome: MailTestOutcome;\n /** the signed-in person's own address — the only one a test goes to */\n to: string;\n route: MailRoute;\n /** the relay's reason, or Mailjet's words — never a stack */\n detail: string | null;\n}\n","import { MailMode } from './mail-vocabulary';\n\n/** The studio's own Mailjet keys — the three an own mailer needs (the MAILER connector's `requiredKeys`, ML-D9). */\nexport const OWN_MAILER_KEYS: readonly string[] = ['publicKey', 'secretKey', 'originatorEmail'];\n\n/** Where one org's mail goes now. */\nexport enum MailRoute {\n /** its own active mailer row — ML-D8: own wins */\n Own = 'own',\n /** IOX's relay */\n Iox = 'iox',\n /** nowhere: no usable own row and no IOX mail in the plan */\n None = 'none',\n}\n\n/** A mailer row's settings, as the route reads them (decrypted; only presence is read). */\nexport interface MailerRowLike {\n mode?: unknown;\n publicKey?: unknown;\n secretKey?: unknown;\n originatorEmail?: unknown;\n}\n\nconst filled = (value: unknown): boolean => typeof value === 'string' && value.trim().length > 0;\n\n/** True when the row holds every key an own mailer needs. */\nexport function hasOwnMailerKeys(row: MailerRowLike | null | undefined): boolean {\n return !!row && OWN_MAILER_KEYS.every((key) => filled((row as Record<string, unknown>)[key]));\n}\n\n/**\n * A row's mode (ML-D9): the one it names; a row that names none is `own` when it holds its keys (every row stored\n * before IOX mail — its owner brought Mailjet), else `iox`. No row at all is `iox`.\n */\nexport function mailModeOf(row: MailerRowLike | null | undefined): MailMode {\n const asked = typeof row?.mode === 'string' ? row.mode.trim().toLowerCase() : '';\n if (asked === MailMode.Own || asked === MailMode.Iox) return asked as MailMode;\n return hasOwnMailerKeys(row) ? MailMode.Own : MailMode.Iox;\n}\n\n/** The keys a row needs to count as configured: its own keys in own mode, none in IOX mode (E1). */\nexport function requiredMailerKeys(row: MailerRowLike | null | undefined): string[] {\n return mailModeOf(row) === MailMode.Own ? [...OWN_MAILER_KEYS] : [];\n}\n\nexport interface MailRouteFacts {\n /** the org's ACTIVE mailer row, decrypted — null when it has none (or none is on) */\n activeRow: MailerRowLike | null;\n /** the plan has IOX mail (`features.ioxMail`) */\n ioxMail: boolean;\n}\n\n/**\n * THE route rule (ML-D8, R-ML1): an active row in own mode with its keys sends as today; anything else — no row, a row\n * turned off, a row set to IOX, a row still missing a key — goes through IOX mail when the plan has it, else nowhere.\n */\nexport function planMailRoute(facts: MailRouteFacts): MailRoute {\n const row = facts.activeRow;\n if (row && mailModeOf(row) === MailMode.Own && hasOwnMailerKeys(row)) return MailRoute.Own;\n return facts.ioxMail ? MailRoute.Iox : MailRoute.None;\n}\n","import type { RelayUsage } from './mail-wire';\n\n/**\n * Where a studio's IOX mail stands this month (iox-mail-plan ML-D5, the ML3 board's E2). ONE reading of the relay's\n * usage: the admin's pill, meter and note, System Health, Home and the bell (iox-cms's reconciler) all ask this — none\n * of them compares counts with a quota on its own.\n */\nexport enum MailStanding {\n /** sending, under 80% of the month */\n Healthy = 'healthy',\n /** 80% of the month's emails used — reminders still go */\n Low = 'low',\n /** the month's emails used: reminders are paused, receipts and codes continue up to twice the month */\n Full = 'full',\n /** twice the month's emails sent: nothing more goes until the month resets */\n Ceiling = 'ceiling',\n /** reminders paused by complaints, bounces or the operator (ML-D7) — receipts and codes unaffected */\n Paused = 'paused',\n /** IOX mail does not send for this studio: the relay never answered, holds no key, or the plan has none */\n Off = 'off',\n}\n\n/** The meter turns low — and the bell says so — once this share of the month is used (ML3-D2). */\nexport const MAIL_LOW_SHARE = 0.8;\n\n/** The month's emails used so far (both kinds — what the quota counts). */\nexport function mailEmailsUsed(usage: RelayUsage | null | undefined): number {\n return Math.max(0, Number(usage?.month?.total ?? 0) || 0);\n}\n\n/** Emails left this month before reminders pause; null = unlimited (or no usage). */\nexport function mailEmailsLeft(usage: RelayUsage | null | undefined): number | null {\n if (!usage || usage.quota === null || usage.quota === undefined) return null;\n return Math.max(usage.quota - mailEmailsUsed(usage), 0);\n}\n\n/** THE standing rule. The worst line crossed wins: off → ceiling → full → paused → low → healthy. */\nexport function mailStandingOf(usage: RelayUsage | null | undefined): MailStanding {\n if (!usage || !usage.enabled || !usage.configured) return MailStanding.Off;\n const used = mailEmailsUsed(usage);\n if (usage.ceiling !== null && usage.ceiling !== undefined && used >= usage.ceiling) return MailStanding.Ceiling;\n if (usage.quota !== null && usage.quota !== undefined && used >= usage.quota) return MailStanding.Full;\n if (usage.marketingPaused) return MailStanding.Paused;\n if (usage.quota !== null && usage.quota !== undefined && used >= MAIL_LOW_SHARE * usage.quota) return MailStanding.Low;\n return MailStanding.Healthy;\n}\n\n/** Reminders do not go in this standing (receipts and codes still do, except at the ceiling). */\nexport function remindersStopped(standing: MailStanding): boolean {\n return standing === MailStanding.Full || standing === MailStanding.Ceiling || standing === MailStanding.Paused;\n}\n\nconst MAIL_ADDRESS = /^[^\\s@<>(),;:\"]+@[^\\s@<>(),;:\"]+\\.[^\\s@<>(),;:\".]{2,}$/;\n\n/** A plain address a Reply-To may carry (`name@domain.tld`), trimmed — the admin's field and iox-cms's save both ask it. */\nexport function isMailAddress(value: unknown): boolean {\n return typeof value === 'string' && value.trim().length <= 254 && MAIL_ADDRESS.test(value.trim());\n}\n","/**\n * A studio's OWN sending domain (iox-mail-plan ML4, ML-D2 (b), R-ML3): the owner names an address on its domain, adds the\n * DNS records Mailjet gives, and IOX mail switches the From to that address only once Mailjet says the sender is active\n * AND SPF AND DKIM are ok — never before, and back to `mail.iox.studio` the moment a recheck finds a record gone.\n *\n * ONE judge of Mailjet's `sender` + `dns` answers (`mailSenderProblems`), used by the relay for an IOX-mail domain and by\n * iox-cms for a studio's own Mailjet key (commerce E4's sender check) — the two used to be one private copy each.\n */\n\n/** Where a studio's own sending domain stands — what Settings ▸ Email ▸ \"Send from my own domain\" shows. */\nexport enum MailDomainState {\n /** no own domain — mail goes from `<studio>@mail.iox.studio` */\n NotSet = 'not-set',\n /** named; Mailjet has not checked its records yet (never asked, or a check is running) */\n Waiting = 'waiting',\n /** the sender is active and SPF + DKIM are ok — mail goes from the studio's own address */\n Verified = 'verified',\n /** checked, and a record is missing or wrong — mail keeps going from `mail.iox.studio` */\n Failed = 'failed',\n}\n\n/** Why a sender is not verified — Mailjet's answers read (the values are commerce E4's, unchanged on the wire). */\nexport enum MailSenderProblem {\n /** no sender address at all */\n NoAddress = 'no-address',\n /** Mailjet does not know the address as a sender, or has not activated it (the ownership record) */\n SenderInactive = 'sender-inactive',\n /** the address's domain is not added to Mailjet */\n DomainMissing = 'domain-missing',\n SpfMissing = 'spf-missing',\n DkimMissing = 'dkim-missing',\n}\n\n/** The three records a domain needs — each one TXT. */\nexport enum MailDnsRecordRole {\n /** proves the domain is the studio's: Mailjet's ownership token */\n Ownership = 'ownership',\n /** lets Mailjet's servers send for the domain */\n Spf = 'spf',\n /** signs every message with the domain's key */\n Dkim = 'dkim',\n}\n\n/** One record to copy into the domain's DNS. */\nexport interface MailDnsRecord {\n role: MailDnsRecordRole;\n type: 'TXT';\n /** the full name — `mailjet._domainkey.alma.co.il` */\n name: string;\n /** the name as most DNS screens want it, relative to the domain (`mailjet._domainkey`; `@` for the domain itself) */\n host: string;\n value: string;\n /** Mailjet's last word on it: true ok · false wrong or missing · null not checked yet */\n ok: boolean | null;\n /** what Mailjet found wrong, in its words (bounded) */\n error?: string | null;\n}\n\n/** Why an address cannot become the studio's sending address. */\nexport enum MailDomainRefusal {\n /** not one plain address */\n NotAnAddress = 'not-an-address',\n /** `iox.studio` or any domain under it — IOX's own */\n PlatformDomain = 'platform-domain',\n /** a public mailbox (gmail.com, outlook.com…) — nobody but its provider can add records there */\n PublicMailbox = 'public-mailbox',\n /** another studio sends from this domain */\n Taken = 'taken',\n /** IOX mail is not on (no key, or the plan has none) */\n NotEnabled = 'not-enabled',\n /** Mailjet could not be asked — try again */\n Upstream = 'upstream',\n}\n\n/** Mailjet's sender row (v3 REST `sender`) — only what is read. */\nexport interface MailjetSenderRow {\n ID?: number;\n Email?: string;\n /** `Inactive` · `Active` · `Deleted` */\n Status?: string;\n /** -1 while inactive */\n DNSID?: number;\n}\n\n/** Mailjet's DNS row (v3 REST `dns/{id}`). Statuses: SPF `OK` · `Error` · `Not checked` · `Not found`; DKIM `OK` · `Error` · `Not checked`. */\nexport interface MailjetDnsRow {\n ID?: number;\n Domain?: string;\n SPFStatus?: string;\n SPFRecordValue?: string;\n DKIMStatus?: string;\n DKIMRecordName?: string;\n DKIMRecordValue?: string;\n OwnerShipToken?: string;\n OwnerShipTokenRecordName?: string;\n IsCheckInProgress?: boolean;\n LastCheckAt?: string;\n}\n\n/** Mailjet's `dns/{id}/check` answer — `OK` · `Error`, with its words. */\nexport interface MailjetDnsCheckRow {\n SPFStatus?: string;\n SPFErrors?: string;\n DKIMStatus?: string;\n DKIMErrors?: string;\n}\n\nconst ACTIVE = 'active';\nconst OK = 'ok';\nconst NOT_CHECKED = new Set(['not checked', '']);\nconst MAX_ERROR = 300;\n\n/** Mailjet's SPF include — merged into a domain's existing SPF record, never a second record beside it. */\nexport const MAILJET_SPF_INCLUDE = 'include:spf.mailjet.com';\n\n/** How often the owner's \"Check DNS\" really asks Mailjet; a sooner press answers the last check. */\nexport const MAIL_DOMAIN_CHECK_MIN_MS = 30_000;\n/** A verified domain is checked again this often — a removed record moves the From back to `mail.iox.studio`. */\nexport const MAIL_DOMAIN_RECHECK_MS = 24 * 60 * 60 * 1000;\n\n/** Domains IOX itself sends from — never a studio's own. */\nexport const PLATFORM_MAIL_DOMAINS: readonly string[] = ['iox.studio'];\n\n/** Public mailbox providers: an address there can never be verified by the studio (no access to the DNS). */\nexport const PUBLIC_MAILBOX_DOMAINS: readonly string[] = [\n 'gmail.com', 'googlemail.com', 'outlook.com', 'hotmail.com', 'live.com', 'msn.com', 'yahoo.com', 'ymail.com',\n 'icloud.com', 'me.com', 'mac.com', 'aol.com', 'proton.me', 'protonmail.com', 'gmx.com', 'gmx.net', 'zoho.com',\n 'yandex.com', 'mail.com', 'walla.co.il', 'walla.com',\n];\n\n/** The lower-cased domain of an address, or null. */\nexport function mailDomainOf(email: string | null | undefined): string | null {\n const at = String(email ?? '').lastIndexOf('@');\n const domain = at > 0 ? String(email).slice(at + 1).trim().toLowerCase().replace(/\\.$/, '') : '';\n return domain || null;\n}\n\nconst under = (domain: string, parent: string) => domain === parent || domain.endsWith(`.${parent}`);\n\n/** Why this address cannot be the studio's own sending address — null when it can (the relay adds `Taken`). */\nexport function ownAddressRefusal(address: unknown, platformDomains: readonly string[] = PLATFORM_MAIL_DOMAINS): MailDomainRefusal | null {\n if (typeof address !== 'string' || !isPlainAddress(address)) return MailDomainRefusal.NotAnAddress;\n const domain = mailDomainOf(address)!;\n if (platformDomains.some((p) => under(domain, p.toLowerCase()))) return MailDomainRefusal.PlatformDomain;\n if (PUBLIC_MAILBOX_DOMAINS.some((p) => under(domain, p))) return MailDomainRefusal.PublicMailbox;\n return null;\n}\n\nconst PLAIN_ADDRESS = /^[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]{1,64}@[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?(?:\\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)+$/;\n\nfunction isPlainAddress(value: string): boolean {\n const v = value.trim();\n return v.length <= 254 && PLAIN_ADDRESS.test(v) && /\\.[A-Za-z]{2,}$/.test(v);\n}\n\n/**\n * THE judge of Mailjet's answers for one address: verified only with an active sender AND SPF ok AND DKIM ok.\n * An empty list is verified. (commerce E4's sender check and the relay's own-domain check both ask this.)\n */\nexport function mailSenderProblems(email: string | null, sender: MailjetSenderRow | null, dns: MailjetDnsRow | null): MailSenderProblem[] {\n const problems: MailSenderProblem[] = [];\n if (!email || !mailDomainOf(email)) return [MailSenderProblem.NoAddress];\n if (String(sender?.Status ?? '').toLowerCase() !== ACTIVE) problems.push(MailSenderProblem.SenderInactive);\n if (!dns) problems.push(MailSenderProblem.DomainMissing);\n else {\n if (String(dns.SPFStatus ?? '').toLowerCase() !== OK) problems.push(MailSenderProblem.SpfMissing);\n if (String(dns.DKIMStatus ?? '').toLowerCase() !== OK) problems.push(MailSenderProblem.DkimMissing);\n }\n return problems;\n}\n\n/** A record's name relative to its domain — `@` for the domain itself. */\nexport function relativeDnsHost(name: string | null | undefined, domain: string): string {\n const full = String(name ?? '').trim().toLowerCase().replace(/\\.$/, '');\n if (!full || full === domain) return '@';\n return full.endsWith(`.${domain}`) ? full.slice(0, -(domain.length + 1)) : full;\n}\n\n/**\n * The SPF record to publish: the domain's existing `v=spf1` record with Mailjet's include added before its `all` term\n * (a domain may hold only ONE SPF record — a second one fails both), or Mailjet's own value when there is none.\n */\nexport function mergedSpf(existing: string | null | undefined, mailjetValue = `v=spf1 ${MAILJET_SPF_INCLUDE} ~all`): string {\n const current = String(existing ?? '').trim().replace(/^\"|\"$/g, '');\n if (!/^v=spf1(\\s|$)/i.test(current)) return mailjetValue;\n const terms = current.split(/\\s+/);\n if (terms.some((t) => t.toLowerCase() === MAILJET_SPF_INCLUDE)) return terms.join(' ');\n const all = terms.findIndex((t, i) => i > 0 && /^[-~?+]?all$/i.test(t));\n if (all < 0) return [...terms, MAILJET_SPF_INCLUDE].join(' ');\n return [...terms.slice(0, all), MAILJET_SPF_INCLUDE, ...terms.slice(all)].join(' ');\n}\n\nconst bounded = (words: string | null | undefined) => {\n const w = String(words ?? '').replace(/\\s+/g, ' ').trim();\n return w ? w.slice(0, MAX_ERROR) : null;\n};\n\nconst statusOk = (status: string | undefined): boolean | null => {\n const s = String(status ?? '').trim().toLowerCase();\n if (NOT_CHECKED.has(s)) return null;\n return s === OK;\n};\n\n/** The three records to copy, each with Mailjet's last word on it. `existingSpf` = the domain's own SPF, when read. */\nexport function mailDnsRecords(\n domain: string,\n sender: MailjetSenderRow | null,\n dns: MailjetDnsRow | null,\n check?: MailjetDnsCheckRow | null,\n existingSpf?: string | null,\n): MailDnsRecord[] {\n if (!dns) return [];\n const record = (role: MailDnsRecordRole, name: string, value: string, ok: boolean | null, error?: string | null): MailDnsRecord =>\n ({ role, type: 'TXT', name, host: relativeDnsHost(name, domain), value, ok, error: ok === false ? bounded(error) : null });\n const records: MailDnsRecord[] = [];\n if (dns.OwnerShipToken) {\n const name = String(dns.OwnerShipTokenRecordName || domain).replace(/\\.$/, '');\n // a fresh sender is Inactive by birth: the ownership row reads \"wrong\" only after a check found it so\n const active = String(sender?.Status ?? '').toLowerCase() === ACTIVE;\n records.push(record(MailDnsRecordRole.Ownership, name, dns.OwnerShipToken, active ? true : check ? false : null, check ? 'Mailjet has not found this record yet' : null));\n }\n records.push(record(MailDnsRecordRole.Spf, domain, mergedSpf(existingSpf, dns.SPFRecordValue || undefined), statusOk(check?.SPFStatus ?? dns.SPFStatus), check?.SPFErrors));\n if (dns.DKIMRecordName && dns.DKIMRecordValue) {\n records.push(record(MailDnsRecordRole.Dkim, String(dns.DKIMRecordName).replace(/\\.$/, ''), dns.DKIMRecordValue, statusOk(check?.DKIMStatus ?? dns.DKIMStatus), check?.DKIMErrors));\n }\n return records;\n}\n\n/** `GET /instances/me/mail/domain` (and every domain call's answer). Dates are ISO strings on the wire. */\nexport interface MailDomainAnswer {\n /** the owner's chosen sending address on its domain — `shop@alma.co.il`; null when none is set */\n address: string | null;\n domain: string | null;\n state: MailDomainState;\n records: MailDnsRecord[];\n problems: MailSenderProblem[];\n /** when Mailjet last checked the records */\n checkedAt: string | null;\n /** when the domain was first found verified */\n verifiedAt: string | null;\n /** set when a domain that WAS verified failed a later check — the From went back to `mail.iox.studio` */\n lostAt: string | null;\n /**\n * The studio's IOX address (`<studio>@mail.iox.studio`) — where mail goes whenever the own domain does not send, so\n * the screen can say it even while the domain is verified (when both Froms are the own address). Absent from a relay\n * older than this field.\n */\n ioxAddress?: string | null;\n}\n\n/** iox-cms's answer to Settings ▸ Email (`…/connectors/mailer/domain`): the relay's, plus who may change it. */\nexport interface MailDomainView extends MailDomainAnswer {\n /** the signed-in person may set or stop using the address — the INSTANCE owner (ML4-D2); admins read and Check DNS */\n mayChange: boolean;\n}\n\n/**\n * A verified domain that a later check failed (ML4-D5): mail went back to the IOX address. THE rule for the bell's\n * \"Your own email domain stopped working\" and the card's \"DNS changed\" — `lostAt` stays until it is verified again.\n */\nexport function mailDomainLost(answer: Pick<MailDomainAnswer, 'state' | 'lostAt'> | null | undefined): boolean {\n return !!answer?.lostAt && answer.state !== MailDomainState.Verified;\n}\n\n/** No own domain. */\nexport const NO_MAIL_DOMAIN: MailDomainAnswer = Object.freeze({\n address: null, domain: null, state: MailDomainState.NotSet, records: [], problems: [], checkedAt: null, verifiedAt: null, lostAt: null,\n}) as MailDomainAnswer;\n\n/**\n * THE state rule: verified when nothing is wrong; waiting while nothing was checked yet (or Mailjet is checking now);\n * failed once a check found a record missing or wrong.\n */\nexport function mailDomainState(problems: readonly MailSenderProblem[], checked: boolean, inProgress = false): MailDomainState {\n if (!problems.length) return MailDomainState.Verified;\n if (inProgress || !checked) return MailDomainState.Waiting;\n return MailDomainState.Failed;\n}\n\n/** May mail go from this domain now? Only a verified answer for exactly this address's domain (R-ML3). */\nexport function mailDomainSends(answer: Pick<MailDomainAnswer, 'state' | 'address'> | null | undefined): string | null {\n return answer?.state === MailDomainState.Verified && answer.address ? answer.address.trim().toLowerCase() : null;\n}\n\n/** Is a verified domain due its daily recheck? */\nexport function mailDomainRecheckDue(answer: Pick<MailDomainAnswer, 'state' | 'checkedAt'> | null | undefined, now: number): boolean {\n if (answer?.state !== MailDomainState.Verified) return false;\n const at = answer.checkedAt ? Date.parse(answer.checkedAt) : NaN;\n return !Number.isFinite(at) || now - at >= MAIL_DOMAIN_RECHECK_MS;\n}\n\n/** The relay's own-domain routes. */\nexport const RELAY_MAIL_DOMAIN_PATH = '/instances/me/mail/domain';\nexport const RELAY_MAIL_DOMAIN_CHECK_PATH = '/instances/me/mail/domain/check';\n\n/** `PUT /instances/me/mail/domain` — the address mail should come from. */\nexport interface RelayDomainRequest {\n address: string;\n}\n\n/** A refused domain call: `{ code, message }` with 400 (`not-an-address` · `platform-domain` · `public-mailbox`), 409 (`taken`), 403/503 (`not-enabled`), 502 (`upstream`). */\nexport interface RelayDomainRefusalBody {\n code: MailDomainRefusal;\n message: string;\n}\n","/**\n * @vectoriox/iox-ui/mail-core — IOX Mail's shared, FRAMEWORK-FREE vocabulary (iox-mail-plan ML2): a message's kind,\n * who sends it, the relay's wire (`POST /instances/me/mail`, its usage) and refusals, and the ONE route rule — the\n * studio's own active mailer wins, else IOX mail when the plan has it. The control plane (the relay), iox-cms (the\n * transport and the MAILER connector) and the admin (Settings ▸ Email, ML3) speak it — and ML3 adds the ONE reading\n * of a studio's month (`mailStandingOf`: low at 80%, full, the 2× ceiling, paused, off), the connector's `MailerDetails`,\n * the Reply-To check and the test email's answer; ML4 the studio's own sending domain (`mail-domain`: ONE judge of\n * Mailjet's sender + DNS answers, the records to copy, the state rule). It imports nothing.\n * ⚠️ Not re-exported from the main entry. Consumers wire the usual trio — ng-package raw-ts assets, jest\n * moduleNameMapper, tsconfig paths — or `nest start` dies with ERR_REQUIRE_ESM.\n */\nexport * from './mail-vocabulary';\nexport * from './mail-wire';\nexport * from './mail-route';\nexport * from './mail-standing';\nexport * from './mail-domain';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAA;;;AAGG;AAEH;IACY;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAChB,IAAA,QAAA,CAAA,eAAA,CAAA,GAAA,eAA+B;AAC/B,IAAA,QAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AAC3B,CAAC,EAHW,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA;AAKpB;IACY;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAChB,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACX,IAAA,QAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACf,CAAC,EAHW,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA;AAKpB;;;AAGG;IACS;AAAZ,CAAA,UAAY,UAAU,EAAA;;AAElB,IAAA,UAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;;AAEjB,I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