@masters-union/outbound-sdk 0.4.11 → 0.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -540,14 +540,37 @@ interface IncomingWebhookPayload {
540
540
  }
541
541
  /** Internal status a v2 event maps to (past-tense of `event`). */
542
542
  type WebhookEventStatus = 'sent' | 'delivered' | 'bounced' | 'complained' | 'opened' | 'clicked' | 'rejected' | 'rendering_failed' | 'dropped' | 'unsubscribed' | 'resubscribed' | 'ping';
543
+ /**
544
+ * Why a recipient unsubscribed.
545
+ *
546
+ * The first four are chosen by the recipient on the unsubscribe page; the last two are
547
+ * assigned by the platform and can never be selected:
548
+ * - `not_specified` — the form was submitted with the optional question unanswered.
549
+ * - `one_click` — RFC 8058 List-Unsubscribe-Post, i.e. the mail client's own
550
+ * unsubscribe button. No page is rendered on that path, so no reason can be asked.
551
+ *
552
+ * Codes are stable and will not be renamed. New codes may be added, so treat this as
553
+ * an open set when switching on it.
554
+ */
555
+ type UnsubscribeReason = 'too_many_emails' | 'not_relevant' | 'never_signed_up' | 'other' | 'not_specified' | 'one_click';
556
+ /** How an opt-out reached us: the link in the email, the mail client's header button, or the API. */
557
+ type UnsubscribeSource = 'link' | 'one_click' | 'api';
543
558
  /** Curated, event-specific details. Only the keys relevant to the event are set. */
544
559
  interface WebhookEventDetails {
545
560
  /** bounce */
546
561
  bounceType?: string | null;
547
562
  bounceSubType?: string | null;
548
563
  smtpStatus?: string | null;
564
+ /**
565
+ * The receiving mail server's own diagnostic, with infrastructure-provider branding
566
+ * and provider documentation links removed. Display text, not a stable key.
567
+ */
549
568
  diagnosticCode?: string | null;
550
- /** bounce / reject / rendering_failure / dropped (dropped carries the drop reason) */
569
+ /**
570
+ * bounce / reject / rendering_failure / dropped (dropped carries the drop reason).
571
+ * A stable Outbound sentence for known bounce subtypes, otherwise the remote
572
+ * diagnostic. Branch on `bounceType`/`bounceSubType`/`smtpStatus`, not on this.
573
+ */
551
574
  failedReason?: string | null;
552
575
  /** bounce / complaint — true when we auto-added the address to the suppression list */
553
576
  suppressed?: boolean;
@@ -558,6 +581,27 @@ interface WebhookEventDetails {
558
581
  ip?: string | null;
559
582
  /** click */
560
583
  link?: string | null;
584
+ /**
585
+ * unsubscribe — the reason the recipient gave, as a stable code. Branch on this,
586
+ * not on `unsubscribeReasonLabel`.
587
+ *
588
+ * `not_specified` means they submitted the form without answering the optional
589
+ * question. `one_click` means they used their mail client's own unsubscribe button
590
+ * (RFC 8058 List-Unsubscribe-Post), where no page is shown and so no reason can be
591
+ * asked — it is not a reason they chose.
592
+ */
593
+ unsubscribeReason?: UnsubscribeReason | null;
594
+ /** unsubscribe — display wording for {@link unsubscribeReason}. May be reworded; do not branch on it. */
595
+ unsubscribeReasonLabel?: string | null;
596
+ /** unsubscribe — how the opt-out reached us. */
597
+ unsubscribeSource?: UnsubscribeSource | null;
598
+ /**
599
+ * unsubscribe — optional free text, only ever collected alongside reason `other`.
600
+ *
601
+ * Recipient-authored and therefore untrusted: it is length-capped and stripped of
602
+ * control characters on the way in, but escape it before rendering it anywhere.
603
+ */
604
+ unsubscribeComment?: string | null;
561
605
  }
562
606
  /** A single event inside a v2 webhook delivery. */
563
607
  interface IncomingWebhookEventV2 {
package/dist/index.d.ts CHANGED
@@ -540,14 +540,37 @@ interface IncomingWebhookPayload {
540
540
  }
541
541
  /** Internal status a v2 event maps to (past-tense of `event`). */
542
542
  type WebhookEventStatus = 'sent' | 'delivered' | 'bounced' | 'complained' | 'opened' | 'clicked' | 'rejected' | 'rendering_failed' | 'dropped' | 'unsubscribed' | 'resubscribed' | 'ping';
543
+ /**
544
+ * Why a recipient unsubscribed.
545
+ *
546
+ * The first four are chosen by the recipient on the unsubscribe page; the last two are
547
+ * assigned by the platform and can never be selected:
548
+ * - `not_specified` — the form was submitted with the optional question unanswered.
549
+ * - `one_click` — RFC 8058 List-Unsubscribe-Post, i.e. the mail client's own
550
+ * unsubscribe button. No page is rendered on that path, so no reason can be asked.
551
+ *
552
+ * Codes are stable and will not be renamed. New codes may be added, so treat this as
553
+ * an open set when switching on it.
554
+ */
555
+ type UnsubscribeReason = 'too_many_emails' | 'not_relevant' | 'never_signed_up' | 'other' | 'not_specified' | 'one_click';
556
+ /** How an opt-out reached us: the link in the email, the mail client's header button, or the API. */
557
+ type UnsubscribeSource = 'link' | 'one_click' | 'api';
543
558
  /** Curated, event-specific details. Only the keys relevant to the event are set. */
544
559
  interface WebhookEventDetails {
545
560
  /** bounce */
546
561
  bounceType?: string | null;
547
562
  bounceSubType?: string | null;
548
563
  smtpStatus?: string | null;
564
+ /**
565
+ * The receiving mail server's own diagnostic, with infrastructure-provider branding
566
+ * and provider documentation links removed. Display text, not a stable key.
567
+ */
549
568
  diagnosticCode?: string | null;
550
- /** bounce / reject / rendering_failure / dropped (dropped carries the drop reason) */
569
+ /**
570
+ * bounce / reject / rendering_failure / dropped (dropped carries the drop reason).
571
+ * A stable Outbound sentence for known bounce subtypes, otherwise the remote
572
+ * diagnostic. Branch on `bounceType`/`bounceSubType`/`smtpStatus`, not on this.
573
+ */
551
574
  failedReason?: string | null;
552
575
  /** bounce / complaint — true when we auto-added the address to the suppression list */
553
576
  suppressed?: boolean;
@@ -558,6 +581,27 @@ interface WebhookEventDetails {
558
581
  ip?: string | null;
559
582
  /** click */
560
583
  link?: string | null;
584
+ /**
585
+ * unsubscribe — the reason the recipient gave, as a stable code. Branch on this,
586
+ * not on `unsubscribeReasonLabel`.
587
+ *
588
+ * `not_specified` means they submitted the form without answering the optional
589
+ * question. `one_click` means they used their mail client's own unsubscribe button
590
+ * (RFC 8058 List-Unsubscribe-Post), where no page is shown and so no reason can be
591
+ * asked — it is not a reason they chose.
592
+ */
593
+ unsubscribeReason?: UnsubscribeReason | null;
594
+ /** unsubscribe — display wording for {@link unsubscribeReason}. May be reworded; do not branch on it. */
595
+ unsubscribeReasonLabel?: string | null;
596
+ /** unsubscribe — how the opt-out reached us. */
597
+ unsubscribeSource?: UnsubscribeSource | null;
598
+ /**
599
+ * unsubscribe — optional free text, only ever collected alongside reason `other`.
600
+ *
601
+ * Recipient-authored and therefore untrusted: it is length-capped and stripped of
602
+ * control characters on the way in, but escape it before rendering it anywhere.
603
+ */
604
+ unsubscribeComment?: string | null;
561
605
  }
562
606
  /** A single event inside a v2 webhook delivery. */
563
607
  interface IncomingWebhookEventV2 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masters-union/outbound-sdk",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
4
4
  "description": "Official Node.js SDK for the Outbound Email SaaS platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",