strapi-plugin-magic-mail 2.3.2 → 2.3.3
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/server/index.js +14 -9
- package/dist/server/index.mjs +14 -9
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -17,8 +17,8 @@ const require$$2__default = /* @__PURE__ */ _interopDefault(require$$2$2);
|
|
|
17
17
|
const require$$0__default$3 = /* @__PURE__ */ _interopDefault(require$$0$4);
|
|
18
18
|
const require$$1__default$2 = /* @__PURE__ */ _interopDefault(require$$1$3);
|
|
19
19
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
20
|
-
function getDefaultExportFromCjs(
|
|
21
|
-
return
|
|
20
|
+
function getDefaultExportFromCjs(x) {
|
|
21
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
22
22
|
}
|
|
23
23
|
var register;
|
|
24
24
|
var hasRequiredRegister;
|
|
@@ -1835,8 +1835,7 @@ function requireEmailDesigner$1() {
|
|
|
1835
1835
|
*/
|
|
1836
1836
|
async renderTemplate(ctx) {
|
|
1837
1837
|
try {
|
|
1838
|
-
const { templateReferenceId } =
|
|
1839
|
-
x.params;
|
|
1838
|
+
const { templateReferenceId } = ctx.params;
|
|
1840
1839
|
const { data } = ctx.request.body;
|
|
1841
1840
|
const rendered = await strapi2.plugin("magic-mail").service("email-designer").renderTemplate(parseInt(templateReferenceId), data);
|
|
1842
1841
|
return ctx.send({
|
|
@@ -5544,7 +5543,7 @@ function requireOauth() {
|
|
|
5544
5543
|
});
|
|
5545
5544
|
return oauth;
|
|
5546
5545
|
}
|
|
5547
|
-
const version = "2.3.
|
|
5546
|
+
const version = "2.3.2";
|
|
5548
5547
|
const require$$2 = {
|
|
5549
5548
|
version
|
|
5550
5549
|
};
|
|
@@ -5961,11 +5960,17 @@ function requireEmailDesigner() {
|
|
|
5961
5960
|
});
|
|
5962
5961
|
},
|
|
5963
5962
|
/**
|
|
5964
|
-
* Get template by ID (documentId) with populated versions
|
|
5963
|
+
* Get template by ID (documentId or numeric id) with populated versions
|
|
5964
|
+
* Supports both documentId (string) and numeric id for backward compatibility
|
|
5965
5965
|
*/
|
|
5966
|
-
async findOne(
|
|
5966
|
+
async findOne(idOrDocumentId) {
|
|
5967
|
+
const isNumericId = /^\d+$/.test(String(idOrDocumentId));
|
|
5968
|
+
if (isNumericId) {
|
|
5969
|
+
const result = await this.findById(Number(idOrDocumentId));
|
|
5970
|
+
if (result) return result;
|
|
5971
|
+
}
|
|
5967
5972
|
return strapi2.documents(EMAIL_TEMPLATE_UID).findOne({
|
|
5968
|
-
documentId,
|
|
5973
|
+
documentId: String(idOrDocumentId),
|
|
5969
5974
|
populate: ["versions"]
|
|
5970
5975
|
});
|
|
5971
5976
|
},
|
|
@@ -6164,7 +6169,7 @@ function requireEmailDesigner() {
|
|
|
6164
6169
|
* Get all versions for a template
|
|
6165
6170
|
*/
|
|
6166
6171
|
async getVersions(templateDocumentId) {
|
|
6167
|
-
strapi2.log.info(`[magic-mail]
|
|
6172
|
+
strapi2.log.info(`[magic-mail] [VERSION] Fetching versions for template documentId: ${templateDocumentId}`);
|
|
6168
6173
|
const template = await strapi2.documents(EMAIL_TEMPLATE_UID).findOne({
|
|
6169
6174
|
documentId: templateDocumentId,
|
|
6170
6175
|
populate: ["versions"]
|
package/dist/server/index.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import require$$2$2 from "decode-html";
|
|
|
7
7
|
import require$$0$4 from "path";
|
|
8
8
|
import require$$1$3 from "fs";
|
|
9
9
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
10
|
-
function getDefaultExportFromCjs(
|
|
11
|
-
return
|
|
10
|
+
function getDefaultExportFromCjs(x) {
|
|
11
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
12
12
|
}
|
|
13
13
|
var register;
|
|
14
14
|
var hasRequiredRegister;
|
|
@@ -1825,8 +1825,7 @@ function requireEmailDesigner$1() {
|
|
|
1825
1825
|
*/
|
|
1826
1826
|
async renderTemplate(ctx) {
|
|
1827
1827
|
try {
|
|
1828
|
-
const { templateReferenceId } =
|
|
1829
|
-
x.params;
|
|
1828
|
+
const { templateReferenceId } = ctx.params;
|
|
1830
1829
|
const { data } = ctx.request.body;
|
|
1831
1830
|
const rendered = await strapi2.plugin("magic-mail").service("email-designer").renderTemplate(parseInt(templateReferenceId), data);
|
|
1832
1831
|
return ctx.send({
|
|
@@ -5534,7 +5533,7 @@ function requireOauth() {
|
|
|
5534
5533
|
});
|
|
5535
5534
|
return oauth;
|
|
5536
5535
|
}
|
|
5537
|
-
const version = "2.3.
|
|
5536
|
+
const version = "2.3.2";
|
|
5538
5537
|
const require$$2 = {
|
|
5539
5538
|
version
|
|
5540
5539
|
};
|
|
@@ -5951,11 +5950,17 @@ function requireEmailDesigner() {
|
|
|
5951
5950
|
});
|
|
5952
5951
|
},
|
|
5953
5952
|
/**
|
|
5954
|
-
* Get template by ID (documentId) with populated versions
|
|
5953
|
+
* Get template by ID (documentId or numeric id) with populated versions
|
|
5954
|
+
* Supports both documentId (string) and numeric id for backward compatibility
|
|
5955
5955
|
*/
|
|
5956
|
-
async findOne(
|
|
5956
|
+
async findOne(idOrDocumentId) {
|
|
5957
|
+
const isNumericId = /^\d+$/.test(String(idOrDocumentId));
|
|
5958
|
+
if (isNumericId) {
|
|
5959
|
+
const result = await this.findById(Number(idOrDocumentId));
|
|
5960
|
+
if (result) return result;
|
|
5961
|
+
}
|
|
5957
5962
|
return strapi2.documents(EMAIL_TEMPLATE_UID).findOne({
|
|
5958
|
-
documentId,
|
|
5963
|
+
documentId: String(idOrDocumentId),
|
|
5959
5964
|
populate: ["versions"]
|
|
5960
5965
|
});
|
|
5961
5966
|
},
|
|
@@ -6154,7 +6159,7 @@ function requireEmailDesigner() {
|
|
|
6154
6159
|
* Get all versions for a template
|
|
6155
6160
|
*/
|
|
6156
6161
|
async getVersions(templateDocumentId) {
|
|
6157
|
-
strapi2.log.info(`[magic-mail]
|
|
6162
|
+
strapi2.log.info(`[magic-mail] [VERSION] Fetching versions for template documentId: ${templateDocumentId}`);
|
|
6158
6163
|
const template = await strapi2.documents(EMAIL_TEMPLATE_UID).findOne({
|
|
6159
6164
|
documentId: templateDocumentId,
|
|
6160
6165
|
populate: ["versions"]
|
package/package.json
CHANGED