@marlinjai/mail-contract 0.20.0 → 0.22.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.
package/dist/index.js CHANGED
@@ -142,10 +142,26 @@ __export(index_exports, {
142
142
  DEFAULT_INVITE_TTL_DAYS: () => DEFAULT_INVITE_TTL_DAYS,
143
143
  DEFAULT_PAGE_LIMIT: () => DEFAULT_PAGE_LIMIT,
144
144
  DOCUMENT_SCHEMA_VERSIONS: () => DOCUMENT_SCHEMA_VERSIONS,
145
+ DOMAIN_BUYING_BLOCKS: () => DOMAIN_BUYING_BLOCKS,
146
+ DOMAIN_BUYING_NOT_CONFIGURED_REASON: () => DOMAIN_BUYING_NOT_CONFIGURED_REASON,
147
+ DOMAIN_ORDER_KINDS: () => DOMAIN_ORDER_KINDS,
148
+ DOMAIN_ORDER_STATES: () => DOMAIN_ORDER_STATES,
149
+ DOMAIN_PRICE_CHANGED_REASON: () => DOMAIN_PRICE_CHANGED_REASON,
150
+ DOMAIN_UNAVAILABLE_REASONS: () => DOMAIN_UNAVAILABLE_REASONS,
145
151
  DateOnly: () => DateOnly,
146
152
  DatePassedAnswer: () => DatePassedAnswer,
147
153
  DelayStep: () => DelayStep,
148
154
  DocumentSchemaVersion: () => DocumentSchemaVersion,
155
+ DomainBuyingBlock: () => DomainBuyingBlock,
156
+ DomainOffer: () => DomainOffer,
157
+ DomainOrder: () => DomainOrder,
158
+ DomainOrderCreate: () => DomainOrderCreate,
159
+ DomainOrderKind: () => DomainOrderKind,
160
+ DomainOrderState: () => DomainOrderState,
161
+ DomainRegistrant: () => DomainRegistrant,
162
+ DomainSearchQuery: () => DomainSearchQuery,
163
+ DomainSearchResult: () => DomainSearchResult,
164
+ DomainUnavailableReason: () => DomainUnavailableReason,
149
165
  EDITABLE_MAILING_STATUSES: () => EDITABLE_MAILING_STATUSES,
150
166
  ERROR_CODES: () => ERROR_CODES,
151
167
  ERROR_STATUS: () => ERROR_STATUS,
@@ -229,6 +245,7 @@ __export(index_exports, {
229
245
  MAX_ASSET_BYTES: () => MAX_ASSET_BYTES,
230
246
  MAX_DELAY_SECONDS: () => MAX_DELAY_SECONDS,
231
247
  MAX_DOCUMENT_BYTES: () => MAX_DOCUMENT_BYTES,
248
+ MAX_DOMAIN_ORDERS_PER_DAY: () => MAX_DOMAIN_ORDERS_PER_DAY,
232
249
  MAX_ENGAGEMENT_DAYS: () => MAX_ENGAGEMENT_DAYS,
233
250
  MAX_EXPORT_WARNINGS_HEADER_LENGTH: () => MAX_EXPORT_WARNINGS_HEADER_LENGTH,
234
251
  MAX_EXTRA_SENDING_DOMAINS: () => MAX_EXTRA_SENDING_DOMAINS,
@@ -353,6 +370,7 @@ __export(index_exports, {
353
370
  QuietHours: () => QuietHours,
354
371
  RECIPIENT_REJECTIONS: () => RECIPIENT_REJECTIONS,
355
372
  RECIPIENT_STATUSES: () => RECIPIENT_STATUSES,
373
+ REGISTRY_PHONE: () => REGISTRY_PHONE,
356
374
  REQUEST_ID_HEADER: () => REQUEST_ID_HEADER,
357
375
  RESEND_EVENT_TYPES: () => RESEND_EVENT_TYPES,
358
376
  RESERVED_MERGE_FIELDS: () => RESERVED_MERGE_FIELDS,
@@ -539,6 +557,7 @@ __export(index_exports, {
539
557
  demoteForSave: () => demoteForSave,
540
558
  demotedBySave: () => demotedBySave,
541
559
  describeMissingTexts: () => describeMissingTexts,
560
+ domainBuyingRoutes: () => domainBuyingRoutes,
542
561
  draftDocument: () => draftDocument,
543
562
  draftInsertionProblems: () => draftInsertionProblems,
544
563
  draftsDirty: () => draftsDirty,
@@ -589,6 +608,7 @@ __export(index_exports, {
589
608
  missingInsertionTexts: () => missingInsertionTexts,
590
609
  missingRequiredMergeFields: () => missingRequiredMergeFields,
591
610
  normalizeChoiceKey: () => normalizeChoiceKey,
611
+ normalizePhone: () => normalizePhone,
592
612
  nowSeconds: () => nowSeconds,
593
613
  operationsWithAccess: () => operationsWithAccess,
594
614
  ownEntry: () => ownEntry,
@@ -789,8 +809,11 @@ var RETRYABLE_ERRORS = [
789
809
  "service_unavailable"
790
810
  ];
791
811
  var BILLING_NOT_CONFIGURED_REASON = "billing_not_configured";
812
+ var DOMAIN_BUYING_NOT_CONFIGURED_REASON = "domain_buying_not_configured";
813
+ var DOMAIN_PRICE_CHANGED_REASON = "price_changed";
814
+ var LASTING_REASONS = [BILLING_NOT_CONFIGURED_REASON, DOMAIN_BUYING_NOT_CONFIGURED_REASON];
792
815
  function isRetryableError(code, details) {
793
- return RETRYABLE_ERRORS.includes(code) && details?.reason !== BILLING_NOT_CONFIGURED_REASON;
816
+ return RETRYABLE_ERRORS.includes(code) && !LASTING_REASONS.includes(details?.reason);
794
817
  }
795
818
 
796
819
  // src/headers.ts
@@ -3443,7 +3466,7 @@ var EventListQuery = PageQuery.extend({
3443
3466
 
3444
3467
  // src/legal.ts
3445
3468
  var import_zod11 = require("zod");
3446
- var LEGAL_TERMS_VERSION = "2026-10-23";
3469
+ var LEGAL_TERMS_VERSION = "2026-10-28";
3447
3470
  var AcceptTerms = import_zod11.z.literal(LEGAL_TERMS_VERSION, {
3448
3471
  errorMap: () => ({ message: `must be "${LEGAL_TERMS_VERSION}": accept the current terms of service and processing agreement` })
3449
3472
  });
@@ -3696,6 +3719,15 @@ var AUDIT_ACTIONS = [
3696
3719
  "billing.exemption_changed",
3697
3720
  "billing.extra_sending_domains_changed",
3698
3721
  "billing.terms_accepted",
3722
+ // Domains bought inside Lumitra Mail
3723
+ "domain_order.created",
3724
+ "domain_order.paid",
3725
+ "domain_order.registered",
3726
+ "domain_order.ready",
3727
+ "domain_order.needs_attention",
3728
+ "domain_order.kind_changed",
3729
+ "domain_order.refunded",
3730
+ "domain_order.cancelled",
3699
3731
  // A1: automations
3700
3732
  "automation.created",
3701
3733
  "automation.updated",
@@ -3710,7 +3742,7 @@ var AUDIT_ACTIONS = [
3710
3742
  "event.recorded"
3711
3743
  ];
3712
3744
  var AuditAction = import_zod12.z.enum(AUDIT_ACTIONS);
3713
- var TRUSTED_APPS = ["booking"];
3745
+ var TRUSTED_APPS = ["booking", "sites"];
3714
3746
  var TrustedApp = import_zod12.z.enum(TRUSTED_APPS);
3715
3747
  var AuditActor = import_zod12.z.discriminatedUnion("type", [
3716
3748
  import_zod12.z.object({
@@ -4619,36 +4651,418 @@ function senderOnDomain(input, ctx) {
4619
4651
  var SendingDomainCreate = import_zod15.z.object({ domain: SendingDomainName, ...SenderFields }).superRefine(senderOnDomain);
4620
4652
  var SendingDomainUpdate = import_zod15.z.object({ from_name: SenderFields.from_name.optional(), from_email: Email.optional(), reply_to: Email.nullable().optional() }).refine((v) => Object.keys(v).length > 0, "nothing to change");
4621
4653
 
4622
- // src/contacts.ts
4654
+ // src/domains.ts
4623
4655
  var import_zod16 = require("zod");
4624
- var Topic = import_zod16.z.object({
4656
+
4657
+ // src/phone.ts
4658
+ var REGISTRY_PHONE = /^\+\d{1,3}\.\d{4,14}$/;
4659
+ var CALLING_CODE_OF_COUNTRY = {
4660
+ DE: "49",
4661
+ AT: "43",
4662
+ CH: "41",
4663
+ LI: "423",
4664
+ LU: "352",
4665
+ NL: "31",
4666
+ BE: "32",
4667
+ FR: "33",
4668
+ IT: "39",
4669
+ ES: "34",
4670
+ PT: "351",
4671
+ IE: "353",
4672
+ GB: "44",
4673
+ DK: "45",
4674
+ SE: "46",
4675
+ NO: "47",
4676
+ FI: "358",
4677
+ IS: "354",
4678
+ PL: "48",
4679
+ CZ: "420",
4680
+ SK: "421",
4681
+ HU: "36",
4682
+ SI: "386",
4683
+ HR: "385",
4684
+ RO: "40",
4685
+ BG: "359",
4686
+ GR: "30",
4687
+ CY: "357",
4688
+ MT: "356",
4689
+ EE: "372",
4690
+ LV: "371",
4691
+ LT: "370",
4692
+ US: "1",
4693
+ CA: "1",
4694
+ AU: "61",
4695
+ NZ: "64",
4696
+ TR: "90",
4697
+ IL: "972",
4698
+ AE: "971",
4699
+ IN: "91",
4700
+ JP: "81",
4701
+ CN: "86",
4702
+ SG: "65",
4703
+ ZA: "27",
4704
+ BR: "55",
4705
+ MX: "52",
4706
+ UA: "380",
4707
+ RS: "381"
4708
+ };
4709
+ var CALLING_CODES = /* @__PURE__ */ new Set([
4710
+ "1",
4711
+ "7",
4712
+ "20",
4713
+ "27",
4714
+ "30",
4715
+ "31",
4716
+ "32",
4717
+ "33",
4718
+ "34",
4719
+ "36",
4720
+ "39",
4721
+ "40",
4722
+ "41",
4723
+ "43",
4724
+ "44",
4725
+ "45",
4726
+ "46",
4727
+ "47",
4728
+ "48",
4729
+ "49",
4730
+ "51",
4731
+ "52",
4732
+ "53",
4733
+ "54",
4734
+ "55",
4735
+ "56",
4736
+ "57",
4737
+ "58",
4738
+ "60",
4739
+ "61",
4740
+ "62",
4741
+ "63",
4742
+ "64",
4743
+ "65",
4744
+ "66",
4745
+ "81",
4746
+ "82",
4747
+ "84",
4748
+ "86",
4749
+ "90",
4750
+ "91",
4751
+ "92",
4752
+ "93",
4753
+ "94",
4754
+ "95",
4755
+ "98",
4756
+ "211",
4757
+ "212",
4758
+ "213",
4759
+ "216",
4760
+ "218",
4761
+ "220",
4762
+ "221",
4763
+ "222",
4764
+ "223",
4765
+ "224",
4766
+ "225",
4767
+ "226",
4768
+ "227",
4769
+ "228",
4770
+ "229",
4771
+ "230",
4772
+ "231",
4773
+ "232",
4774
+ "233",
4775
+ "234",
4776
+ "235",
4777
+ "236",
4778
+ "237",
4779
+ "238",
4780
+ "239",
4781
+ "240",
4782
+ "241",
4783
+ "242",
4784
+ "243",
4785
+ "244",
4786
+ "245",
4787
+ "246",
4788
+ "247",
4789
+ "248",
4790
+ "249",
4791
+ "250",
4792
+ "251",
4793
+ "252",
4794
+ "253",
4795
+ "254",
4796
+ "255",
4797
+ "256",
4798
+ "257",
4799
+ "258",
4800
+ "260",
4801
+ "261",
4802
+ "262",
4803
+ "263",
4804
+ "264",
4805
+ "265",
4806
+ "266",
4807
+ "267",
4808
+ "268",
4809
+ "269",
4810
+ "290",
4811
+ "291",
4812
+ "297",
4813
+ "298",
4814
+ "299",
4815
+ "350",
4816
+ "351",
4817
+ "352",
4818
+ "353",
4819
+ "354",
4820
+ "355",
4821
+ "356",
4822
+ "357",
4823
+ "358",
4824
+ "359",
4825
+ "370",
4826
+ "371",
4827
+ "372",
4828
+ "373",
4829
+ "374",
4830
+ "375",
4831
+ "376",
4832
+ "377",
4833
+ "378",
4834
+ "379",
4835
+ "380",
4836
+ "381",
4837
+ "382",
4838
+ "383",
4839
+ "385",
4840
+ "386",
4841
+ "387",
4842
+ "389",
4843
+ "420",
4844
+ "421",
4845
+ "423",
4846
+ "500",
4847
+ "501",
4848
+ "502",
4849
+ "503",
4850
+ "504",
4851
+ "505",
4852
+ "506",
4853
+ "507",
4854
+ "508",
4855
+ "509",
4856
+ "590",
4857
+ "591",
4858
+ "592",
4859
+ "593",
4860
+ "594",
4861
+ "595",
4862
+ "596",
4863
+ "597",
4864
+ "598",
4865
+ "599",
4866
+ "670",
4867
+ "672",
4868
+ "673",
4869
+ "674",
4870
+ "675",
4871
+ "676",
4872
+ "677",
4873
+ "678",
4874
+ "679",
4875
+ "680",
4876
+ "681",
4877
+ "682",
4878
+ "683",
4879
+ "685",
4880
+ "686",
4881
+ "687",
4882
+ "688",
4883
+ "689",
4884
+ "690",
4885
+ "691",
4886
+ "692",
4887
+ "850",
4888
+ "852",
4889
+ "853",
4890
+ "855",
4891
+ "856",
4892
+ "880",
4893
+ "886",
4894
+ "960",
4895
+ "961",
4896
+ "962",
4897
+ "963",
4898
+ "964",
4899
+ "965",
4900
+ "966",
4901
+ "967",
4902
+ "968",
4903
+ "970",
4904
+ "971",
4905
+ "972",
4906
+ "973",
4907
+ "974",
4908
+ "975",
4909
+ "976",
4910
+ "977",
4911
+ "992",
4912
+ "993",
4913
+ "994",
4914
+ "995",
4915
+ "996",
4916
+ "998"
4917
+ ]);
4918
+ var KEEPS_LEADING_ZERO = /* @__PURE__ */ new Set(["39", "378", "379"]);
4919
+ function normalizePhone(raw, country) {
4920
+ const text = raw.trim();
4921
+ if (REGISTRY_PHONE.test(text)) return text;
4922
+ const compact = text.replace(/\(0\)/g, "").replace(/[\s\-./()]/g, "");
4923
+ let international;
4924
+ if (/^\+\d+$/.test(compact)) international = compact.slice(1);
4925
+ else if (/^00\d+$/.test(compact)) international = compact.slice(2);
4926
+ else if (/^0\d+$/.test(compact)) {
4927
+ const code = country ? CALLING_CODE_OF_COUNTRY[country.trim().toUpperCase()] : void 0;
4928
+ if (!code) return raw;
4929
+ return `+${code}.${KEEPS_LEADING_ZERO.has(code) ? compact : compact.slice(1)}`;
4930
+ } else return raw;
4931
+ for (const length of [1, 2, 3]) {
4932
+ const code = international.slice(0, length);
4933
+ if (CALLING_CODES.has(code)) {
4934
+ const rest = international.slice(length);
4935
+ return `+${code}.${KEEPS_LEADING_ZERO.has(code) ? rest : rest.replace(/^0/, "")}`;
4936
+ }
4937
+ }
4938
+ return raw;
4939
+ }
4940
+
4941
+ // src/domains.ts
4942
+ var DomainSearchQuery = import_zod16.z.object({ q: import_zod16.z.string().trim().min(1).max(63) });
4943
+ var DOMAIN_UNAVAILABLE_REASONS = ["taken", "extension_not_supported", "premium", "not_registrable"];
4944
+ var DomainUnavailableReason = import_zod16.z.enum(DOMAIN_UNAVAILABLE_REASONS);
4945
+ var DomainOffer = import_zod16.z.object({
4946
+ domain: import_zod16.z.string(),
4947
+ available: import_zod16.z.boolean(),
4948
+ reason: DomainUnavailableReason.nullable(),
4949
+ price_cents: import_zod16.z.number().int().min(0).nullable(),
4950
+ renewal_price_cents: import_zod16.z.number().int().min(0).nullable(),
4951
+ currency: import_zod16.z.literal("EUR")
4952
+ });
4953
+ var DOMAIN_BUYING_BLOCKS = ["not_configured", "paid_plan_required", "no_company"];
4954
+ var DomainBuyingBlock = import_zod16.z.enum(DOMAIN_BUYING_BLOCKS);
4955
+ var DomainSearchResult = import_zod16.z.object({
4956
+ data: import_zod16.z.array(DomainOffer),
4957
+ blocked: DomainBuyingBlock.nullable()
4958
+ });
4959
+ var DomainRegistrant = import_zod16.z.object({
4960
+ name: import_zod16.z.string().trim().min(3).max(120).regex(/\S+\s+\S+/, "must be a first and a last name"),
4961
+ organization: import_zod16.z.string().trim().min(1).max(120).nullable().optional(),
4962
+ email: Email,
4963
+ phone: import_zod16.z.string().trim().min(1).max(40),
4964
+ street: import_zod16.z.string().trim().min(3).max(200),
4965
+ city: import_zod16.z.string().trim().min(1).max(100),
4966
+ state: import_zod16.z.string().trim().min(1).max(100),
4967
+ postal_code: import_zod16.z.string().trim().min(2).max(20),
4968
+ country_code: import_zod16.z.string().trim().toUpperCase().regex(/^[A-Z]{2}$/, "must be a two-letter country code such as DE")
4969
+ }).superRefine((holder, ctx) => {
4970
+ if (typeof holder.phone === "string" && !REGISTRY_PHONE.test(normalizePhone(holder.phone, holder.country_code))) {
4971
+ ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["phone"], message: "must be a phone number with its country code, such as +49 30 1234 5678" });
4972
+ }
4973
+ }).transform((holder) => ({ ...holder, phone: normalizePhone(holder.phone, holder.country_code) }));
4974
+ var MAX_DOMAIN_ORDERS_PER_DAY = 2;
4975
+ var DOMAIN_ORDER_KINDS = ["sending", "domain_only"];
4976
+ var DomainOrderKind = import_zod16.z.enum(DOMAIN_ORDER_KINDS);
4977
+ var DomainOrderCreate = import_zod16.z.object({
4978
+ domain: SendingDomainName,
4979
+ price_cents: import_zod16.z.number().int().min(0),
4980
+ registrant: DomainRegistrant,
4981
+ kind: DomainOrderKind.default("sending"),
4982
+ from_name: import_zod16.z.string().trim().min(1).max(120).optional(),
4983
+ from_local_part: import_zod16.z.string().trim().toLowerCase().regex(/^[a-z0-9](?:[a-z0-9._+-]{0,62}[a-z0-9])?$/, "must be the part before the @, such as hello").optional(),
4984
+ /**
4985
+ * Where Stripe returns to after paying, and after leaving the payment. The
4986
+ * service adds `domain_order=<order id>` to both, so the page coming back
4987
+ * knows which order to show (and read: `domainOrders.get` confirms a
4988
+ * payment at once, before Stripe's webhook arrives).
4989
+ */
4990
+ success_url: import_zod16.z.string().url(),
4991
+ cancel_url: import_zod16.z.string().url(),
4992
+ /** The buyer accepted the terms of service (which cover bought domains) of this version. */
4993
+ accept_terms: AcceptTerms
4994
+ }).superRefine((order, ctx) => {
4995
+ if (order.kind !== "sending") return;
4996
+ if (!order.from_name) ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["from_name"], message: "is needed for a domain mail is sent from" });
4997
+ if (!order.from_local_part) ctx.addIssue({ code: import_zod16.z.ZodIssueCode.custom, path: ["from_local_part"], message: "is needed for a domain mail is sent from" });
4998
+ });
4999
+ var DOMAIN_ORDER_STATES = [
5000
+ "awaiting_payment",
5001
+ "paid",
5002
+ "registering",
5003
+ "setting_up",
5004
+ "ready",
5005
+ "needs_attention",
5006
+ "refunded",
5007
+ "cancelled"
5008
+ ];
5009
+ var DomainOrderState = import_zod16.z.enum(DOMAIN_ORDER_STATES);
5010
+ var DomainOrder = import_zod16.z.object({
5011
+ id: Id,
5012
+ domain: import_zod16.z.string(),
5013
+ state: DomainOrderState,
5014
+ price_cents: import_zod16.z.number().int().min(0),
5015
+ renewal_price_cents: import_zod16.z.number().int().min(0),
5016
+ currency: import_zod16.z.literal("EUR"),
5017
+ /** Stripe's payment page while `awaiting_payment`; null otherwise. */
5018
+ checkout_url: import_zod16.z.string().url().nullable(),
5019
+ registrant_name: import_zod16.z.string(),
5020
+ kind: DomainOrderKind,
5021
+ /** The sender, for a `sending` order; null for `domain_only`. */
5022
+ from_name: import_zod16.z.string().nullable(),
5023
+ from_email: Email.nullable(),
5024
+ /** The sending domain once `ready`. */
5025
+ sending_domain_id: Id.nullable(),
5026
+ /** When the paid year ends, once registered. */
5027
+ expires_at: Timestamp.nullable(),
5028
+ /** What went wrong, for `needs_attention` and `refunded`; null otherwise. */
5029
+ last_error: import_zod16.z.string().nullable(),
5030
+ paid_at: Timestamp.nullable(),
5031
+ registered_at: Timestamp.nullable(),
5032
+ created_at: Timestamp,
5033
+ updated_at: Timestamp
5034
+ });
5035
+
5036
+ // src/contacts.ts
5037
+ var import_zod17 = require("zod");
5038
+ var Topic = import_zod17.z.object({
4625
5039
  id: Id,
4626
5040
  slug: Slug,
4627
- name: import_zod16.z.string().min(1).max(120),
5041
+ name: import_zod17.z.string().min(1).max(120),
4628
5042
  /** Shown on the hosted preference page. */
4629
- description: import_zod16.z.string().max(1e3).nullable(),
5043
+ description: import_zod17.z.string().max(1e3).nullable(),
4630
5044
  /** Translations of `name` and `description` per locale, for the hosted page. */
4631
- translations: import_zod16.z.record(
4632
- import_zod16.z.object({ name: import_zod16.z.string().min(1).max(120), description: import_zod16.z.string().max(1e3).nullable() })
5045
+ translations: import_zod17.z.record(
5046
+ import_zod17.z.object({ name: import_zod17.z.string().min(1).max(120), description: import_zod17.z.string().max(1e3).nullable() })
4633
5047
  ),
4634
5048
  created_at: Timestamp,
4635
5049
  updated_at: Timestamp
4636
5050
  });
4637
- var TopicCreate = import_zod16.z.object({
5051
+ var TopicCreate = import_zod17.z.object({
4638
5052
  slug: Slug,
4639
- name: import_zod16.z.string().min(1).max(120),
4640
- description: import_zod16.z.string().max(1e3).optional(),
5053
+ name: import_zod17.z.string().min(1).max(120),
5054
+ description: import_zod17.z.string().max(1e3).optional(),
4641
5055
  translations: Topic.shape.translations.optional()
4642
5056
  });
4643
5057
  var TopicUpdate = TopicCreate.omit({ slug: true }).partial().refine((v) => Object.keys(v).length > 0, "at least one field");
4644
- var Contact = import_zod16.z.object({
5058
+ var Contact = import_zod17.z.object({
4645
5059
  id: Id,
4646
- external_id: import_zod16.z.string().min(1).max(255).nullable(),
5060
+ external_id: import_zod17.z.string().min(1).max(255).nullable(),
4647
5061
  /** Stored lowercased, unique per workspace. */
4648
5062
  email: Email,
4649
- first_name: import_zod16.z.string().max(200).nullable(),
4650
- last_name: import_zod16.z.string().max(200).nullable(),
4651
- locale: import_zod16.z.string().min(2).max(35).nullable(),
5063
+ first_name: import_zod17.z.string().max(200).nullable(),
5064
+ last_name: import_zod17.z.string().max(200).nullable(),
5065
+ locale: import_zod17.z.string().min(2).max(35).nullable(),
4652
5066
  /**
4653
5067
  * The person's own time zone, an IANA name such as `Europe/Berlin` (A1).
4654
5068
  * Every wall clock an automation waits for is read in it, falling back to the
@@ -4656,65 +5070,65 @@ var Contact = import_zod16.z.object({
4656
5070
  */
4657
5071
  timezone: TimezoneName.nullable(),
4658
5072
  properties: Properties,
4659
- topics: import_zod16.z.array(Slug),
5073
+ topics: import_zod17.z.array(Slug),
4660
5074
  /** The slugs of the contact's tags (S4). */
4661
- tags: import_zod16.z.array(Slug),
5075
+ tags: import_zod17.z.array(Slug),
4662
5076
  created_at: Timestamp,
4663
5077
  updated_at: Timestamp
4664
5078
  });
4665
- var ContactUpsert = import_zod16.z.object({
4666
- external_id: import_zod16.z.string().min(1).max(255).optional(),
5079
+ var ContactUpsert = import_zod17.z.object({
5080
+ external_id: import_zod17.z.string().min(1).max(255).optional(),
4667
5081
  email: Email.optional(),
4668
- first_name: import_zod16.z.string().max(200).nullable().optional(),
4669
- last_name: import_zod16.z.string().max(200).nullable().optional(),
4670
- locale: import_zod16.z.string().min(2).max(35).nullable().optional(),
5082
+ first_name: import_zod17.z.string().max(200).nullable().optional(),
5083
+ last_name: import_zod17.z.string().max(200).nullable().optional(),
5084
+ locale: import_zod17.z.string().min(2).max(35).nullable().optional(),
4671
5085
  timezone: TimezoneName.nullable().optional(),
4672
5086
  properties: Properties.optional(),
4673
- topics: import_zod16.z.array(Slug).max(100).optional()
5087
+ topics: import_zod17.z.array(Slug).max(100).optional()
4674
5088
  }).refine((v) => v.external_id !== void 0 || v.email !== void 0, {
4675
5089
  message: "external_id or email is required",
4676
5090
  path: ["email"]
4677
5091
  });
4678
- var ContactUpsertResult = import_zod16.z.object({
5092
+ var ContactUpsertResult = import_zod17.z.object({
4679
5093
  contact: Contact,
4680
- created: import_zod16.z.boolean()
5094
+ created: import_zod17.z.boolean()
4681
5095
  });
4682
5096
  var ContactListQuery = PageQuery.extend({
4683
- email: import_zod16.z.string().min(1).max(254).optional(),
4684
- external_id: import_zod16.z.string().min(1).max(255).optional(),
5097
+ email: import_zod17.z.string().min(1).max(254).optional(),
5098
+ external_id: import_zod17.z.string().min(1).max(255).optional(),
4685
5099
  topic: Slug.optional()
4686
5100
  });
4687
- var ContactErased = import_zod16.z.object({
4688
- ok: import_zod16.z.literal(true),
4689
- erased_messages: import_zod16.z.number().int().min(0),
4690
- erased_recipients: import_zod16.z.number().int().min(0),
4691
- suppressions_kept: import_zod16.z.number().int().min(0)
5101
+ var ContactErased = import_zod17.z.object({
5102
+ ok: import_zod17.z.literal(true),
5103
+ erased_messages: import_zod17.z.number().int().min(0),
5104
+ erased_recipients: import_zod17.z.number().int().min(0),
5105
+ suppressions_kept: import_zod17.z.number().int().min(0)
4692
5106
  });
4693
5107
  var SUPPRESSION_REASONS = ["unsubscribed", "bounced", "complained", "manual"];
4694
- var SuppressionReason = import_zod16.z.enum(SUPPRESSION_REASONS);
4695
- var Suppression = import_zod16.z.object({
5108
+ var SuppressionReason = import_zod17.z.enum(SUPPRESSION_REASONS);
5109
+ var Suppression = import_zod17.z.object({
4696
5110
  id: Id,
4697
5111
  email: Email,
4698
5112
  reason: SuppressionReason,
4699
5113
  topic: Slug.nullable(),
4700
5114
  source_message_id: Id.nullable(),
4701
- note: import_zod16.z.string().max(1e3).nullable(),
5115
+ note: import_zod17.z.string().max(1e3).nullable(),
4702
5116
  created_at: Timestamp
4703
5117
  });
4704
- var SuppressionCreate = import_zod16.z.object({
5118
+ var SuppressionCreate = import_zod17.z.object({
4705
5119
  email: Email,
4706
- reason: import_zod16.z.enum(["manual", "unsubscribed"]),
5120
+ reason: import_zod17.z.enum(["manual", "unsubscribed"]),
4707
5121
  topic: Slug.nullable().optional(),
4708
- note: import_zod16.z.string().max(1e3).optional()
5122
+ note: import_zod17.z.string().max(1e3).optional()
4709
5123
  });
4710
5124
  var SuppressionListQuery = PageQuery.extend({
4711
- email: import_zod16.z.string().min(1).max(254).optional(),
5125
+ email: import_zod17.z.string().min(1).max(254).optional(),
4712
5126
  reason: SuppressionReason.optional(),
4713
5127
  topic: Slug.optional()
4714
5128
  });
4715
5129
 
4716
5130
  // src/webhooks.ts
4717
- var import_zod17 = require("zod");
5131
+ var import_zod18 = require("zod");
4718
5132
  var WEBHOOK_EVENT_TYPES = [
4719
5133
  "message.sent",
4720
5134
  "message.failed",
@@ -4758,23 +5172,23 @@ var WEBHOOK_EVENT_TYPES = [
4758
5172
  "template.updated",
4759
5173
  "template.deleted"
4760
5174
  ];
4761
- var WebhookEventType = import_zod17.z.enum(WEBHOOK_EVENT_TYPES);
4762
- var MessageEventBase = import_zod17.z.object({
5175
+ var WebhookEventType = import_zod18.z.enum(WEBHOOK_EVENT_TYPES);
5176
+ var MessageEventBase = import_zod18.z.object({
4763
5177
  message_id: Id,
4764
5178
  mailing_id: Id.nullable(),
4765
5179
  mailing_metadata: MailingMetadata.nullable(),
4766
5180
  recipient_id: Id.nullable(),
4767
5181
  contact_id: Id.nullable(),
4768
- external_id: import_zod17.z.string().nullable(),
5182
+ external_id: import_zod18.z.string().nullable(),
4769
5183
  email: Email,
4770
- subject: import_zod17.z.string(),
5184
+ subject: import_zod18.z.string(),
4771
5185
  topic: Slug.nullable(),
4772
- provider_message_id: import_zod17.z.string().nullable(),
4773
- is_test: import_zod17.z.boolean()
5186
+ provider_message_id: import_zod18.z.string().nullable(),
5187
+ is_test: import_zod18.z.boolean()
4774
5188
  });
4775
5189
  var MessageSentData = MessageEventBase.extend({
4776
5190
  /** The final HTML as sent, so the client can archive it beside its own records. */
4777
- html: import_zod17.z.string(),
5191
+ html: import_zod18.z.string(),
4778
5192
  sent_at: Timestamp,
4779
5193
  /**
4780
5194
  * The choice each insertion made (see `Message.insertions`); absent or null
@@ -4785,20 +5199,20 @@ var MessageSentData = MessageEventBase.extend({
4785
5199
  insertions: InsertionChoices.nullish()
4786
5200
  });
4787
5201
  var MessageFailedData = MessageEventBase.extend({
4788
- error: import_zod17.z.string(),
5202
+ error: import_zod18.z.string(),
4789
5203
  /** False when the provider rejected permanently; the recipient will not be retried. */
4790
- retryable: import_zod17.z.boolean(),
5204
+ retryable: import_zod18.z.boolean(),
4791
5205
  failed_at: Timestamp
4792
5206
  });
4793
5207
  var UNSUBSCRIBE_SOURCES = ["hosted_page", "one_click", "api", "dashboard", "signup_form"];
4794
- var ContactUnsubscribedData = import_zod17.z.object({
5208
+ var ContactUnsubscribedData = import_zod18.z.object({
4795
5209
  contact_id: Id.nullable(),
4796
- external_id: import_zod17.z.string().nullable(),
5210
+ external_id: import_zod18.z.string().nullable(),
4797
5211
  email: Email,
4798
5212
  /** The topic unsubscribed from; null means every topic. */
4799
5213
  topic: Slug.nullable(),
4800
5214
  mailing_id: Id.nullable(),
4801
- source: import_zod17.z.enum(UNSUBSCRIBE_SOURCES),
5215
+ source: import_zod18.z.enum(UNSUBSCRIBE_SOURCES),
4802
5216
  unsubscribed_at: Timestamp
4803
5217
  });
4804
5218
  var ContactResubscribedData = ContactUnsubscribedData.omit({ unsubscribed_at: true }).extend({
@@ -4807,142 +5221,142 @@ var ContactResubscribedData = ContactUnsubscribedData.omit({ unsubscribed_at: tr
4807
5221
  * breaker undid a `bounced` block it judged false (a `contact.bounced` for the
4808
5222
  * same address and mailing went out before); `topic` is null.
4809
5223
  */
4810
- source: import_zod17.z.enum([...UNSUBSCRIBE_SOURCES, "bounce_reverted"]),
5224
+ source: import_zod18.z.enum([...UNSUBSCRIBE_SOURCES, "bounce_reverted"]),
4811
5225
  resubscribed_at: Timestamp
4812
5226
  });
4813
- var ContactBouncedData = import_zod17.z.object({
5227
+ var ContactBouncedData = import_zod18.z.object({
4814
5228
  contact_id: Id.nullable(),
4815
- external_id: import_zod17.z.string().nullable(),
5229
+ external_id: import_zod18.z.string().nullable(),
4816
5230
  email: Email,
4817
5231
  /** `bounced` for a hard bounce, `complained` for a spam complaint. */
4818
- reason: import_zod17.z.enum(["bounced", "complained"]),
5232
+ reason: import_zod18.z.enum(["bounced", "complained"]),
4819
5233
  message_id: Id.nullable(),
4820
- diagnostic: import_zod17.z.string().nullable(),
5234
+ diagnostic: import_zod18.z.string().nullable(),
4821
5235
  bounced_at: Timestamp
4822
5236
  });
4823
- var MailingFinishedData = import_zod17.z.object({
5237
+ var MailingFinishedData = import_zod18.z.object({
4824
5238
  mailing_id: Id,
4825
5239
  mailing_metadata: MailingMetadata,
4826
- status: import_zod17.z.enum(["sent", "partially_failed", "cancelled"]),
5240
+ status: import_zod18.z.enum(["sent", "partially_failed", "cancelled"]),
4827
5241
  counts: MailingCounts,
4828
5242
  finished_at: Timestamp
4829
5243
  });
4830
- var ContactSubscribedData = import_zod17.z.object({
5244
+ var ContactSubscribedData = import_zod18.z.object({
4831
5245
  contact_id: Id,
4832
- external_id: import_zod17.z.string().nullable(),
5246
+ external_id: import_zod18.z.string().nullable(),
4833
5247
  email: Email,
4834
- topics: import_zod17.z.array(Slug),
4835
- source: import_zod17.z.enum(["signup_form", "api", "dashboard", "automation"]),
5248
+ topics: import_zod18.z.array(Slug),
5249
+ source: import_zod18.z.enum(["signup_form", "api", "dashboard", "automation"]),
4836
5250
  signup_form_id: Id.nullable(),
4837
- signup_form_version: import_zod17.z.number().int().min(1).nullable(),
5251
+ signup_form_version: import_zod18.z.number().int().min(1).nullable(),
4838
5252
  subscribed_at: Timestamp
4839
5253
  });
4840
- var ImportFinishedData = import_zod17.z.object({
5254
+ var ImportFinishedData = import_zod18.z.object({
4841
5255
  import_id: Id,
4842
- status: import_zod17.z.enum(["completed", "cancelled", "failed"]),
5256
+ status: import_zod18.z.enum(["completed", "cancelled", "failed"]),
4843
5257
  result: ImportReport.nullable(),
4844
- error: import_zod17.z.string().nullable(),
5258
+ error: import_zod18.z.string().nullable(),
4845
5259
  finished_at: Timestamp
4846
5260
  });
4847
- var MailingScheduledData = import_zod17.z.object({
5261
+ var MailingScheduledData = import_zod18.z.object({
4848
5262
  mailing_id: Id,
4849
5263
  mailing_metadata: MailingMetadata,
4850
5264
  scheduled_at: Timestamp.nullable()
4851
5265
  });
4852
- var MailingStartedData = import_zod17.z.object({
5266
+ var MailingStartedData = import_zod18.z.object({
4853
5267
  mailing_id: Id,
4854
5268
  mailing_metadata: MailingMetadata,
4855
- trigger: import_zod17.z.enum(["send", "schedule"]),
4856
- recipients: import_zod17.z.number().int().min(0),
5269
+ trigger: import_zod18.z.enum(["send", "schedule"]),
5270
+ recipients: import_zod18.z.number().int().min(0),
4857
5271
  started_at: Timestamp
4858
5272
  });
4859
- var MailingScheduleFailedData = import_zod17.z.object({
5273
+ var MailingScheduleFailedData = import_zod18.z.object({
4860
5274
  mailing_id: Id,
4861
5275
  mailing_metadata: MailingMetadata,
4862
- code: import_zod17.z.string(),
4863
- message: import_zod17.z.string(),
5276
+ code: import_zod18.z.string(),
5277
+ message: import_zod18.z.string(),
4864
5278
  failed_at: Timestamp
4865
5279
  });
4866
- var MailingAbWinnerSelectedData = import_zod17.z.object({
5280
+ var MailingAbWinnerSelectedData = import_zod18.z.object({
4867
5281
  mailing_id: Id,
4868
5282
  mailing_metadata: MailingMetadata,
4869
- winner: import_zod17.z.string(),
4870
- decided_by: import_zod17.z.enum(["metric", "manual"]),
4871
- variants: import_zod17.z.array(VariantAnalytics),
5283
+ winner: import_zod18.z.string(),
5284
+ decided_by: import_zod18.z.enum(["metric", "manual"]),
5285
+ variants: import_zod18.z.array(VariantAnalytics),
4872
5286
  decided_at: Timestamp
4873
5287
  });
4874
- var ContactTaggedData = import_zod17.z.object({
5288
+ var ContactTaggedData = import_zod18.z.object({
4875
5289
  contact_id: Id,
4876
- external_id: import_zod17.z.string().nullable(),
5290
+ external_id: import_zod18.z.string().nullable(),
4877
5291
  email: Email,
4878
5292
  /** Only the tags the contact did not already have. */
4879
- tags: import_zod17.z.array(Slug).min(1),
4880
- source: import_zod17.z.enum(["api", "dashboard", "signup_form", "import", "automation"]),
5293
+ tags: import_zod18.z.array(Slug).min(1),
5294
+ source: import_zod18.z.enum(["api", "dashboard", "signup_form", "import", "automation"]),
4881
5295
  tagged_at: Timestamp
4882
5296
  });
4883
- var ContactUpdatedData = import_zod17.z.object({
5297
+ var ContactUpdatedData = import_zod18.z.object({
4884
5298
  contact_id: Id,
4885
- external_id: import_zod17.z.string().nullable(),
5299
+ external_id: import_zod18.z.string().nullable(),
4886
5300
  email: Email,
4887
- changed: import_zod17.z.array(import_zod17.z.string()).min(1),
5301
+ changed: import_zod18.z.array(import_zod18.z.string()).min(1),
4888
5302
  properties: Properties,
4889
- source: import_zod17.z.enum(["api", "dashboard", "signup_form", "import", "automation"]),
5303
+ source: import_zod18.z.enum(["api", "dashboard", "signup_form", "import", "automation"]),
4890
5304
  updated_at: Timestamp
4891
5305
  });
4892
- var AutomationRunEventBase = import_zod17.z.object({
5306
+ var AutomationRunEventBase = import_zod18.z.object({
4893
5307
  automation_id: Id,
4894
- automation_name: import_zod17.z.string(),
5308
+ automation_name: import_zod18.z.string(),
4895
5309
  run_id: Id,
4896
- version: import_zod17.z.number().int().min(1),
5310
+ version: import_zod18.z.number().int().min(1),
4897
5311
  contact_id: Id,
4898
- external_id: import_zod17.z.string().nullable(),
5312
+ external_id: import_zod18.z.string().nullable(),
4899
5313
  email: Email
4900
5314
  });
4901
5315
  var AutomationRunStartedData = AutomationRunEventBase.extend({
4902
5316
  /** What let them in: a trigger kind, or `manual` for an explicit enrolment. */
4903
- trigger_kind: import_zod17.z.string(),
5317
+ trigger_kind: import_zod18.z.string(),
4904
5318
  entered_at: Timestamp
4905
5319
  });
4906
5320
  var AutomationRunCompletedData = AutomationRunEventBase.extend({
4907
- last_step_id: import_zod17.z.string().nullable(),
5321
+ last_step_id: import_zod18.z.string().nullable(),
4908
5322
  completed_at: Timestamp
4909
5323
  });
4910
5324
  var AutomationRunExitedData = AutomationRunEventBase.extend({
4911
5325
  reason: AutomationEndReason,
4912
- step_id: import_zod17.z.string().nullable(),
5326
+ step_id: import_zod18.z.string().nullable(),
4913
5327
  exited_at: Timestamp
4914
5328
  });
4915
5329
  var AutomationRunFailedData = AutomationRunEventBase.extend({
4916
- reason: import_zod17.z.string(),
4917
- step_id: import_zod17.z.string().nullable(),
5330
+ reason: import_zod18.z.string(),
5331
+ step_id: import_zod18.z.string().nullable(),
4918
5332
  failed_at: Timestamp
4919
5333
  });
4920
5334
  var AutomationWebhookData = AutomationRunEventBase.extend({
4921
- step_id: import_zod17.z.string(),
5335
+ step_id: import_zod18.z.string(),
4922
5336
  /** The step's own label, when it was given one, so a receiver can branch on a name. */
4923
- step_label: import_zod17.z.string().nullable(),
5337
+ step_label: import_zod18.z.string().nullable(),
4924
5338
  /** Whatever the step carries, verbatim. Null when it carries nothing. */
4925
5339
  payload: JsonValue.nullable(),
4926
5340
  fired_at: Timestamp
4927
5341
  });
4928
- var TemplateEventBase = import_zod17.z.object({
5342
+ var TemplateEventBase = import_zod18.z.object({
4929
5343
  template_id: Id,
4930
- name: import_zod17.z.string().min(1).max(200),
4931
- version: import_zod17.z.number().int().min(1),
4932
- source: import_zod17.z.enum(["api", "dashboard", "mjml_import"])
5344
+ name: import_zod18.z.string().min(1).max(200),
5345
+ version: import_zod18.z.number().int().min(1),
5346
+ source: import_zod18.z.enum(["api", "dashboard", "mjml_import"])
4933
5347
  });
4934
5348
  var TemplateCreatedData = TemplateEventBase.extend({ created_at: Timestamp });
4935
- var TemplateUpdatedData = TemplateEventBase.extend({ archived: import_zod17.z.boolean(), updated_at: Timestamp });
5349
+ var TemplateUpdatedData = TemplateEventBase.extend({ archived: import_zod18.z.boolean(), updated_at: Timestamp });
4936
5350
  var TemplateDeletedData = TemplateEventBase.extend({ deleted_at: Timestamp });
4937
- var envelope = (type, data) => import_zod17.z.object({
5351
+ var envelope = (type, data) => import_zod18.z.object({
4938
5352
  /** Unique per event: a receiver deduplicates on it (deliveries may repeat). */
4939
5353
  id: Id,
4940
- type: import_zod17.z.literal(type),
5354
+ type: import_zod18.z.literal(type),
4941
5355
  created_at: Timestamp,
4942
5356
  workspace_id: Id,
4943
5357
  data
4944
5358
  });
4945
- var WebhookEvent = import_zod17.z.discriminatedUnion("type", [
5359
+ var WebhookEvent = import_zod18.z.discriminatedUnion("type", [
4946
5360
  envelope("message.sent", MessageSentData),
4947
5361
  envelope("message.failed", MessageFailedData),
4948
5362
  envelope("contact.unsubscribed", ContactUnsubscribedData),
@@ -4966,16 +5380,16 @@ var WebhookEvent = import_zod17.z.discriminatedUnion("type", [
4966
5380
  envelope("template.updated", TemplateUpdatedData),
4967
5381
  envelope("template.deleted", TemplateDeletedData)
4968
5382
  ]);
4969
- var WebhookEndpoint = import_zod17.z.object({
5383
+ var WebhookEndpoint = import_zod18.z.object({
4970
5384
  id: Id,
4971
- url: import_zod17.z.string().url(),
4972
- description: import_zod17.z.string().max(500).nullable(),
4973
- events: import_zod17.z.array(WebhookEventType).min(1),
4974
- enabled: import_zod17.z.boolean(),
5385
+ url: import_zod18.z.string().url(),
5386
+ description: import_zod18.z.string().max(500).nullable(),
5387
+ events: import_zod18.z.array(WebhookEventType).min(1),
5388
+ enabled: import_zod18.z.boolean(),
4975
5389
  created_at: Timestamp,
4976
5390
  updated_at: Timestamp
4977
5391
  });
4978
- var WebhookUrl = import_zod17.z.string().url().refine((u) => {
5392
+ var WebhookUrl = import_zod18.z.string().url().refine((u) => {
4979
5393
  try {
4980
5394
  const url = new URL(u);
4981
5395
  if (url.protocol === "https:") return true;
@@ -4984,35 +5398,35 @@ var WebhookUrl = import_zod17.z.string().url().refine((u) => {
4984
5398
  return false;
4985
5399
  }
4986
5400
  }, "must be https (http only for localhost)");
4987
- var WebhookEndpointCreate = import_zod17.z.object({
5401
+ var WebhookEndpointCreate = import_zod18.z.object({
4988
5402
  url: WebhookUrl,
4989
- description: import_zod17.z.string().max(500).optional(),
4990
- events: import_zod17.z.array(WebhookEventType).min(1),
4991
- enabled: import_zod17.z.boolean().optional()
5403
+ description: import_zod18.z.string().max(500).optional(),
5404
+ events: import_zod18.z.array(WebhookEventType).min(1),
5405
+ enabled: import_zod18.z.boolean().optional()
4992
5406
  });
4993
- var WebhookEndpointUpdate = import_zod17.z.object({
5407
+ var WebhookEndpointUpdate = import_zod18.z.object({
4994
5408
  url: WebhookUrl,
4995
- description: import_zod17.z.string().max(500).nullable(),
4996
- events: import_zod17.z.array(WebhookEventType).min(1),
4997
- enabled: import_zod17.z.boolean()
5409
+ description: import_zod18.z.string().max(500).nullable(),
5410
+ events: import_zod18.z.array(WebhookEventType).min(1),
5411
+ enabled: import_zod18.z.boolean()
4998
5412
  }).partial().refine((v) => Object.keys(v).length > 0, "at least one field");
4999
- var WebhookEndpointWithSecret = import_zod17.z.object({
5413
+ var WebhookEndpointWithSecret = import_zod18.z.object({
5000
5414
  endpoint: WebhookEndpoint,
5001
- secret: import_zod17.z.string().min(32)
5415
+ secret: import_zod18.z.string().min(32)
5002
5416
  });
5003
5417
  var WEBHOOK_DELIVERY_STATUSES = ["pending", "succeeded", "failed"];
5004
- var WebhookDeliveryStatus = import_zod17.z.enum(WEBHOOK_DELIVERY_STATUSES);
5418
+ var WebhookDeliveryStatus = import_zod18.z.enum(WEBHOOK_DELIVERY_STATUSES);
5005
5419
  var WEBHOOK_MAX_ATTEMPTS = 8;
5006
5420
  var WEBHOOK_RETRY_DELAYS_SECONDS = [30, 120, 600, 1800, 3600, 7200, 21600];
5007
- var WebhookDelivery = import_zod17.z.object({
5421
+ var WebhookDelivery = import_zod18.z.object({
5008
5422
  id: Id,
5009
5423
  endpoint_id: Id,
5010
5424
  event_id: Id,
5011
5425
  event_type: WebhookEventType,
5012
5426
  status: WebhookDeliveryStatus,
5013
- attempts: import_zod17.z.number().int().min(0),
5014
- last_status_code: import_zod17.z.number().int().min(100).max(599).nullable(),
5015
- last_error: import_zod17.z.string().nullable(),
5427
+ attempts: import_zod18.z.number().int().min(0),
5428
+ last_status_code: import_zod18.z.number().int().min(100).max(599).nullable(),
5429
+ last_error: import_zod18.z.string().nullable(),
5016
5430
  next_attempt_at: Timestamp.nullable(),
5017
5431
  delivered_at: Timestamp.nullable(),
5018
5432
  created_at: Timestamp
@@ -5021,7 +5435,7 @@ var WebhookDeliveryListQuery = PageQuery.extend({
5021
5435
  status: WebhookDeliveryStatus.optional(),
5022
5436
  event_type: WebhookEventType.optional()
5023
5437
  });
5024
- var WebhookDeliveryParams = import_zod17.z.object({ id: Id, delivery_id: Id });
5438
+ var WebhookDeliveryParams = import_zod18.z.object({ id: Id, delivery_id: Id });
5025
5439
 
5026
5440
  // src/webhook-signing.ts
5027
5441
  var WEBHOOK_SIGNATURE_HEADER = "x-mail-signature";
@@ -5088,99 +5502,99 @@ async function verifyWebhook(input) {
5088
5502
  }
5089
5503
 
5090
5504
  // src/billing.ts
5091
- var import_zod18 = require("zod");
5505
+ var import_zod19 = require("zod");
5092
5506
  var PLAN_IDS = ["free", "starter", "growth", "design_partner"];
5093
- var PlanId = import_zod18.z.enum(PLAN_IDS);
5094
- var PlanLimits = import_zod18.z.object({
5095
- monthly_messages: import_zod18.z.number().int().min(0).nullable(),
5096
- contacts: import_zod18.z.number().int().min(0).nullable(),
5097
- members: import_zod18.z.number().int().min(1).nullable(),
5098
- providers: import_zod18.z.number().int().min(1).nullable(),
5099
- webhook_endpoints: import_zod18.z.number().int().min(0).nullable(),
5507
+ var PlanId = import_zod19.z.enum(PLAN_IDS);
5508
+ var PlanLimits = import_zod19.z.object({
5509
+ monthly_messages: import_zod19.z.number().int().min(0).nullable(),
5510
+ contacts: import_zod19.z.number().int().min(0).nullable(),
5511
+ members: import_zod19.z.number().int().min(1).nullable(),
5512
+ providers: import_zod19.z.number().int().min(1).nullable(),
5513
+ webhook_endpoints: import_zod19.z.number().int().min(0).nullable(),
5100
5514
  /** Automations that may be live (active or paused) at once (A1). */
5101
- active_automations: import_zod18.z.number().int().min(0).nullable(),
5515
+ active_automations: import_zod19.z.number().int().min(0).nullable(),
5102
5516
  /** Steps one automation may hold. Null is the flow's own cap, not unlimited. */
5103
- automation_steps: import_zod18.z.number().int().min(1).nullable(),
5517
+ automation_steps: import_zod19.z.number().int().min(1).nullable(),
5104
5518
  /** Own domains Lumitra Mail sends from (managed sending domains); 0 when the plan has none. */
5105
- sending_domains: import_zod18.z.number().int().min(0).nullable()
5519
+ sending_domains: import_zod19.z.number().int().min(0).nullable()
5106
5520
  });
5107
- var PlanFeatures = import_zod18.z.object({
5521
+ var PlanFeatures = import_zod19.z.object({
5108
5522
  /** A/B tests of subject and content on a mailing (S4). */
5109
- ab_testing: import_zod18.z.boolean(),
5523
+ ab_testing: import_zod19.z.boolean(),
5110
5524
  /** Open and click tracking, still off until a workspace turns it on (`settings.tracking_enabled`). */
5111
- tracking: import_zod18.z.boolean(),
5525
+ tracking: import_zod19.z.boolean(),
5112
5526
  /** Automations: flows a person walks through step by step (A1). */
5113
- automations: import_zod18.z.boolean()
5527
+ automations: import_zod19.z.boolean()
5114
5528
  });
5115
5529
  var PLAN_FEATURES = ["ab_testing", "tracking", "automations"];
5116
- var Plan = import_zod18.z.object({
5530
+ var Plan = import_zod19.z.object({
5117
5531
  id: PlanId,
5118
- name: import_zod18.z.string().min(1),
5532
+ name: import_zod19.z.string().min(1),
5119
5533
  /** Price in the smallest currency unit per month; null for plans not sold. */
5120
- monthly_price_cents: import_zod18.z.number().int().min(0).nullable(),
5121
- currency: import_zod18.z.string().length(3),
5534
+ monthly_price_cents: import_zod19.z.number().int().min(0).nullable(),
5535
+ currency: import_zod19.z.string().length(3),
5122
5536
  limits: PlanLimits,
5123
5537
  features: PlanFeatures
5124
5538
  });
5125
- var CatalogPlan = Plan.extend({ sellable: import_zod18.z.boolean() });
5126
- var Subscription = import_zod18.z.object({
5539
+ var CatalogPlan = Plan.extend({ sellable: import_zod19.z.boolean() });
5540
+ var Subscription = import_zod19.z.object({
5127
5541
  workspace_id: Id,
5128
5542
  plan: PlanId,
5129
- status: import_zod18.z.enum(["active", "trialing", "past_due", "cancelled"]),
5543
+ status: import_zod19.z.enum(["active", "trialing", "past_due", "cancelled"]),
5130
5544
  current_period_start: Timestamp,
5131
5545
  current_period_end: Timestamp,
5132
- cancel_at_period_end: import_zod18.z.boolean(),
5546
+ cancel_at_period_end: import_zod19.z.boolean(),
5133
5547
  /**
5134
5548
  * A design partner outside billing (plan `design_partner`, no limits, no
5135
5549
  * checkout). Set only by an operator, never through the API.
5136
5550
  */
5137
- billing_exempt: import_zod18.z.boolean(),
5551
+ billing_exempt: import_zod19.z.boolean(),
5138
5552
  /**
5139
5553
  * Own sending domains bought on top of the plan's included ones (the
5140
5554
  * add-on), each a monthly charge on the same subscription. 0 without the
5141
5555
  * add-on; the usage limit `sending_domains` is the plan's plus these.
5142
5556
  */
5143
- extra_sending_domains: import_zod18.z.number().int().min(0)
5557
+ extra_sending_domains: import_zod19.z.number().int().min(0)
5144
5558
  });
5145
- var BillingAddons = import_zod18.z.object({
5146
- sending_domain: import_zod18.z.object({
5147
- monthly_price_cents: import_zod18.z.number().int().min(0),
5148
- currency: import_zod18.z.string().length(3),
5149
- sellable: import_zod18.z.boolean()
5559
+ var BillingAddons = import_zod19.z.object({
5560
+ sending_domain: import_zod19.z.object({
5561
+ monthly_price_cents: import_zod19.z.number().int().min(0),
5562
+ currency: import_zod19.z.string().length(3),
5563
+ sellable: import_zod19.z.boolean()
5150
5564
  })
5151
5565
  });
5152
5566
  var MAX_EXTRA_SENDING_DOMAINS = 100;
5153
- var ExtraSendingDomainsUpdate = import_zod18.z.object({ quantity: import_zod18.z.number().int().min(0).max(MAX_EXTRA_SENDING_DOMAINS) });
5567
+ var ExtraSendingDomainsUpdate = import_zod19.z.object({ quantity: import_zod19.z.number().int().min(0).max(MAX_EXTRA_SENDING_DOMAINS) });
5154
5568
  var USAGE_METRICS = ["messages", "contacts", "members", "providers", "webhook_endpoints", "active_automations", "sending_domains"];
5155
- var UsageMetric = import_zod18.z.enum(USAGE_METRICS);
5569
+ var UsageMetric = import_zod19.z.enum(USAGE_METRICS);
5156
5570
  var USAGE_WARNING_RATIO = 0.8;
5157
- var UsageWarning = import_zod18.z.object({
5571
+ var UsageWarning = import_zod19.z.object({
5158
5572
  metric: UsageMetric,
5159
- used: import_zod18.z.number().int().min(0),
5160
- limit: import_zod18.z.number().int().min(0),
5573
+ used: import_zod19.z.number().int().min(0),
5574
+ limit: import_zod19.z.number().int().min(0),
5161
5575
  /** `approaching`: at or above USAGE_WARNING_RATIO of the limit; `reached`: at or above the limit. */
5162
- level: import_zod18.z.enum(["approaching", "reached"])
5576
+ level: import_zod19.z.enum(["approaching", "reached"])
5163
5577
  });
5164
- var TermsStatus = import_zod18.z.object({ accepted_version: import_zod18.z.string().nullable(), current_version: import_zod18.z.string() });
5165
- var Usage = import_zod18.z.object({
5578
+ var TermsStatus = import_zod19.z.object({ accepted_version: import_zod19.z.string().nullable(), current_version: import_zod19.z.string() });
5579
+ var Usage = import_zod19.z.object({
5166
5580
  plan: PlanId,
5167
5581
  period_start: Timestamp,
5168
5582
  period_end: Timestamp,
5169
- metrics: import_zod18.z.record(UsageMetric, import_zod18.z.object({ used: import_zod18.z.number().int().min(0), limit: import_zod18.z.number().int().min(0).nullable() })),
5170
- warnings: import_zod18.z.array(UsageWarning),
5583
+ metrics: import_zod19.z.record(UsageMetric, import_zod19.z.object({ used: import_zod19.z.number().int().min(0), limit: import_zod19.z.number().int().min(0).nullable() })),
5584
+ warnings: import_zod19.z.array(UsageWarning),
5171
5585
  terms: TermsStatus
5172
5586
  });
5173
- var TermsAcceptance = import_zod18.z.object({ accept_terms: AcceptTerms });
5174
- var CheckoutRequest = import_zod18.z.object({
5175
- plan: import_zod18.z.enum(["starter", "growth"]),
5176
- success_url: import_zod18.z.string().url(),
5177
- cancel_url: import_zod18.z.string().url(),
5587
+ var TermsAcceptance = import_zod19.z.object({ accept_terms: AcceptTerms });
5588
+ var CheckoutRequest = import_zod19.z.object({
5589
+ plan: import_zod19.z.enum(["starter", "growth"]),
5590
+ success_url: import_zod19.z.string().url(),
5591
+ cancel_url: import_zod19.z.string().url(),
5178
5592
  /** The buyer accepted the terms of service and the processing agreement of this version. */
5179
5593
  accept_terms: AcceptTerms
5180
5594
  });
5181
- var CheckoutSession = import_zod18.z.object({ url: import_zod18.z.string().url() });
5182
- var PortalRequest = import_zod18.z.object({ return_url: import_zod18.z.string().url() });
5183
- var PortalSession = import_zod18.z.object({ url: import_zod18.z.string().url() });
5595
+ var CheckoutSession = import_zod19.z.object({ url: import_zod19.z.string().url() });
5596
+ var PortalRequest = import_zod19.z.object({ return_url: import_zod19.z.string().url() });
5597
+ var PortalSession = import_zod19.z.object({ url: import_zod19.z.string().url() });
5184
5598
  var USAGE_WARNING_HEADER = "x-mail-usage-warning";
5185
5599
  function formatUsageWarningHeader(warnings) {
5186
5600
  if (warnings.length === 0) return null;
@@ -5200,7 +5614,7 @@ function parseUsageWarningHeader(value) {
5200
5614
  }
5201
5615
 
5202
5616
  // src/routes.ts
5203
- var import_zod19 = require("zod");
5617
+ var import_zod20 = require("zod");
5204
5618
  var list = (item) => page(item);
5205
5619
  var foundationRoutes = {
5206
5620
  "workspaces.create": {
@@ -5446,7 +5860,7 @@ var templateRoutes = {
5446
5860
  path: "/v1/templates/:id/export",
5447
5861
  params: IdParams,
5448
5862
  query: TemplateExportQuery,
5449
- response: import_zod19.z.string(),
5863
+ response: import_zod20.z.string(),
5450
5864
  responseType: "text",
5451
5865
  status: 200,
5452
5866
  access: "read",
@@ -5826,7 +6240,7 @@ var sendingRoutes = {
5826
6240
  path: "/v1/mailings/:id/export",
5827
6241
  params: IdParams,
5828
6242
  query: MailingExportQuery,
5829
- response: import_zod19.z.string(),
6243
+ response: import_zod20.z.string(),
5830
6244
  responseType: "text",
5831
6245
  status: 200,
5832
6246
  access: "read",
@@ -6093,7 +6507,7 @@ var platformRoutes = {
6093
6507
  "contactProperties.list": {
6094
6508
  method: "GET",
6095
6509
  path: "/v1/contact-properties",
6096
- response: import_zod19.z.object({ data: import_zod19.z.array(ContactPropertyDefinition) }),
6510
+ response: import_zod20.z.object({ data: import_zod20.z.array(ContactPropertyDefinition) }),
6097
6511
  status: 200,
6098
6512
  access: "read",
6099
6513
  phase: "S4"
@@ -6392,7 +6806,7 @@ var billingRoutes = {
6392
6806
  "billing.plans": {
6393
6807
  method: "GET",
6394
6808
  path: "/v1/billing/plans",
6395
- response: import_zod19.z.object({ data: import_zod19.z.array(CatalogPlan), addons: BillingAddons }),
6809
+ response: import_zod20.z.object({ data: import_zod20.z.array(CatalogPlan), addons: BillingAddons }),
6396
6810
  status: 200,
6397
6811
  access: "read",
6398
6812
  phase: "S5"
@@ -6443,6 +6857,44 @@ var billingRoutes = {
6443
6857
  phase: "S5"
6444
6858
  }
6445
6859
  };
6860
+ var domainBuyingRoutes = {
6861
+ "domains.search": {
6862
+ method: "GET",
6863
+ path: "/v1/domains/search",
6864
+ query: DomainSearchQuery,
6865
+ response: DomainSearchResult,
6866
+ status: 200,
6867
+ access: "admin",
6868
+ phase: "S5"
6869
+ },
6870
+ "domainOrders.create": {
6871
+ method: "POST",
6872
+ path: "/v1/domain-orders",
6873
+ body: DomainOrderCreate,
6874
+ response: DomainOrder,
6875
+ status: 201,
6876
+ access: "admin",
6877
+ phase: "S5"
6878
+ },
6879
+ "domainOrders.list": {
6880
+ method: "GET",
6881
+ path: "/v1/domain-orders",
6882
+ query: PageQuery,
6883
+ response: list(DomainOrder),
6884
+ status: 200,
6885
+ access: "admin",
6886
+ phase: "S5"
6887
+ },
6888
+ "domainOrders.get": {
6889
+ method: "GET",
6890
+ path: "/v1/domain-orders/:id",
6891
+ params: IdParams,
6892
+ response: DomainOrder,
6893
+ status: 200,
6894
+ access: "admin",
6895
+ phase: "S5"
6896
+ }
6897
+ };
6446
6898
  var inviteRoutes = {
6447
6899
  "invites.create": {
6448
6900
  method: "POST",
@@ -6552,7 +7004,7 @@ var automationRoutes = {
6552
7004
  method: "POST",
6553
7005
  path: "/v1/automations/:id/pause",
6554
7006
  params: IdParams,
6555
- body: import_zod19.z.object({}).strict(),
7007
+ body: import_zod20.z.object({}).strict(),
6556
7008
  response: Automation,
6557
7009
  status: 200,
6558
7010
  access: "write",
@@ -6562,7 +7014,7 @@ var automationRoutes = {
6562
7014
  method: "POST",
6563
7015
  path: "/v1/automations/:id/resume",
6564
7016
  params: IdParams,
6565
- body: import_zod19.z.object({}).strict(),
7017
+ body: import_zod20.z.object({}).strict(),
6566
7018
  response: Automation,
6567
7019
  status: 200,
6568
7020
  access: "write",
@@ -6572,7 +7024,7 @@ var automationRoutes = {
6572
7024
  method: "POST",
6573
7025
  path: "/v1/automations/:id/archive",
6574
7026
  params: IdParams,
6575
- body: import_zod19.z.object({}).strict(),
7027
+ body: import_zod20.z.object({}).strict(),
6576
7028
  response: Automation,
6577
7029
  status: 200,
6578
7030
  access: "write",
@@ -6687,10 +7139,13 @@ var routes = {
6687
7139
  ...inviteRoutes,
6688
7140
  ...platformRoutes,
6689
7141
  ...billingRoutes,
7142
+ ...domainBuyingRoutes,
6690
7143
  ...automationRoutes
6691
7144
  };
6692
7145
  var TRUSTED_APP_OPERATIONS = {
6693
- booking: ["workspaces.list", "workspace.update", "providers.list", "sendingDomains.list", "apiKeys.create", "apiKeys.revoke"]
7146
+ booking: ["workspaces.list", "workspace.update", "providers.list", "sendingDomains.list", "apiKeys.create", "apiKeys.revoke"],
7147
+ // The shop's receipt email needs exactly what connecting a booking page needs.
7148
+ sites: ["workspaces.list", "workspace.update", "providers.list", "sendingDomains.list", "apiKeys.create", "apiKeys.revoke"]
6694
7149
  };
6695
7150
  function trustedAppMayCall(app, id) {
6696
7151
  return TRUSTED_APP_OPERATIONS[app].includes(id);
@@ -6852,10 +7307,26 @@ function matchRoute(method, pathname) {
6852
7307
  DEFAULT_INVITE_TTL_DAYS,
6853
7308
  DEFAULT_PAGE_LIMIT,
6854
7309
  DOCUMENT_SCHEMA_VERSIONS,
7310
+ DOMAIN_BUYING_BLOCKS,
7311
+ DOMAIN_BUYING_NOT_CONFIGURED_REASON,
7312
+ DOMAIN_ORDER_KINDS,
7313
+ DOMAIN_ORDER_STATES,
7314
+ DOMAIN_PRICE_CHANGED_REASON,
7315
+ DOMAIN_UNAVAILABLE_REASONS,
6855
7316
  DateOnly,
6856
7317
  DatePassedAnswer,
6857
7318
  DelayStep,
6858
7319
  DocumentSchemaVersion,
7320
+ DomainBuyingBlock,
7321
+ DomainOffer,
7322
+ DomainOrder,
7323
+ DomainOrderCreate,
7324
+ DomainOrderKind,
7325
+ DomainOrderState,
7326
+ DomainRegistrant,
7327
+ DomainSearchQuery,
7328
+ DomainSearchResult,
7329
+ DomainUnavailableReason,
6859
7330
  EDITABLE_MAILING_STATUSES,
6860
7331
  ERROR_CODES,
6861
7332
  ERROR_STATUS,
@@ -6939,6 +7410,7 @@ function matchRoute(method, pathname) {
6939
7410
  MAX_ASSET_BYTES,
6940
7411
  MAX_DELAY_SECONDS,
6941
7412
  MAX_DOCUMENT_BYTES,
7413
+ MAX_DOMAIN_ORDERS_PER_DAY,
6942
7414
  MAX_ENGAGEMENT_DAYS,
6943
7415
  MAX_EXPORT_WARNINGS_HEADER_LENGTH,
6944
7416
  MAX_EXTRA_SENDING_DOMAINS,
@@ -7063,6 +7535,7 @@ function matchRoute(method, pathname) {
7063
7535
  QuietHours,
7064
7536
  RECIPIENT_REJECTIONS,
7065
7537
  RECIPIENT_STATUSES,
7538
+ REGISTRY_PHONE,
7066
7539
  REQUEST_ID_HEADER,
7067
7540
  RESEND_EVENT_TYPES,
7068
7541
  RESERVED_MERGE_FIELDS,
@@ -7249,6 +7722,7 @@ function matchRoute(method, pathname) {
7249
7722
  demoteForSave,
7250
7723
  demotedBySave,
7251
7724
  describeMissingTexts,
7725
+ domainBuyingRoutes,
7252
7726
  draftDocument,
7253
7727
  draftInsertionProblems,
7254
7728
  draftsDirty,
@@ -7299,6 +7773,7 @@ function matchRoute(method, pathname) {
7299
7773
  missingInsertionTexts,
7300
7774
  missingRequiredMergeFields,
7301
7775
  normalizeChoiceKey,
7776
+ normalizePhone,
7302
7777
  nowSeconds,
7303
7778
  operationsWithAccess,
7304
7779
  ownEntry,