strapi-plugin-magic-mail 2.10.5 → 2.10.7
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/CHANGELOG.md +14 -0
- package/dist/_chunks/{App-2Bg4LxwL.js → App-BJBweFJi.js} +2 -1
- package/dist/_chunks/{App-CAtJIwNW.mjs → App-PxOT9hIQ.mjs} +2 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +38 -13
- package/dist/server/index.mjs +38 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.10.7](https://github.com/Schero94/Magic-Mail/compare/v2.10.6...v2.10.7) (2026-04-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **email-designer:** prioritize templateReferenceId in findById() to match actual admin UI usage ([bcd7a4b](https://github.com/Schero94/Magic-Mail/commit/bcd7a4bd3b9640f8bc58694ec7a81fddb262245f))
|
|
7
|
+
|
|
8
|
+
## [2.10.6](https://github.com/Schero94/Magic-Mail/compare/v2.10.5...v2.10.6) (2026-04-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **designer:** correct template lookup order so 'Send Test' hits the actual template ([c62c0e4](https://github.com/Schero94/Magic-Mail/commit/c62c0e461d39275dca2a176276d2797c9743a8fd))
|
|
14
|
+
|
|
1
15
|
## [2.10.5](https://github.com/Schero94/Magic-Mail/compare/v2.10.4...v2.10.5) (2026-04-21)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -4830,7 +4830,8 @@ const TemplateList = () => {
|
|
|
4830
4830
|
return;
|
|
4831
4831
|
}
|
|
4832
4832
|
try {
|
|
4833
|
-
const
|
|
4833
|
+
const templateIdForLookup = selectedTemplate.templateReferenceId ?? selectedTemplate.id;
|
|
4834
|
+
const response = await post(`/magic-mail/designer/templates/${templateIdForLookup}/test-send`, {
|
|
4834
4835
|
to: testEmail,
|
|
4835
4836
|
accountName: testAccount || null
|
|
4836
4837
|
});
|
|
@@ -4807,7 +4807,8 @@ const TemplateList = () => {
|
|
|
4807
4807
|
return;
|
|
4808
4808
|
}
|
|
4809
4809
|
try {
|
|
4810
|
-
const
|
|
4810
|
+
const templateIdForLookup = selectedTemplate.templateReferenceId ?? selectedTemplate.id;
|
|
4811
|
+
const response = await post(`/magic-mail/designer/templates/${templateIdForLookup}/test-send`, {
|
|
4811
4812
|
to: testEmail,
|
|
4812
4813
|
accountName: testAccount || null
|
|
4813
4814
|
});
|
package/dist/admin/index.js
CHANGED
|
@@ -68,7 +68,7 @@ const index = {
|
|
|
68
68
|
id: `${pluginId}.plugin.name`,
|
|
69
69
|
defaultMessage: "MagicMail"
|
|
70
70
|
},
|
|
71
|
-
Component: () => Promise.resolve().then(() => require("../_chunks/App-
|
|
71
|
+
Component: () => Promise.resolve().then(() => require("../_chunks/App-BJBweFJi.js")),
|
|
72
72
|
permissions: pluginPermissions
|
|
73
73
|
});
|
|
74
74
|
app.createSettingSection(
|
package/dist/admin/index.mjs
CHANGED
|
@@ -67,7 +67,7 @@ const index = {
|
|
|
67
67
|
id: `${pluginId}.plugin.name`,
|
|
68
68
|
defaultMessage: "MagicMail"
|
|
69
69
|
},
|
|
70
|
-
Component: () => import("../_chunks/App-
|
|
70
|
+
Component: () => import("../_chunks/App-PxOT9hIQ.mjs"),
|
|
71
71
|
permissions: pluginPermissions
|
|
72
72
|
});
|
|
73
73
|
app.createSettingSection(
|
package/dist/server/index.js
CHANGED
|
@@ -15851,7 +15851,7 @@ var oauth$1 = ({ strapi: strapi2 }) => ({
|
|
|
15851
15851
|
return account;
|
|
15852
15852
|
}
|
|
15853
15853
|
});
|
|
15854
|
-
const version = "2.10.
|
|
15854
|
+
const version = "2.10.6";
|
|
15855
15855
|
const require$$2 = {
|
|
15856
15856
|
version
|
|
15857
15857
|
};
|
|
@@ -16277,8 +16277,11 @@ var emailDesigner$1 = ({ strapi: strapi2 }) => ({
|
|
|
16277
16277
|
});
|
|
16278
16278
|
},
|
|
16279
16279
|
/**
|
|
16280
|
-
* Get template by ID (
|
|
16281
|
-
*
|
|
16280
|
+
* Get template by ID (numeric id or documentId) with populated versions.
|
|
16281
|
+
*
|
|
16282
|
+
* Numeric IDs are interpreted as `templateReferenceId` first (this is the
|
|
16283
|
+
* app-wide convention — see findById() below), then as legacy DB id.
|
|
16284
|
+
* Non-numeric strings are treated as Strapi v5 `documentId`s.
|
|
16282
16285
|
*/
|
|
16283
16286
|
async findOne(idOrDocumentId) {
|
|
16284
16287
|
const isNumericId = /^\d+$/.test(String(idOrDocumentId));
|
|
@@ -16292,30 +16295,52 @@ var emailDesigner$1 = ({ strapi: strapi2 }) => ({
|
|
|
16292
16295
|
});
|
|
16293
16296
|
},
|
|
16294
16297
|
/**
|
|
16295
|
-
* Get template by numeric ID
|
|
16296
|
-
*
|
|
16298
|
+
* Get template by numeric ID.
|
|
16299
|
+
*
|
|
16300
|
+
* CONTRACT — every HTTP route that carries `:id` (admin UI, REST callers,
|
|
16301
|
+
* magic-link's `magic_mail_template_id`, Strapi's own test-send) refers to
|
|
16302
|
+
* the user-visible `templateReferenceId`. That is what `TemplateList`
|
|
16303
|
+
* navigates with, what `EditorPage` reads from `useParams()`, and what the
|
|
16304
|
+
* `findAll()` response surfaces as `templateReferenceId` (alongside `.id`).
|
|
16305
|
+
*
|
|
16306
|
+
* So: we resolve the reference id FIRST. The DB id is only kept as a
|
|
16307
|
+
* best-effort fallback for very old installs that might have persisted
|
|
16308
|
+
* the Strapi primary key as their template key before the reference id
|
|
16309
|
+
* was introduced. Collisions between the two ID spaces are prevented on
|
|
16310
|
+
* create() (refId uniqueness is enforced there).
|
|
16311
|
+
*
|
|
16312
|
+
* We intentionally do NOT spam warn-logs in the success path: the
|
|
16313
|
+
* reference-id lookup IS the primary path.
|
|
16297
16314
|
*/
|
|
16298
16315
|
async findById(id) {
|
|
16299
16316
|
const numericId = Number(id);
|
|
16300
|
-
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by
|
|
16317
|
+
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by ID: ${numericId}`);
|
|
16301
16318
|
const byRefId = await strapi2.documents(EMAIL_TEMPLATE_UID).findMany({
|
|
16302
16319
|
filters: { templateReferenceId: numericId },
|
|
16303
16320
|
limit: 1,
|
|
16304
16321
|
populate: { versions: true }
|
|
16305
16322
|
});
|
|
16306
16323
|
if (byRefId.length > 0) {
|
|
16307
|
-
strapi2.log.info(
|
|
16324
|
+
strapi2.log.info(
|
|
16325
|
+
`[magic-mail] [SUCCESS] Found template by templateReferenceId ${numericId}: documentId=${byRefId[0].documentId}, name="${byRefId[0].name}"`
|
|
16326
|
+
);
|
|
16308
16327
|
return byRefId[0];
|
|
16309
16328
|
}
|
|
16310
|
-
|
|
16311
|
-
|
|
16312
|
-
|
|
16313
|
-
|
|
16329
|
+
let byInternalId = null;
|
|
16330
|
+
try {
|
|
16331
|
+
byInternalId = await strapi2.entityService.findOne(EMAIL_TEMPLATE_UID, numericId, {
|
|
16332
|
+
populate: { versions: true }
|
|
16333
|
+
});
|
|
16334
|
+
} catch (err) {
|
|
16335
|
+
strapi2.log.debug(`[magic-mail] [LOOKUP] entityService.findOne(${numericId}) threw: ${err.message}`);
|
|
16336
|
+
}
|
|
16314
16337
|
if (byInternalId) {
|
|
16315
|
-
strapi2.log.info(
|
|
16338
|
+
strapi2.log.info(
|
|
16339
|
+
`[magic-mail] [LEGACY-LOOKUP] No templateReferenceId=${numericId}; resolved via internal DB id=${numericId} → "${byInternalId.name}" (documentId=${byInternalId.documentId}). Consider storing the template's templateReferenceId (${byInternalId.templateReferenceId ?? "none set"}) instead of its DB id to keep callers stable across migrations.`
|
|
16340
|
+
);
|
|
16316
16341
|
return byInternalId;
|
|
16317
16342
|
}
|
|
16318
|
-
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal id)`);
|
|
16343
|
+
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal DB id)`);
|
|
16319
16344
|
return null;
|
|
16320
16345
|
},
|
|
16321
16346
|
/**
|
package/dist/server/index.mjs
CHANGED
|
@@ -15838,7 +15838,7 @@ var oauth$1 = ({ strapi: strapi2 }) => ({
|
|
|
15838
15838
|
return account;
|
|
15839
15839
|
}
|
|
15840
15840
|
});
|
|
15841
|
-
const version = "2.10.
|
|
15841
|
+
const version = "2.10.6";
|
|
15842
15842
|
const require$$2 = {
|
|
15843
15843
|
version
|
|
15844
15844
|
};
|
|
@@ -16264,8 +16264,11 @@ var emailDesigner$1 = ({ strapi: strapi2 }) => ({
|
|
|
16264
16264
|
});
|
|
16265
16265
|
},
|
|
16266
16266
|
/**
|
|
16267
|
-
* Get template by ID (
|
|
16268
|
-
*
|
|
16267
|
+
* Get template by ID (numeric id or documentId) with populated versions.
|
|
16268
|
+
*
|
|
16269
|
+
* Numeric IDs are interpreted as `templateReferenceId` first (this is the
|
|
16270
|
+
* app-wide convention — see findById() below), then as legacy DB id.
|
|
16271
|
+
* Non-numeric strings are treated as Strapi v5 `documentId`s.
|
|
16269
16272
|
*/
|
|
16270
16273
|
async findOne(idOrDocumentId) {
|
|
16271
16274
|
const isNumericId = /^\d+$/.test(String(idOrDocumentId));
|
|
@@ -16279,30 +16282,52 @@ var emailDesigner$1 = ({ strapi: strapi2 }) => ({
|
|
|
16279
16282
|
});
|
|
16280
16283
|
},
|
|
16281
16284
|
/**
|
|
16282
|
-
* Get template by numeric ID
|
|
16283
|
-
*
|
|
16285
|
+
* Get template by numeric ID.
|
|
16286
|
+
*
|
|
16287
|
+
* CONTRACT — every HTTP route that carries `:id` (admin UI, REST callers,
|
|
16288
|
+
* magic-link's `magic_mail_template_id`, Strapi's own test-send) refers to
|
|
16289
|
+
* the user-visible `templateReferenceId`. That is what `TemplateList`
|
|
16290
|
+
* navigates with, what `EditorPage` reads from `useParams()`, and what the
|
|
16291
|
+
* `findAll()` response surfaces as `templateReferenceId` (alongside `.id`).
|
|
16292
|
+
*
|
|
16293
|
+
* So: we resolve the reference id FIRST. The DB id is only kept as a
|
|
16294
|
+
* best-effort fallback for very old installs that might have persisted
|
|
16295
|
+
* the Strapi primary key as their template key before the reference id
|
|
16296
|
+
* was introduced. Collisions between the two ID spaces are prevented on
|
|
16297
|
+
* create() (refId uniqueness is enforced there).
|
|
16298
|
+
*
|
|
16299
|
+
* We intentionally do NOT spam warn-logs in the success path: the
|
|
16300
|
+
* reference-id lookup IS the primary path.
|
|
16284
16301
|
*/
|
|
16285
16302
|
async findById(id) {
|
|
16286
16303
|
const numericId = Number(id);
|
|
16287
|
-
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by
|
|
16304
|
+
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by ID: ${numericId}`);
|
|
16288
16305
|
const byRefId = await strapi2.documents(EMAIL_TEMPLATE_UID).findMany({
|
|
16289
16306
|
filters: { templateReferenceId: numericId },
|
|
16290
16307
|
limit: 1,
|
|
16291
16308
|
populate: { versions: true }
|
|
16292
16309
|
});
|
|
16293
16310
|
if (byRefId.length > 0) {
|
|
16294
|
-
strapi2.log.info(
|
|
16311
|
+
strapi2.log.info(
|
|
16312
|
+
`[magic-mail] [SUCCESS] Found template by templateReferenceId ${numericId}: documentId=${byRefId[0].documentId}, name="${byRefId[0].name}"`
|
|
16313
|
+
);
|
|
16295
16314
|
return byRefId[0];
|
|
16296
16315
|
}
|
|
16297
|
-
|
|
16298
|
-
|
|
16299
|
-
|
|
16300
|
-
|
|
16316
|
+
let byInternalId = null;
|
|
16317
|
+
try {
|
|
16318
|
+
byInternalId = await strapi2.entityService.findOne(EMAIL_TEMPLATE_UID, numericId, {
|
|
16319
|
+
populate: { versions: true }
|
|
16320
|
+
});
|
|
16321
|
+
} catch (err) {
|
|
16322
|
+
strapi2.log.debug(`[magic-mail] [LOOKUP] entityService.findOne(${numericId}) threw: ${err.message}`);
|
|
16323
|
+
}
|
|
16301
16324
|
if (byInternalId) {
|
|
16302
|
-
strapi2.log.info(
|
|
16325
|
+
strapi2.log.info(
|
|
16326
|
+
`[magic-mail] [LEGACY-LOOKUP] No templateReferenceId=${numericId}; resolved via internal DB id=${numericId} → "${byInternalId.name}" (documentId=${byInternalId.documentId}). Consider storing the template's templateReferenceId (${byInternalId.templateReferenceId ?? "none set"}) instead of its DB id to keep callers stable across migrations.`
|
|
16327
|
+
);
|
|
16303
16328
|
return byInternalId;
|
|
16304
16329
|
}
|
|
16305
|
-
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal id)`);
|
|
16330
|
+
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal DB id)`);
|
|
16306
16331
|
return null;
|
|
16307
16332
|
},
|
|
16308
16333
|
/**
|
package/package.json
CHANGED