migma 1.4.0 → 1.5.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/README.md CHANGED
@@ -517,11 +517,11 @@ const { data: devices } = await migma.previews.getSupportedDevices();
517
517
 
518
518
  ### Export
519
519
 
520
- Export generated emails to HTML, MJML, PDF, or directly to ESP platforms.
520
+ Export generated emails to HTML, PNG, PDF, or directly to ESP platforms.
521
521
 
522
522
  ```typescript
523
523
  const { data: html } = await migma.export.html('conversation_id');
524
- const { data: mjml } = await migma.export.mjml('conversation_id');
524
+ const { data: png } = await migma.export.png('conversation_id');
525
525
  const { data: pdf } = await migma.export.pdf('conversation_id');
526
526
  const { data: klaviyo } = await migma.export.klaviyo('conversation_id', 'hybrid');
527
527
  const { data: mailchimp } = await migma.export.mailchimp('conversation_id');
@@ -650,7 +650,7 @@ await migma.images.updateLogos('proj_abc123', {
650
650
  | `migma.campaigns` | `list` `create` `get` `send` `schedule` `cancel` `stats` `logs` `archive` `unarchive` | [Campaigns](https://docs.migma.ai/campaigns/overview) |
651
651
  | `migma.validation` | `all` `compatibility` `links` `spelling` `deliverability` | [Validation](https://docs.migma.ai/api-reference/email-validation/run-all-validation-checks) |
652
652
  | `migma.previews` | `create` `get` `getStatus` `getDevice` `getSupportedDevices` `createAndWait` | [Previews](https://docs.migma.ai/api-reference/email-previews/create-email-preview) |
653
- | `migma.export` | `getFormats` `getStatus` `html` `mjml` `pdf` `klaviyo` `mailchimp` `hubspot` | [Export](https://docs.migma.ai/api-reference/export/list-export-formats) |
653
+ | `migma.export` | `getFormats` `getStatus` `html` `pdf` `png` `klaviyo` `mailchimp` `hubspot` | [Export](https://docs.migma.ai/api-reference/export/list-export-formats) |
654
654
  | `migma.domains` | `create` `list` `get` `verify` `update` `remove` `checkAvailability` `listManaged` `createManaged` `removeManaged` `provisionStream` `setup` | [Domains](https://docs.migma.ai/api-reference/domains/list-domains) |
655
655
  | `migma.webhooks` | `create` `list` `get` `update` `remove` `test` `getDeliveries` `getEvents` `getStats` | [Webhooks](https://docs.migma.ai/webhooks) |
656
656
  | `migma.knowledgeBase` | `list` `add` `update` `remove` | [API Ref](https://docs.migma.ai/api-reference/introduction) |
package/dist/index.d.mts CHANGED
@@ -1088,8 +1088,8 @@ declare class Export {
1088
1088
  getFormats(): Promise<MigmaResult<ExportFormatsResponse>>;
1089
1089
  getStatus(conversationId: string): Promise<MigmaResult<ExportStatusResponse>>;
1090
1090
  html(conversationId: string): Promise<MigmaResult<ExportResult>>;
1091
- mjml(conversationId: string): Promise<MigmaResult<ExportResult>>;
1092
1091
  pdf(conversationId: string): Promise<MigmaResult<ExportResult>>;
1092
+ png(conversationId: string): Promise<MigmaResult<ExportResult>>;
1093
1093
  klaviyo(conversationId: string, klaviyoType?: 'html' | 'hybrid' | 'code'): Promise<MigmaResult<ExportResult>>;
1094
1094
  mailchimp(conversationId: string): Promise<MigmaResult<ExportResult>>;
1095
1095
  hubspot(params: HubspotExportParams): Promise<MigmaResult<ExportResult>>;
@@ -1197,6 +1197,143 @@ declare class Domains {
1197
1197
  setup(params: SetupDomainParams): Promise<MigmaResult<SetupDomainResponse>>;
1198
1198
  }
1199
1199
 
1200
+ interface DomainPurchaseQuote {
1201
+ rootDomain: string;
1202
+ tld: string;
1203
+ available?: boolean;
1204
+ supported?: boolean;
1205
+ premium?: boolean;
1206
+ sellPrice?: number;
1207
+ currency?: string;
1208
+ [key: string]: unknown;
1209
+ }
1210
+ interface DomainPurchaseSearchParams {
1211
+ /** Name or keyword, e.g. 'acme' or 'acme.com'. */
1212
+ q: string;
1213
+ /** Max quotes to return (1-20, default 8). */
1214
+ limit?: number;
1215
+ }
1216
+ interface DomainPurchaseParams {
1217
+ /** Domain to buy, e.g. 'acme.com'. */
1218
+ domain: string;
1219
+ /** Optional website the bought apex domain should redirect to. */
1220
+ redirectUrl?: string;
1221
+ }
1222
+ interface DomainPurchaseCheckout {
1223
+ /** Stripe checkout URL the account owner opens in a browser to pay. */
1224
+ checkoutUrl: string;
1225
+ checkoutSessionId?: string;
1226
+ billingMode?: 'annual_subscription';
1227
+ [key: string]: unknown;
1228
+ }
1229
+ type DomainRegistrationStatus = 'quoted' | 'payment_pending' | 'registering' | 'active' | 'failed' | 'refunded' | string;
1230
+ interface DomainRegistration {
1231
+ id: string;
1232
+ rootDomain: string;
1233
+ status: DomainRegistrationStatus;
1234
+ sellPrice?: number;
1235
+ currency?: string;
1236
+ [key: string]: unknown;
1237
+ }
1238
+ type CustomDnsRecordType = 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT' | 'NS';
1239
+ interface CustomDnsRecord {
1240
+ id: string;
1241
+ type: CustomDnsRecordType;
1242
+ name: string;
1243
+ content: string;
1244
+ /** MX only. */
1245
+ priority?: number;
1246
+ createdAt: string;
1247
+ [key: string]: unknown;
1248
+ }
1249
+ interface CustomDnsRecordList {
1250
+ /** false = Migma does not host this domain's DNS zone (connected from an outside registrar). */
1251
+ managed: boolean;
1252
+ records: CustomDnsRecord[];
1253
+ }
1254
+ interface AddCustomDnsRecordParams {
1255
+ /** Record name: '@' for the root, a label like 'mail', or a full name like 'mail.acme.com'. */
1256
+ name: string;
1257
+ /** Record value, e.g. an IP, hostname, or TXT string. */
1258
+ content: string;
1259
+ /** Defaults to TXT. */
1260
+ type?: CustomDnsRecordType;
1261
+ /** MX priority (0-65535). */
1262
+ priority?: number;
1263
+ }
1264
+
1265
+ declare class DomainPurchases {
1266
+ private readonly client;
1267
+ constructor(client: MigmaClient);
1268
+ /** Availability and price quotes for domains you could buy. */
1269
+ search(params: DomainPurchaseSearchParams): Promise<MigmaResult<{
1270
+ quotes: DomainPurchaseQuote[];
1271
+ }>>;
1272
+ /**
1273
+ * Start buying a domain. Returns a Stripe checkout URL the account owner
1274
+ * opens in a browser; the domain registers after payment clears. Requires
1275
+ * an active paid Migma subscription.
1276
+ */
1277
+ create(params: DomainPurchaseParams): Promise<MigmaResult<DomainPurchaseCheckout>>;
1278
+ /** Purchase history and status: payment_pending → registering → active. */
1279
+ registrations(params?: {
1280
+ limit?: number;
1281
+ }): Promise<MigmaResult<{
1282
+ registrations: DomainRegistration[];
1283
+ }>>;
1284
+ /** DNS records you added to a domain bought in Migma. `managed: false` = zone not hosted by Migma. */
1285
+ listDnsRecords(domain: string): Promise<MigmaResult<CustomDnsRecordList>>;
1286
+ /**
1287
+ * Add a DNS record (A, AAAA, CNAME, MX, TXT, or NS) to a domain bought in
1288
+ * Migma. Migma's email sending records are protected and cannot be
1289
+ * overridden; the root and www stay with domain forwarding.
1290
+ */
1291
+ addDnsRecord(domain: string, params: AddCustomDnsRecordParams): Promise<MigmaResult<{
1292
+ record: CustomDnsRecord;
1293
+ }>>;
1294
+ /** Remove a DNS record you added earlier (never Migma's own records). */
1295
+ removeDnsRecord(domain: string, recordId: string): Promise<MigmaResult<{
1296
+ ok: boolean;
1297
+ }>>;
1298
+ }
1299
+
1300
+ interface CreditStatus {
1301
+ currentPlan: string;
1302
+ isExpired: boolean;
1303
+ planExpiry?: string;
1304
+ hasCredits: boolean;
1305
+ emailCreditsRemainingToday: number;
1306
+ imageCreditsRemainingToday: number;
1307
+ monthlyCreditsRemaining: number;
1308
+ }
1309
+ type UpgradePlan = 'basic' | 'premium' | 'business' | 'basic_annual' | 'premium_annual' | 'business_annual';
1310
+ interface UpgradeLinkParams {
1311
+ /**
1312
+ * Target plan for Stripe Checkout. Omit to get a billing portal link
1313
+ * (existing Stripe customers only).
1314
+ */
1315
+ plan?: UpgradePlan;
1316
+ }
1317
+ interface UpgradeLink {
1318
+ /** URL the account owner opens in a browser to pay or manage billing. */
1319
+ url: string;
1320
+ kind: 'checkout' | 'portal';
1321
+ sessionId?: string;
1322
+ orderId?: string;
1323
+ }
1324
+
1325
+ declare class Billing {
1326
+ private readonly client;
1327
+ constructor(client: MigmaClient);
1328
+ /** Plan and remaining credits for the API key owner. */
1329
+ credits(): Promise<MigmaResult<CreditStatus>>;
1330
+ /**
1331
+ * Mint a Stripe link the account owner opens in a browser to upgrade or
1332
+ * manage the subscription. Nothing is charged by this call itself.
1333
+ */
1334
+ upgradeLink(params?: UpgradeLinkParams): Promise<MigmaResult<UpgradeLink>>;
1335
+ }
1336
+
1200
1337
  type WebhookEventType = 'email.generation.started' | 'email.generation.completed' | 'email.generation.failed' | 'email.test.sent' | 'project.import.started' | 'project.import.processing' | 'project.import.completed' | 'project.import.failed' | 'export.completed' | 'export.failed' | 'subscriber.added' | 'subscriber.updated' | 'subscriber.unsubscribed' | 'subscriber.bulk_imported' | 'api_key.created' | 'api_key.revoked';
1201
1338
  interface CreateWebhookParams {
1202
1339
  url: string;
@@ -1552,6 +1689,8 @@ declare class Migma {
1552
1689
  readonly previews: Previews;
1553
1690
  readonly export: Export;
1554
1691
  readonly domains: Domains;
1692
+ readonly domainPurchases: DomainPurchases;
1693
+ readonly billing: Billing;
1555
1694
  readonly webhooks: Webhooks;
1556
1695
  readonly knowledgeBase: KnowledgeBase;
1557
1696
  readonly images: Images;
@@ -1560,4 +1699,4 @@ declare class Migma {
1560
1699
  constructor(apiKey: string, config?: MigmaConfig);
1561
1700
  }
1562
1701
 
1563
- export { type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchDeleteContactsParams, type BatchDeleteResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignLog, type CampaignLogsParams, type CampaignLogsResponse, type CampaignStats, type CampaignStatus, type ChangeStatusParams, type CheckCompatibilityParams, type CheckSpellingParams, type CheckedLink, type ClientConfig, type CompatibilityResponse, type Contact, type ContactStatus, type CreateCampaignParams, type CreateContactParams, type CreateDomainParams, type CreateManagedDomainParams, type CreatePreviewParams, type CreatePreviewResponse, type CreateSegmentParams, type CreateTagParams, type CreateTopicParams, type CreateWebhookParams, type CreateWebhookResponse, type DeleteResponse, type DeliverabilityResponse, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainStream, type DomainVerificationResult, type EditEmailParams, type Email, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailLogsParams, type EmailLogsResponse, type EmailMetrics, type EmailMetricsCountry, type EmailMetricsSummary, type EmailMetricsTimePoint, type EmailSendLog, type ExportFile, type ExportFormat, type ExportFormatsResponse, type ExportResult, type ExportStatusResponse, type FieldCatalogEntry, type FieldCatalogEntryType, type FieldCatalogParams, type FieldCatalogResponse, type GenerateEmailParams, type GenerateEmailResponse, type GeneratedEmail, type GetDevicePreviewResponse, type GetPreviewResponse, type GetPreviewStatusResponse, type GetSupportedDevicesResponse, type HubspotExportParams, type ImportProjectParams, type ImportProjectResponse, type ImportStatusResponse, type KnowledgeBaseEntry, type KnowledgeBaseListResponse, type LinkAnalysisResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListContactsParams, type ListContactsResponse, type ListEmailsEmail, type ListEmailsParams, type ListEmailsResponse, type ListProjectsParams, type ListProjectsResponse, type ListSegmentsResponse, type ListTagsParams, type ListTagsResponse, type ListTopicsParams, type ListTopicsResponse, type ListWebhooksResponse, type LogosResponse, type MessageResponse, Migma, MigmaClient, type MigmaConfig, MigmaError, MigmaErrorCode, type MigmaResult, type PollingOptions, type PreviewDevice, type PreviewDeviceCategory, type PreviewDeviceStatus, type PreviewMetadata, type PreviewStatus, type Project, type ProjectImage, type ProviderType, type ProvisionStreamParams, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SendingMetrics, type SendingMetricsCounts, type SendingMetricsHistoryEntry, type SendingMetricsParams, type SendingMetricsToday, type SetupDomainParams, type SetupDomainResponse, type SpellingResponse, type SupportedDevice, type Tag, type Topic, type TopicSubscriptionParams, type TopicSubscriptionResponse, type UpdateContactParams, type UpdateDomainParams, type UpdateImageParams, type UpdateKnowledgeBaseParams, type UpdateLogosParams, type UpdateSegmentParams, type UpdateTagParams, type UpdateTopicParams, type UpdateWebhookParams, type ValidateAllParams, type ValidateAllResponse, type Webhook, type WebhookDeliveriesResponse, type WebhookDelivery, type WebhookDetail, type WebhookEvent, type WebhookEventType, type WebhookEventsResponse, type WebhookTestResult, poll };
1702
+ export { type AddCustomDnsRecordParams, type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchDeleteContactsParams, type BatchDeleteResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignLog, type CampaignLogsParams, type CampaignLogsResponse, type CampaignStats, type CampaignStatus, type ChangeStatusParams, type CheckCompatibilityParams, type CheckSpellingParams, type CheckedLink, type ClientConfig, type CompatibilityResponse, type Contact, type ContactStatus, type CreateCampaignParams, type CreateContactParams, type CreateDomainParams, type CreateManagedDomainParams, type CreatePreviewParams, type CreatePreviewResponse, type CreateSegmentParams, type CreateTagParams, type CreateTopicParams, type CreateWebhookParams, type CreateWebhookResponse, type CreditStatus, type CustomDnsRecord, type CustomDnsRecordList, type CustomDnsRecordType, type DeleteResponse, type DeliverabilityResponse, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainPurchaseCheckout, type DomainPurchaseParams, type DomainPurchaseQuote, type DomainPurchaseSearchParams, type DomainRegistration, type DomainRegistrationStatus, type DomainStream, type DomainVerificationResult, type EditEmailParams, type Email, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailLogsParams, type EmailLogsResponse, type EmailMetrics, type EmailMetricsCountry, type EmailMetricsSummary, type EmailMetricsTimePoint, type EmailSendLog, type ExportFile, type ExportFormat, type ExportFormatsResponse, type ExportResult, type ExportStatusResponse, type FieldCatalogEntry, type FieldCatalogEntryType, type FieldCatalogParams, type FieldCatalogResponse, type GenerateEmailParams, type GenerateEmailResponse, type GeneratedEmail, type GetDevicePreviewResponse, type GetPreviewResponse, type GetPreviewStatusResponse, type GetSupportedDevicesResponse, type HubspotExportParams, type ImportProjectParams, type ImportProjectResponse, type ImportStatusResponse, type KnowledgeBaseEntry, type KnowledgeBaseListResponse, type LinkAnalysisResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListContactsParams, type ListContactsResponse, type ListEmailsEmail, type ListEmailsParams, type ListEmailsResponse, type ListProjectsParams, type ListProjectsResponse, type ListSegmentsResponse, type ListTagsParams, type ListTagsResponse, type ListTopicsParams, type ListTopicsResponse, type ListWebhooksResponse, type LogosResponse, type MessageResponse, Migma, MigmaClient, type MigmaConfig, MigmaError, MigmaErrorCode, type MigmaResult, type PollingOptions, type PreviewDevice, type PreviewDeviceCategory, type PreviewDeviceStatus, type PreviewMetadata, type PreviewStatus, type Project, type ProjectImage, type ProviderType, type ProvisionStreamParams, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SendingMetrics, type SendingMetricsCounts, type SendingMetricsHistoryEntry, type SendingMetricsParams, type SendingMetricsToday, type SetupDomainParams, type SetupDomainResponse, type SpellingResponse, type SupportedDevice, type Tag, type Topic, type TopicSubscriptionParams, type TopicSubscriptionResponse, type UpdateContactParams, type UpdateDomainParams, type UpdateImageParams, type UpdateKnowledgeBaseParams, type UpdateLogosParams, type UpdateSegmentParams, type UpdateTagParams, type UpdateTopicParams, type UpdateWebhookParams, type UpgradeLink, type UpgradeLinkParams, type UpgradePlan, type ValidateAllParams, type ValidateAllResponse, type Webhook, type WebhookDeliveriesResponse, type WebhookDelivery, type WebhookDetail, type WebhookEvent, type WebhookEventType, type WebhookEventsResponse, type WebhookTestResult, poll };
package/dist/index.d.ts CHANGED
@@ -1088,8 +1088,8 @@ declare class Export {
1088
1088
  getFormats(): Promise<MigmaResult<ExportFormatsResponse>>;
1089
1089
  getStatus(conversationId: string): Promise<MigmaResult<ExportStatusResponse>>;
1090
1090
  html(conversationId: string): Promise<MigmaResult<ExportResult>>;
1091
- mjml(conversationId: string): Promise<MigmaResult<ExportResult>>;
1092
1091
  pdf(conversationId: string): Promise<MigmaResult<ExportResult>>;
1092
+ png(conversationId: string): Promise<MigmaResult<ExportResult>>;
1093
1093
  klaviyo(conversationId: string, klaviyoType?: 'html' | 'hybrid' | 'code'): Promise<MigmaResult<ExportResult>>;
1094
1094
  mailchimp(conversationId: string): Promise<MigmaResult<ExportResult>>;
1095
1095
  hubspot(params: HubspotExportParams): Promise<MigmaResult<ExportResult>>;
@@ -1197,6 +1197,143 @@ declare class Domains {
1197
1197
  setup(params: SetupDomainParams): Promise<MigmaResult<SetupDomainResponse>>;
1198
1198
  }
1199
1199
 
1200
+ interface DomainPurchaseQuote {
1201
+ rootDomain: string;
1202
+ tld: string;
1203
+ available?: boolean;
1204
+ supported?: boolean;
1205
+ premium?: boolean;
1206
+ sellPrice?: number;
1207
+ currency?: string;
1208
+ [key: string]: unknown;
1209
+ }
1210
+ interface DomainPurchaseSearchParams {
1211
+ /** Name or keyword, e.g. 'acme' or 'acme.com'. */
1212
+ q: string;
1213
+ /** Max quotes to return (1-20, default 8). */
1214
+ limit?: number;
1215
+ }
1216
+ interface DomainPurchaseParams {
1217
+ /** Domain to buy, e.g. 'acme.com'. */
1218
+ domain: string;
1219
+ /** Optional website the bought apex domain should redirect to. */
1220
+ redirectUrl?: string;
1221
+ }
1222
+ interface DomainPurchaseCheckout {
1223
+ /** Stripe checkout URL the account owner opens in a browser to pay. */
1224
+ checkoutUrl: string;
1225
+ checkoutSessionId?: string;
1226
+ billingMode?: 'annual_subscription';
1227
+ [key: string]: unknown;
1228
+ }
1229
+ type DomainRegistrationStatus = 'quoted' | 'payment_pending' | 'registering' | 'active' | 'failed' | 'refunded' | string;
1230
+ interface DomainRegistration {
1231
+ id: string;
1232
+ rootDomain: string;
1233
+ status: DomainRegistrationStatus;
1234
+ sellPrice?: number;
1235
+ currency?: string;
1236
+ [key: string]: unknown;
1237
+ }
1238
+ type CustomDnsRecordType = 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT' | 'NS';
1239
+ interface CustomDnsRecord {
1240
+ id: string;
1241
+ type: CustomDnsRecordType;
1242
+ name: string;
1243
+ content: string;
1244
+ /** MX only. */
1245
+ priority?: number;
1246
+ createdAt: string;
1247
+ [key: string]: unknown;
1248
+ }
1249
+ interface CustomDnsRecordList {
1250
+ /** false = Migma does not host this domain's DNS zone (connected from an outside registrar). */
1251
+ managed: boolean;
1252
+ records: CustomDnsRecord[];
1253
+ }
1254
+ interface AddCustomDnsRecordParams {
1255
+ /** Record name: '@' for the root, a label like 'mail', or a full name like 'mail.acme.com'. */
1256
+ name: string;
1257
+ /** Record value, e.g. an IP, hostname, or TXT string. */
1258
+ content: string;
1259
+ /** Defaults to TXT. */
1260
+ type?: CustomDnsRecordType;
1261
+ /** MX priority (0-65535). */
1262
+ priority?: number;
1263
+ }
1264
+
1265
+ declare class DomainPurchases {
1266
+ private readonly client;
1267
+ constructor(client: MigmaClient);
1268
+ /** Availability and price quotes for domains you could buy. */
1269
+ search(params: DomainPurchaseSearchParams): Promise<MigmaResult<{
1270
+ quotes: DomainPurchaseQuote[];
1271
+ }>>;
1272
+ /**
1273
+ * Start buying a domain. Returns a Stripe checkout URL the account owner
1274
+ * opens in a browser; the domain registers after payment clears. Requires
1275
+ * an active paid Migma subscription.
1276
+ */
1277
+ create(params: DomainPurchaseParams): Promise<MigmaResult<DomainPurchaseCheckout>>;
1278
+ /** Purchase history and status: payment_pending → registering → active. */
1279
+ registrations(params?: {
1280
+ limit?: number;
1281
+ }): Promise<MigmaResult<{
1282
+ registrations: DomainRegistration[];
1283
+ }>>;
1284
+ /** DNS records you added to a domain bought in Migma. `managed: false` = zone not hosted by Migma. */
1285
+ listDnsRecords(domain: string): Promise<MigmaResult<CustomDnsRecordList>>;
1286
+ /**
1287
+ * Add a DNS record (A, AAAA, CNAME, MX, TXT, or NS) to a domain bought in
1288
+ * Migma. Migma's email sending records are protected and cannot be
1289
+ * overridden; the root and www stay with domain forwarding.
1290
+ */
1291
+ addDnsRecord(domain: string, params: AddCustomDnsRecordParams): Promise<MigmaResult<{
1292
+ record: CustomDnsRecord;
1293
+ }>>;
1294
+ /** Remove a DNS record you added earlier (never Migma's own records). */
1295
+ removeDnsRecord(domain: string, recordId: string): Promise<MigmaResult<{
1296
+ ok: boolean;
1297
+ }>>;
1298
+ }
1299
+
1300
+ interface CreditStatus {
1301
+ currentPlan: string;
1302
+ isExpired: boolean;
1303
+ planExpiry?: string;
1304
+ hasCredits: boolean;
1305
+ emailCreditsRemainingToday: number;
1306
+ imageCreditsRemainingToday: number;
1307
+ monthlyCreditsRemaining: number;
1308
+ }
1309
+ type UpgradePlan = 'basic' | 'premium' | 'business' | 'basic_annual' | 'premium_annual' | 'business_annual';
1310
+ interface UpgradeLinkParams {
1311
+ /**
1312
+ * Target plan for Stripe Checkout. Omit to get a billing portal link
1313
+ * (existing Stripe customers only).
1314
+ */
1315
+ plan?: UpgradePlan;
1316
+ }
1317
+ interface UpgradeLink {
1318
+ /** URL the account owner opens in a browser to pay or manage billing. */
1319
+ url: string;
1320
+ kind: 'checkout' | 'portal';
1321
+ sessionId?: string;
1322
+ orderId?: string;
1323
+ }
1324
+
1325
+ declare class Billing {
1326
+ private readonly client;
1327
+ constructor(client: MigmaClient);
1328
+ /** Plan and remaining credits for the API key owner. */
1329
+ credits(): Promise<MigmaResult<CreditStatus>>;
1330
+ /**
1331
+ * Mint a Stripe link the account owner opens in a browser to upgrade or
1332
+ * manage the subscription. Nothing is charged by this call itself.
1333
+ */
1334
+ upgradeLink(params?: UpgradeLinkParams): Promise<MigmaResult<UpgradeLink>>;
1335
+ }
1336
+
1200
1337
  type WebhookEventType = 'email.generation.started' | 'email.generation.completed' | 'email.generation.failed' | 'email.test.sent' | 'project.import.started' | 'project.import.processing' | 'project.import.completed' | 'project.import.failed' | 'export.completed' | 'export.failed' | 'subscriber.added' | 'subscriber.updated' | 'subscriber.unsubscribed' | 'subscriber.bulk_imported' | 'api_key.created' | 'api_key.revoked';
1201
1338
  interface CreateWebhookParams {
1202
1339
  url: string;
@@ -1552,6 +1689,8 @@ declare class Migma {
1552
1689
  readonly previews: Previews;
1553
1690
  readonly export: Export;
1554
1691
  readonly domains: Domains;
1692
+ readonly domainPurchases: DomainPurchases;
1693
+ readonly billing: Billing;
1555
1694
  readonly webhooks: Webhooks;
1556
1695
  readonly knowledgeBase: KnowledgeBase;
1557
1696
  readonly images: Images;
@@ -1560,4 +1699,4 @@ declare class Migma {
1560
1699
  constructor(apiKey: string, config?: MigmaConfig);
1561
1700
  }
1562
1701
 
1563
- export { type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchDeleteContactsParams, type BatchDeleteResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignLog, type CampaignLogsParams, type CampaignLogsResponse, type CampaignStats, type CampaignStatus, type ChangeStatusParams, type CheckCompatibilityParams, type CheckSpellingParams, type CheckedLink, type ClientConfig, type CompatibilityResponse, type Contact, type ContactStatus, type CreateCampaignParams, type CreateContactParams, type CreateDomainParams, type CreateManagedDomainParams, type CreatePreviewParams, type CreatePreviewResponse, type CreateSegmentParams, type CreateTagParams, type CreateTopicParams, type CreateWebhookParams, type CreateWebhookResponse, type DeleteResponse, type DeliverabilityResponse, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainStream, type DomainVerificationResult, type EditEmailParams, type Email, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailLogsParams, type EmailLogsResponse, type EmailMetrics, type EmailMetricsCountry, type EmailMetricsSummary, type EmailMetricsTimePoint, type EmailSendLog, type ExportFile, type ExportFormat, type ExportFormatsResponse, type ExportResult, type ExportStatusResponse, type FieldCatalogEntry, type FieldCatalogEntryType, type FieldCatalogParams, type FieldCatalogResponse, type GenerateEmailParams, type GenerateEmailResponse, type GeneratedEmail, type GetDevicePreviewResponse, type GetPreviewResponse, type GetPreviewStatusResponse, type GetSupportedDevicesResponse, type HubspotExportParams, type ImportProjectParams, type ImportProjectResponse, type ImportStatusResponse, type KnowledgeBaseEntry, type KnowledgeBaseListResponse, type LinkAnalysisResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListContactsParams, type ListContactsResponse, type ListEmailsEmail, type ListEmailsParams, type ListEmailsResponse, type ListProjectsParams, type ListProjectsResponse, type ListSegmentsResponse, type ListTagsParams, type ListTagsResponse, type ListTopicsParams, type ListTopicsResponse, type ListWebhooksResponse, type LogosResponse, type MessageResponse, Migma, MigmaClient, type MigmaConfig, MigmaError, MigmaErrorCode, type MigmaResult, type PollingOptions, type PreviewDevice, type PreviewDeviceCategory, type PreviewDeviceStatus, type PreviewMetadata, type PreviewStatus, type Project, type ProjectImage, type ProviderType, type ProvisionStreamParams, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SendingMetrics, type SendingMetricsCounts, type SendingMetricsHistoryEntry, type SendingMetricsParams, type SendingMetricsToday, type SetupDomainParams, type SetupDomainResponse, type SpellingResponse, type SupportedDevice, type Tag, type Topic, type TopicSubscriptionParams, type TopicSubscriptionResponse, type UpdateContactParams, type UpdateDomainParams, type UpdateImageParams, type UpdateKnowledgeBaseParams, type UpdateLogosParams, type UpdateSegmentParams, type UpdateTagParams, type UpdateTopicParams, type UpdateWebhookParams, type ValidateAllParams, type ValidateAllResponse, type Webhook, type WebhookDeliveriesResponse, type WebhookDelivery, type WebhookDetail, type WebhookEvent, type WebhookEventType, type WebhookEventsResponse, type WebhookTestResult, poll };
1702
+ export { type AddCustomDnsRecordParams, type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchDeleteContactsParams, type BatchDeleteResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignLog, type CampaignLogsParams, type CampaignLogsResponse, type CampaignStats, type CampaignStatus, type ChangeStatusParams, type CheckCompatibilityParams, type CheckSpellingParams, type CheckedLink, type ClientConfig, type CompatibilityResponse, type Contact, type ContactStatus, type CreateCampaignParams, type CreateContactParams, type CreateDomainParams, type CreateManagedDomainParams, type CreatePreviewParams, type CreatePreviewResponse, type CreateSegmentParams, type CreateTagParams, type CreateTopicParams, type CreateWebhookParams, type CreateWebhookResponse, type CreditStatus, type CustomDnsRecord, type CustomDnsRecordList, type CustomDnsRecordType, type DeleteResponse, type DeliverabilityResponse, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainPurchaseCheckout, type DomainPurchaseParams, type DomainPurchaseQuote, type DomainPurchaseSearchParams, type DomainRegistration, type DomainRegistrationStatus, type DomainStream, type DomainVerificationResult, type EditEmailParams, type Email, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailLogsParams, type EmailLogsResponse, type EmailMetrics, type EmailMetricsCountry, type EmailMetricsSummary, type EmailMetricsTimePoint, type EmailSendLog, type ExportFile, type ExportFormat, type ExportFormatsResponse, type ExportResult, type ExportStatusResponse, type FieldCatalogEntry, type FieldCatalogEntryType, type FieldCatalogParams, type FieldCatalogResponse, type GenerateEmailParams, type GenerateEmailResponse, type GeneratedEmail, type GetDevicePreviewResponse, type GetPreviewResponse, type GetPreviewStatusResponse, type GetSupportedDevicesResponse, type HubspotExportParams, type ImportProjectParams, type ImportProjectResponse, type ImportStatusResponse, type KnowledgeBaseEntry, type KnowledgeBaseListResponse, type LinkAnalysisResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListContactsParams, type ListContactsResponse, type ListEmailsEmail, type ListEmailsParams, type ListEmailsResponse, type ListProjectsParams, type ListProjectsResponse, type ListSegmentsResponse, type ListTagsParams, type ListTagsResponse, type ListTopicsParams, type ListTopicsResponse, type ListWebhooksResponse, type LogosResponse, type MessageResponse, Migma, MigmaClient, type MigmaConfig, MigmaError, MigmaErrorCode, type MigmaResult, type PollingOptions, type PreviewDevice, type PreviewDeviceCategory, type PreviewDeviceStatus, type PreviewMetadata, type PreviewStatus, type Project, type ProjectImage, type ProviderType, type ProvisionStreamParams, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SendingMetrics, type SendingMetricsCounts, type SendingMetricsHistoryEntry, type SendingMetricsParams, type SendingMetricsToday, type SetupDomainParams, type SetupDomainResponse, type SpellingResponse, type SupportedDevice, type Tag, type Topic, type TopicSubscriptionParams, type TopicSubscriptionResponse, type UpdateContactParams, type UpdateDomainParams, type UpdateImageParams, type UpdateKnowledgeBaseParams, type UpdateLogosParams, type UpdateSegmentParams, type UpdateTagParams, type UpdateTopicParams, type UpdateWebhookParams, type UpgradeLink, type UpgradeLinkParams, type UpgradePlan, type ValidateAllParams, type ValidateAllResponse, type Webhook, type WebhookDeliveriesResponse, type WebhookDelivery, type WebhookDetail, type WebhookEvent, type WebhookEventType, type WebhookEventsResponse, type WebhookTestResult, poll };
package/dist/index.js CHANGED
@@ -643,12 +643,12 @@ var Export = class {
643
643
  async html(conversationId) {
644
644
  return this.client.get(`/export/html/${conversationId}`);
645
645
  }
646
- async mjml(conversationId) {
647
- return this.client.get(`/export/mjml/${conversationId}`);
648
- }
649
646
  async pdf(conversationId) {
650
647
  return this.client.get(`/export/pdf/${conversationId}`);
651
648
  }
649
+ async png(conversationId) {
650
+ return this.client.get(`/export/png/${conversationId}`);
651
+ }
652
652
  async klaviyo(conversationId, klaviyoType) {
653
653
  return this.client.get(
654
654
  `/export/klaviyo/${conversationId}`,
@@ -719,6 +719,76 @@ var Domains = class {
719
719
  }
720
720
  };
721
721
 
722
+ // src/resources/domain-purchases.ts
723
+ var DomainPurchases = class {
724
+ constructor(client) {
725
+ this.client = client;
726
+ }
727
+ /** Availability and price quotes for domains you could buy. */
728
+ async search(params) {
729
+ return this.client.get("/domains/purchase/search", {
730
+ q: params.q,
731
+ limit: params.limit
732
+ });
733
+ }
734
+ /**
735
+ * Start buying a domain. Returns a Stripe checkout URL the account owner
736
+ * opens in a browser; the domain registers after payment clears. Requires
737
+ * an active paid Migma subscription.
738
+ */
739
+ async create(params) {
740
+ return this.client.post("/domains/purchase", params);
741
+ }
742
+ /** Purchase history and status: payment_pending → registering → active. */
743
+ async registrations(params) {
744
+ return this.client.get("/domains/purchase/registrations", {
745
+ limit: params?.limit
746
+ });
747
+ }
748
+ // DNS records live on Migma-hosted zones, which exist exactly for domains
749
+ // bought in Migma — hence they sit on this resource even though the API
750
+ // path is /domains/:domain/dns-records.
751
+ /** DNS records you added to a domain bought in Migma. `managed: false` = zone not hosted by Migma. */
752
+ async listDnsRecords(domain) {
753
+ return this.client.get(`/domains/${encodeURIComponent(domain)}/dns-records`);
754
+ }
755
+ /**
756
+ * Add a DNS record (A, AAAA, CNAME, MX, TXT, or NS) to a domain bought in
757
+ * Migma. Migma's email sending records are protected and cannot be
758
+ * overridden; the root and www stay with domain forwarding.
759
+ */
760
+ async addDnsRecord(domain, params) {
761
+ return this.client.post(
762
+ `/domains/${encodeURIComponent(domain)}/dns-records`,
763
+ params
764
+ );
765
+ }
766
+ /** Remove a DNS record you added earlier (never Migma's own records). */
767
+ async removeDnsRecord(domain, recordId) {
768
+ return this.client.delete(
769
+ `/domains/${encodeURIComponent(domain)}/dns-records/${encodeURIComponent(recordId)}`
770
+ );
771
+ }
772
+ };
773
+
774
+ // src/resources/billing.ts
775
+ var Billing = class {
776
+ constructor(client) {
777
+ this.client = client;
778
+ }
779
+ /** Plan and remaining credits for the API key owner. */
780
+ async credits() {
781
+ return this.client.get("/billing/credits");
782
+ }
783
+ /**
784
+ * Mint a Stripe link the account owner opens in a browser to upgrade or
785
+ * manage the subscription. Nothing is charged by this call itself.
786
+ */
787
+ async upgradeLink(params = {}) {
788
+ return this.client.post("/billing/upgrade-link", params);
789
+ }
790
+ };
791
+
722
792
  // src/resources/webhooks.ts
723
793
  var Webhooks = class {
724
794
  constructor(client) {
@@ -895,6 +965,8 @@ var Migma = class {
895
965
  previews;
896
966
  export;
897
967
  domains;
968
+ domainPurchases;
969
+ billing;
898
970
  webhooks;
899
971
  knowledgeBase;
900
972
  images;
@@ -922,6 +994,8 @@ var Migma = class {
922
994
  this.previews = new Previews(this.client);
923
995
  this.export = new Export(this.client);
924
996
  this.domains = new Domains(this.client);
997
+ this.domainPurchases = new DomainPurchases(this.client);
998
+ this.billing = new Billing(this.client);
925
999
  this.webhooks = new Webhooks(this.client);
926
1000
  this.knowledgeBase = new KnowledgeBase(this.client);
927
1001
  this.images = new Images(this.client);