@hartl-services/medusa-base 2.10.0 → 2.11.0

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.
Files changed (25) hide show
  1. package/.medusa/server/src/admin/index.js +5 -1
  2. package/.medusa/server/src/admin/index.mjs +5 -1
  3. package/.medusa/server/src/email/application/deliver-ephemeral-auth-mail.js +2 -4
  4. package/.medusa/server/src/email/application/handle-password-reset-event.js +75 -27
  5. package/.medusa/server/src/email/rendering/default-templates.js +2 -1
  6. package/.medusa/server/src/email/rendering/render-email.js +2 -1
  7. package/.medusa/server/src/email/rendering/resolve-shop-configuration.js +5 -1
  8. package/.medusa/server/src/email/templates/blocks/dynamic-blocks.js +5 -2
  9. package/.medusa/server/src/email/templates/defaults/documents.js +8 -1
  10. package/.medusa/server/src/email/templates/defaults/subjects.js +3 -1
  11. package/.medusa/server/src/email/templates/defaults/texts.js +4 -2
  12. package/.medusa/server/src/email/templates/render.js +2 -1
  13. package/.medusa/server/src/email/templates/sample-data.js +5 -1
  14. package/.medusa/server/src/email/types/email-kinds.js +3 -1
  15. package/.medusa/server/src/email/types/template-data.js +8 -1
  16. package/.medusa/server/src/modules/email/migrations/Migration20261013120000.js +20 -0
  17. package/.medusa/server/src/shop-config/build-food-shop-config.js +7 -1
  18. package/README.md +25 -5
  19. package/dist/email/types/email-kinds.d.ts +3 -2
  20. package/dist/email/types/email-kinds.js +2 -0
  21. package/dist/email/types/shop-configuration.d.ts +8 -0
  22. package/dist/email/types/template-data.d.ts +6 -1
  23. package/dist/email/types/template-data.js +7 -0
  24. package/dist/shop-config/build-food-shop-config.js +6 -0
  25. package/package.json +3 -3
@@ -381,6 +381,7 @@ export declare const EmailPersistedDataSchemas: {
381
381
  client_id: z.ZodString;
382
382
  expires_on: z.ZodString;
383
383
  }, z.core.$strict>;
384
+ readonly "auth.admin_password_reset": z.ZodObject<{}, z.core.$strict>;
384
385
  };
385
386
  export declare const EmailRenderDataSchemas: {
386
387
  readonly "auth.password_reset": z.ZodObject<{
@@ -388,6 +389,10 @@ export declare const EmailRenderDataSchemas: {
388
389
  reset_url: z.ZodString;
389
390
  valid_minutes: z.ZodOptional<z.ZodNumber>;
390
391
  }, z.core.$strict>;
392
+ readonly "auth.admin_password_reset": z.ZodObject<{
393
+ reset_url: z.ZodString;
394
+ valid_minutes: z.ZodOptional<z.ZodNumber>;
395
+ }, z.core.$strict>;
391
396
  readonly "user.invite": z.ZodObject<{
392
397
  invite_url: z.ZodString;
393
398
  expires_at: z.ZodOptional<z.ZodString>;
@@ -635,7 +640,7 @@ export type EmailPersistedDataMap = {
635
640
  };
636
641
  type EmptyRenderContext = Readonly<Record<never, never>>;
637
642
  export type EmailEphemeralRenderContextMap = {
638
- readonly [Kind in EmailKind]: Kind extends "auth.password_reset" ? Readonly<{
643
+ readonly [Kind in EmailKind]: Kind extends "auth.password_reset" | "auth.admin_password_reset" ? Readonly<{
639
644
  reset_url: string;
640
645
  valid_minutes?: number;
641
646
  }> : Kind extends "user.invite" ? Readonly<{
@@ -240,6 +240,8 @@ exports.EmailPersistedDataSchemas = {
240
240
  expires_on: affiliate_1.CalendarDateSchema,
241
241
  })
242
242
  .strict(),
243
+ // The Admin dashboard is German only, so no locale; the link is ephemeral.
244
+ "auth.admin_password_reset": zod_1.z.object({}).strict(),
243
245
  };
244
246
  exports.EmailRenderDataSchemas = {
245
247
  ...exports.EmailPersistedDataSchemas,
@@ -248,6 +250,11 @@ exports.EmailRenderDataSchemas = {
248
250
  /** How long the reset link is valid, from the token; `undefined` if unknown. */
249
251
  valid_minutes: zod_1.z.number().int().positive().optional(),
250
252
  }),
253
+ "auth.admin_password_reset": exports.EmailPersistedDataSchemas["auth.admin_password_reset"].extend({
254
+ reset_url: zod_1.z.string().url(),
255
+ /** How long the reset link is valid, from the token; `undefined` if unknown. */
256
+ valid_minutes: zod_1.z.number().int().positive().optional(),
257
+ }),
251
258
  "user.invite": exports.EmailPersistedDataSchemas["user.invite"].extend({
252
259
  invite_url: zod_1.z.string().url(),
253
260
  /** When the invite expires (ISO 8601), from the current invite. */
@@ -172,6 +172,12 @@ function buildFoodShopConfig(options, environment = process.env) {
172
172
  adminAffiliateApplicationsUrl: () => new URL("/app/affiliates/applications", backendOrigin).toString(),
173
173
  // The Admin dashboard mounts under admin.path ("/app").
174
174
  adminOrderUrl: ({ orderId }) => new URL(`/app/orders/${encodeURIComponent(orderId)}`, backendOrigin).toString(),
175
+ // The Admin dashboard reads the token from the query, not the hash.
176
+ adminPasswordResetUrl: ({ token }) => {
177
+ const url = new URL("/app/reset-password", backendOrigin);
178
+ url.searchParams.set("token", token);
179
+ return url.toString();
180
+ },
175
181
  displayName: options.displayName,
176
182
  affiliatePortalUrl: (0, config_1.shopUrl)(storefrontOrigin, `${storefrontPath}/partnerportal`),
177
183
  // The Admin dashboard mounts "/invite" under admin.path ("/app").
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hartl-services/medusa-base",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "description": "Base plugin for Hartl Services Medusa shops: per-plugin feature toggles with a generic Admin settings page, a Store endpoint for storefronts, enforcement helpers, the complete-cart hook composition, the root redirect, cart-promotion link repair, the built-in E-Mail, Documents and S3 file storage modules, config helpers with the turnkey food-shop preset, and the Sentry logger wrapper and instrumentation.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -101,7 +101,7 @@
101
101
  "mime-types": "3.0.1",
102
102
  "nodemailer": "6.10.1",
103
103
  "ulid": "^2.4.0",
104
- "@hartl-services/medusa-food-supplements-contracts": "^0.30.0"
104
+ "@hartl-services/medusa-food-supplements-contracts": "^0.31.0"
105
105
  },
106
106
  "devDependencies": {
107
107
  "@medusajs/admin-sdk": "2.19.0",
@@ -153,7 +153,7 @@
153
153
  "dev": "medusa plugin:develop",
154
154
  "typecheck": "tsc --noEmit && tsc -p tsconfig.type-tests.json --noEmit && tsc -p tsconfig.component-tests.json",
155
155
  "pretest:unit": "pnpm --filter @hartl-services/medusa-food-supplements-contracts build",
156
- "test:unit": "jest",
156
+ "test:unit": "sh ../../scripts/dev-capped.sh jest",
157
157
  "pretest:contract": "pnpm --filter @hartl-services/medusa-food-supplements-contracts build",
158
158
  "test:contract": "jest --config jest.contract.config.js --runInBand",
159
159
  "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --config jest.integration.config.js --silent=false --runInBand --forceExit"