payload-plugin-newsletter 0.9.0 → 0.9.2

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.cjs CHANGED
@@ -86,7 +86,7 @@ var init_providers = __esm({
86
86
  /**
87
87
  * Schedule a broadcast - default implementation throws not supported
88
88
  */
89
- async schedule(id, scheduledAt) {
89
+ async schedule(_id, _scheduledAt) {
90
90
  const capabilities = this.getCapabilities();
91
91
  if (!capabilities.supportsScheduling) {
92
92
  throw new BroadcastProviderError(
@@ -100,7 +100,7 @@ var init_providers = __esm({
100
100
  /**
101
101
  * Cancel scheduled broadcast - default implementation throws not supported
102
102
  */
103
- async cancelSchedule(id) {
103
+ async cancelSchedule(_id) {
104
104
  const capabilities = this.getCapabilities();
105
105
  if (!capabilities.supportsScheduling) {
106
106
  throw new BroadcastProviderError(
@@ -114,7 +114,7 @@ var init_providers = __esm({
114
114
  /**
115
115
  * Get analytics - default implementation returns zeros
116
116
  */
117
- async getAnalytics(id) {
117
+ async getAnalytics(_id) {
118
118
  const capabilities = this.getCapabilities();
119
119
  if (!capabilities.supportsAnalytics) {
120
120
  throw new BroadcastProviderError(
@@ -633,7 +633,7 @@ var init_broadcast2 = __esm({
633
633
  );
634
634
  }
635
635
  }
636
- async getAnalytics(id) {
636
+ async getAnalytics(_id) {
637
637
  throw new BroadcastProviderError(
638
638
  "Analytics API not yet implemented for Broadcast provider",
639
639
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
@@ -659,7 +659,7 @@ var init_broadcast2 = __esm({
659
659
  try {
660
660
  await this.list({ limit: 1 });
661
661
  return true;
662
- } catch (error) {
662
+ } catch {
663
663
  return false;
664
664
  }
665
665
  }
@@ -849,7 +849,7 @@ var init_broadcast3 = __esm({
849
849
  );
850
850
  }
851
851
  }
852
- async updateChannel(id, data) {
852
+ async updateChannel(_id, _data) {
853
853
  throw new BroadcastProviderError(
854
854
  "Updating channels (audiences) is not supported by Resend API",
855
855
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
@@ -869,14 +869,14 @@ var init_broadcast3 = __esm({
869
869
  }
870
870
  }
871
871
  // Broadcast Management Methods
872
- async list(options) {
872
+ async list(_options) {
873
873
  throw new BroadcastProviderError(
874
874
  "Listing broadcasts is not currently supported by Resend API. This feature may be available in the dashboard only.",
875
875
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
876
876
  this.name
877
877
  );
878
878
  }
879
- async get(id) {
879
+ async get(_id) {
880
880
  throw new BroadcastProviderError(
881
881
  "Getting individual broadcasts is not currently supported by Resend API. This feature may be available in the dashboard only.",
882
882
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
@@ -921,14 +921,14 @@ var init_broadcast3 = __esm({
921
921
  );
922
922
  }
923
923
  }
924
- async update(id, data) {
924
+ async update(_id, _data) {
925
925
  throw new BroadcastProviderError(
926
926
  "Updating broadcasts is not currently supported by Resend API. Note: Resend broadcasts can only be edited where they were created.",
927
927
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
928
928
  this.name
929
929
  );
930
930
  }
931
- async delete(id) {
931
+ async delete(_id) {
932
932
  throw new BroadcastProviderError(
933
933
  "Deleting broadcasts is not currently supported by Resend API.",
934
934
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
@@ -972,14 +972,14 @@ var init_broadcast3 = __esm({
972
972
  );
973
973
  }
974
974
  }
975
- async schedule(id, scheduledAt) {
975
+ async schedule(_id, _scheduledAt) {
976
976
  throw new BroadcastProviderError(
977
977
  "Scheduling broadcasts is not supported by Resend",
978
978
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
979
979
  this.name
980
980
  );
981
981
  }
982
- async getAnalytics(id) {
982
+ async getAnalytics(_id) {
983
983
  throw new BroadcastProviderError(
984
984
  "Getting broadcast analytics via API is not currently supported. Analytics may be available in the Resend dashboard.",
985
985
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
@@ -1023,7 +1023,7 @@ var init_broadcast3 = __esm({
1023
1023
  html: "<p>Testing configuration</p>"
1024
1024
  });
1025
1025
  return true;
1026
- } catch (error) {
1026
+ } catch {
1027
1027
  return false;
1028
1028
  }
1029
1029
  }
@@ -2105,20 +2105,18 @@ var BroadcastProvider = class {
2105
2105
  name: this.fromName
2106
2106
  };
2107
2107
  const recipients = Array.isArray(params.to) ? params.to : [params.to];
2108
- const response = await fetch(`${this.apiUrl}/api/v1/emails`, {
2108
+ const response = await fetch(`${this.apiUrl}/api/v1/transactionals.json`, {
2109
2109
  method: "POST",
2110
2110
  headers: {
2111
2111
  "Authorization": `Bearer ${this.token}`,
2112
2112
  "Content-Type": "application/json"
2113
2113
  },
2114
2114
  body: JSON.stringify({
2115
- from_email: from.email,
2116
- from_name: from.name,
2117
- to: recipients,
2115
+ to: recipients[0],
2116
+ // Broadcast API expects a single recipient for transactional emails
2118
2117
  subject: params.subject,
2119
- html_body: params.html,
2120
- text_body: params.text,
2121
- reply_to: params.replyTo
2118
+ body: params.html || params.text || "",
2119
+ reply_to: params.replyTo || from.email
2122
2120
  })
2123
2121
  });
2124
2122
  if (!response.ok) {