strapi-plugin-magic-mail 2.10.6 → 2.10.8
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-PxOT9hIQ.mjs → App-CDFT2wYy.mjs} +6 -2
- package/dist/_chunks/{App-BJBweFJi.js → App-cpuAww_Y.js} +6 -2
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +34 -33
- package/dist/server/index.mjs +34 -33
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [2.10.8](https://github.com/Schero94/Magic-Mail/compare/v2.10.7...v2.10.8) (2026-04-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **editor:** navigate to newly created templates by templateReferenceId, not DB id ([617dc01](https://github.com/Schero94/Magic-Mail/commit/617dc01106101a7407bcfadbb61bbe49ef8eb43e))
|
|
7
|
+
|
|
8
|
+
## [2.10.7](https://github.com/Schero94/Magic-Mail/compare/v2.10.6...v2.10.7) (2026-04-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **email-designer:** prioritize templateReferenceId in findById() to match actual admin UI usage ([bcd7a4b](https://github.com/Schero94/Magic-Mail/commit/bcd7a4bd3b9640f8bc58694ec7a81fddb262245f))
|
|
14
|
+
|
|
1
15
|
## [2.10.6](https://github.com/Schero94/Magic-Mail/compare/v2.10.5...v2.10.6) (2026-04-21)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -6435,8 +6435,12 @@ const EditorPage = () => {
|
|
|
6435
6435
|
type: "success",
|
|
6436
6436
|
message: isNewTemplate ? "Template created!" : "Template saved!"
|
|
6437
6437
|
});
|
|
6438
|
-
if (isNewTemplate
|
|
6439
|
-
|
|
6438
|
+
if (isNewTemplate) {
|
|
6439
|
+
const created = response.data?.data;
|
|
6440
|
+
const navId = created?.templateReferenceId ?? created?.id;
|
|
6441
|
+
if (navId !== void 0 && navId !== null) {
|
|
6442
|
+
navigate(`/plugins/magic-mail/designer/${navId}`);
|
|
6443
|
+
}
|
|
6440
6444
|
}
|
|
6441
6445
|
} catch (error) {
|
|
6442
6446
|
toggleNotification({
|
|
@@ -6458,8 +6458,12 @@ const EditorPage = () => {
|
|
|
6458
6458
|
type: "success",
|
|
6459
6459
|
message: isNewTemplate ? "Template created!" : "Template saved!"
|
|
6460
6460
|
});
|
|
6461
|
-
if (isNewTemplate
|
|
6462
|
-
|
|
6461
|
+
if (isNewTemplate) {
|
|
6462
|
+
const created = response.data?.data;
|
|
6463
|
+
const navId = created?.templateReferenceId ?? created?.id;
|
|
6464
|
+
if (navId !== void 0 && navId !== null) {
|
|
6465
|
+
navigate(`/plugins/magic-mail/designer/${navId}`);
|
|
6466
|
+
}
|
|
6463
6467
|
}
|
|
6464
6468
|
} catch (error) {
|
|
6465
6469
|
toggleNotification({
|
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-cpuAww_Y.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-CDFT2wYy.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.7";
|
|
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));
|
|
@@ -16294,28 +16297,35 @@ var emailDesigner$1 = ({ strapi: strapi2 }) => ({
|
|
|
16294
16297
|
/**
|
|
16295
16298
|
* Get template by numeric ID.
|
|
16296
16299
|
*
|
|
16297
|
-
*
|
|
16298
|
-
*
|
|
16299
|
-
* `templateReferenceId`.
|
|
16300
|
-
*
|
|
16301
|
-
*
|
|
16302
|
-
* templateReferenceId *first* and fell back to the DB id — which
|
|
16303
|
-
* meant "Send Test" on the admin UI (which passes the DB id) would
|
|
16304
|
-
* silently send the WRONG template if another template happened to
|
|
16305
|
-
* have a templateReferenceId matching that number.
|
|
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`).
|
|
16306
16305
|
*
|
|
16307
|
-
*
|
|
16308
|
-
*
|
|
16309
|
-
*
|
|
16310
|
-
*
|
|
16311
|
-
*
|
|
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).
|
|
16312
16311
|
*
|
|
16313
|
-
*
|
|
16314
|
-
*
|
|
16312
|
+
* We intentionally do NOT spam warn-logs in the success path: the
|
|
16313
|
+
* reference-id lookup IS the primary path.
|
|
16315
16314
|
*/
|
|
16316
16315
|
async findById(id) {
|
|
16317
16316
|
const numericId = Number(id);
|
|
16318
|
-
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by
|
|
16317
|
+
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by ID: ${numericId}`);
|
|
16318
|
+
const byRefId = await strapi2.documents(EMAIL_TEMPLATE_UID).findMany({
|
|
16319
|
+
filters: { templateReferenceId: numericId },
|
|
16320
|
+
limit: 1,
|
|
16321
|
+
populate: { versions: true }
|
|
16322
|
+
});
|
|
16323
|
+
if (byRefId.length > 0) {
|
|
16324
|
+
strapi2.log.info(
|
|
16325
|
+
`[magic-mail] [SUCCESS] Found template by templateReferenceId ${numericId}: documentId=${byRefId[0].documentId}, name="${byRefId[0].name}"`
|
|
16326
|
+
);
|
|
16327
|
+
return byRefId[0];
|
|
16328
|
+
}
|
|
16319
16329
|
let byInternalId = null;
|
|
16320
16330
|
try {
|
|
16321
16331
|
byInternalId = await strapi2.entityService.findOne(EMAIL_TEMPLATE_UID, numericId, {
|
|
@@ -16325,21 +16335,12 @@ var emailDesigner$1 = ({ strapi: strapi2 }) => ({
|
|
|
16325
16335
|
strapi2.log.debug(`[magic-mail] [LOOKUP] entityService.findOne(${numericId}) threw: ${err.message}`);
|
|
16326
16336
|
}
|
|
16327
16337
|
if (byInternalId) {
|
|
16328
|
-
strapi2.log.info(
|
|
16329
|
-
|
|
16330
|
-
}
|
|
16331
|
-
const byRefId = await strapi2.documents(EMAIL_TEMPLATE_UID).findMany({
|
|
16332
|
-
filters: { templateReferenceId: numericId },
|
|
16333
|
-
limit: 1,
|
|
16334
|
-
populate: { versions: true }
|
|
16335
|
-
});
|
|
16336
|
-
if (byRefId.length > 0) {
|
|
16337
|
-
strapi2.log.warn(
|
|
16338
|
-
`[magic-mail] [FALLBACK] No template with internal id=${numericId}; resolved via templateReferenceId=${numericId} → "${byRefId[0].name}" (documentId=${byRefId[0].documentId}). If the caller meant the DB id, this is the wrong record — update the caller to pass templateReferenceId explicitly or use findByReferenceId().`
|
|
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.`
|
|
16339
16340
|
);
|
|
16340
|
-
return
|
|
16341
|
+
return byInternalId;
|
|
16341
16342
|
}
|
|
16342
|
-
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried internal id
|
|
16343
|
+
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal DB id)`);
|
|
16343
16344
|
return null;
|
|
16344
16345
|
},
|
|
16345
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.7";
|
|
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));
|
|
@@ -16281,28 +16284,35 @@ var emailDesigner$1 = ({ strapi: strapi2 }) => ({
|
|
|
16281
16284
|
/**
|
|
16282
16285
|
* Get template by numeric ID.
|
|
16283
16286
|
*
|
|
16284
|
-
*
|
|
16285
|
-
*
|
|
16286
|
-
* `templateReferenceId`.
|
|
16287
|
-
*
|
|
16288
|
-
*
|
|
16289
|
-
* templateReferenceId *first* and fell back to the DB id — which
|
|
16290
|
-
* meant "Send Test" on the admin UI (which passes the DB id) would
|
|
16291
|
-
* silently send the WRONG template if another template happened to
|
|
16292
|
-
* have a templateReferenceId matching that number.
|
|
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`).
|
|
16293
16292
|
*
|
|
16294
|
-
*
|
|
16295
|
-
*
|
|
16296
|
-
*
|
|
16297
|
-
*
|
|
16298
|
-
*
|
|
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).
|
|
16299
16298
|
*
|
|
16300
|
-
*
|
|
16301
|
-
*
|
|
16299
|
+
* We intentionally do NOT spam warn-logs in the success path: the
|
|
16300
|
+
* reference-id lookup IS the primary path.
|
|
16302
16301
|
*/
|
|
16303
16302
|
async findById(id) {
|
|
16304
16303
|
const numericId = Number(id);
|
|
16305
|
-
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by
|
|
16304
|
+
strapi2.log.info(`[magic-mail] [LOOKUP] Finding template by ID: ${numericId}`);
|
|
16305
|
+
const byRefId = await strapi2.documents(EMAIL_TEMPLATE_UID).findMany({
|
|
16306
|
+
filters: { templateReferenceId: numericId },
|
|
16307
|
+
limit: 1,
|
|
16308
|
+
populate: { versions: true }
|
|
16309
|
+
});
|
|
16310
|
+
if (byRefId.length > 0) {
|
|
16311
|
+
strapi2.log.info(
|
|
16312
|
+
`[magic-mail] [SUCCESS] Found template by templateReferenceId ${numericId}: documentId=${byRefId[0].documentId}, name="${byRefId[0].name}"`
|
|
16313
|
+
);
|
|
16314
|
+
return byRefId[0];
|
|
16315
|
+
}
|
|
16306
16316
|
let byInternalId = null;
|
|
16307
16317
|
try {
|
|
16308
16318
|
byInternalId = await strapi2.entityService.findOne(EMAIL_TEMPLATE_UID, numericId, {
|
|
@@ -16312,21 +16322,12 @@ var emailDesigner$1 = ({ strapi: strapi2 }) => ({
|
|
|
16312
16322
|
strapi2.log.debug(`[magic-mail] [LOOKUP] entityService.findOne(${numericId}) threw: ${err.message}`);
|
|
16313
16323
|
}
|
|
16314
16324
|
if (byInternalId) {
|
|
16315
|
-
strapi2.log.info(
|
|
16316
|
-
|
|
16317
|
-
}
|
|
16318
|
-
const byRefId = await strapi2.documents(EMAIL_TEMPLATE_UID).findMany({
|
|
16319
|
-
filters: { templateReferenceId: numericId },
|
|
16320
|
-
limit: 1,
|
|
16321
|
-
populate: { versions: true }
|
|
16322
|
-
});
|
|
16323
|
-
if (byRefId.length > 0) {
|
|
16324
|
-
strapi2.log.warn(
|
|
16325
|
-
`[magic-mail] [FALLBACK] No template with internal id=${numericId}; resolved via templateReferenceId=${numericId} → "${byRefId[0].name}" (documentId=${byRefId[0].documentId}). If the caller meant the DB id, this is the wrong record — update the caller to pass templateReferenceId explicitly or use findByReferenceId().`
|
|
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.`
|
|
16326
16327
|
);
|
|
16327
|
-
return
|
|
16328
|
+
return byInternalId;
|
|
16328
16329
|
}
|
|
16329
|
-
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried internal id
|
|
16330
|
+
strapi2.log.warn(`[magic-mail] [WARNING] Template with ID ${numericId} not found (tried templateReferenceId and internal DB id)`);
|
|
16330
16331
|
return null;
|
|
16331
16332
|
},
|
|
16332
16333
|
/**
|
package/package.json
CHANGED