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.js CHANGED
@@ -64,7 +64,7 @@ var init_providers = __esm({
64
64
  /**
65
65
  * Schedule a broadcast - default implementation throws not supported
66
66
  */
67
- async schedule(id, scheduledAt) {
67
+ async schedule(_id, _scheduledAt) {
68
68
  const capabilities = this.getCapabilities();
69
69
  if (!capabilities.supportsScheduling) {
70
70
  throw new BroadcastProviderError(
@@ -78,7 +78,7 @@ var init_providers = __esm({
78
78
  /**
79
79
  * Cancel scheduled broadcast - default implementation throws not supported
80
80
  */
81
- async cancelSchedule(id) {
81
+ async cancelSchedule(_id) {
82
82
  const capabilities = this.getCapabilities();
83
83
  if (!capabilities.supportsScheduling) {
84
84
  throw new BroadcastProviderError(
@@ -92,7 +92,7 @@ var init_providers = __esm({
92
92
  /**
93
93
  * Get analytics - default implementation returns zeros
94
94
  */
95
- async getAnalytics(id) {
95
+ async getAnalytics(_id) {
96
96
  const capabilities = this.getCapabilities();
97
97
  if (!capabilities.supportsAnalytics) {
98
98
  throw new BroadcastProviderError(
@@ -611,7 +611,7 @@ var init_broadcast2 = __esm({
611
611
  );
612
612
  }
613
613
  }
614
- async getAnalytics(id) {
614
+ async getAnalytics(_id) {
615
615
  throw new BroadcastProviderError(
616
616
  "Analytics API not yet implemented for Broadcast provider",
617
617
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
@@ -637,7 +637,7 @@ var init_broadcast2 = __esm({
637
637
  try {
638
638
  await this.list({ limit: 1 });
639
639
  return true;
640
- } catch (error) {
640
+ } catch {
641
641
  return false;
642
642
  }
643
643
  }
@@ -827,7 +827,7 @@ var init_broadcast3 = __esm({
827
827
  );
828
828
  }
829
829
  }
830
- async updateChannel(id, data) {
830
+ async updateChannel(_id, _data) {
831
831
  throw new BroadcastProviderError(
832
832
  "Updating channels (audiences) is not supported by Resend API",
833
833
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
@@ -847,14 +847,14 @@ var init_broadcast3 = __esm({
847
847
  }
848
848
  }
849
849
  // Broadcast Management Methods
850
- async list(options) {
850
+ async list(_options) {
851
851
  throw new BroadcastProviderError(
852
852
  "Listing broadcasts is not currently supported by Resend API. This feature may be available in the dashboard only.",
853
853
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
854
854
  this.name
855
855
  );
856
856
  }
857
- async get(id) {
857
+ async get(_id) {
858
858
  throw new BroadcastProviderError(
859
859
  "Getting individual broadcasts is not currently supported by Resend API. This feature may be available in the dashboard only.",
860
860
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
@@ -899,14 +899,14 @@ var init_broadcast3 = __esm({
899
899
  );
900
900
  }
901
901
  }
902
- async update(id, data) {
902
+ async update(_id, _data) {
903
903
  throw new BroadcastProviderError(
904
904
  "Updating broadcasts is not currently supported by Resend API. Note: Resend broadcasts can only be edited where they were created.",
905
905
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
906
906
  this.name
907
907
  );
908
908
  }
909
- async delete(id) {
909
+ async delete(_id) {
910
910
  throw new BroadcastProviderError(
911
911
  "Deleting broadcasts is not currently supported by Resend API.",
912
912
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
@@ -950,14 +950,14 @@ var init_broadcast3 = __esm({
950
950
  );
951
951
  }
952
952
  }
953
- async schedule(id, scheduledAt) {
953
+ async schedule(_id, _scheduledAt) {
954
954
  throw new BroadcastProviderError(
955
955
  "Scheduling broadcasts is not supported by Resend",
956
956
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
957
957
  this.name
958
958
  );
959
959
  }
960
- async getAnalytics(id) {
960
+ async getAnalytics(_id) {
961
961
  throw new BroadcastProviderError(
962
962
  "Getting broadcast analytics via API is not currently supported. Analytics may be available in the Resend dashboard.",
963
963
  "NOT_SUPPORTED" /* NOT_SUPPORTED */,
@@ -1001,7 +1001,7 @@ var init_broadcast3 = __esm({
1001
1001
  html: "<p>Testing configuration</p>"
1002
1002
  });
1003
1003
  return true;
1004
- } catch (error) {
1004
+ } catch {
1005
1005
  return false;
1006
1006
  }
1007
1007
  }
@@ -2088,20 +2088,18 @@ var BroadcastProvider = class {
2088
2088
  name: this.fromName
2089
2089
  };
2090
2090
  const recipients = Array.isArray(params.to) ? params.to : [params.to];
2091
- const response = await fetch(`${this.apiUrl}/api/v1/emails`, {
2091
+ const response = await fetch(`${this.apiUrl}/api/v1/transactionals.json`, {
2092
2092
  method: "POST",
2093
2093
  headers: {
2094
2094
  "Authorization": `Bearer ${this.token}`,
2095
2095
  "Content-Type": "application/json"
2096
2096
  },
2097
2097
  body: JSON.stringify({
2098
- from_email: from.email,
2099
- from_name: from.name,
2100
- to: recipients,
2098
+ to: recipients[0],
2099
+ // Broadcast API expects a single recipient for transactional emails
2101
2100
  subject: params.subject,
2102
- html_body: params.html,
2103
- text_body: params.text,
2104
- reply_to: params.replyTo
2101
+ body: params.html || params.text || "",
2102
+ reply_to: params.replyTo || from.email
2105
2103
  })
2106
2104
  });
2107
2105
  if (!response.ok) {