@hartl-services/medusa-base 2.0.0 → 2.1.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 (33) hide show
  1. package/.medusa/server/src/admin/index.js +3 -1
  2. package/.medusa/server/src/admin/index.mjs +3 -1
  3. package/.medusa/server/src/api/customer-verification-request-throttle.js +50 -0
  4. package/.medusa/server/src/api/middlewares.js +31 -1
  5. package/.medusa/server/src/api/store/customer-verification/resend/route.js +17 -0
  6. package/.medusa/server/src/email/application/handle-customer-verification-event.js +341 -0
  7. package/.medusa/server/src/email/application/resend-customer-verification.js +65 -0
  8. package/.medusa/server/src/email/application/start-customer-verification-snapshot.js +21 -0
  9. package/.medusa/server/src/email/application/throttle-verification-request.js +49 -0
  10. package/.medusa/server/src/email/customer-verification-snapshot.js +144 -0
  11. package/.medusa/server/src/email/domain/business-keys.js +12 -2
  12. package/.medusa/server/src/email/domain/customer-verification-resend.js +37 -0
  13. package/.medusa/server/src/email/domain/event-schemas.js +18 -2
  14. package/.medusa/server/src/email/plugin-features.js +9 -2
  15. package/.medusa/server/src/email/rendering/default-templates.js +20 -1
  16. package/.medusa/server/src/email/rendering/resolve-shop-configuration.js +5 -1
  17. package/.medusa/server/src/email/types/email-kinds.js +14 -2
  18. package/.medusa/server/src/email/types/template-data.js +9 -1
  19. package/.medusa/server/src/modules/email/migrations/Migration20261001090000.js +16 -0
  20. package/.medusa/server/src/modules/email/service.js +30 -8
  21. package/.medusa/server/src/shop-config/build-food-shop-config.js +16 -1
  22. package/.medusa/server/src/subscribers/customer-verification.js +23 -0
  23. package/.medusa/server/src/workflows/email/dispatch-email-message.js +4 -2
  24. package/README.md +140 -15
  25. package/dist/email/customer-verification-snapshot.d.ts +53 -0
  26. package/dist/email/customer-verification-snapshot.js +143 -0
  27. package/dist/email/types/email-kinds.d.ts +9 -1
  28. package/dist/email/types/email-kinds.js +13 -1
  29. package/dist/email/types/shop-configuration.d.ts +8 -0
  30. package/dist/email/types/template-data.d.ts +9 -0
  31. package/dist/email/types/template-data.js +8 -0
  32. package/dist/shop-config/build-food-shop-config.js +15 -0
  33. package/package.json +2 -2
@@ -5,6 +5,7 @@ exports.defineFoodShopConfig = defineFoodShopConfig;
5
5
  const logger_1 = require("@medusajs/framework/logger");
6
6
  const utils_1 = require("@medusajs/framework/utils");
7
7
  const config_1 = require("../public/config");
8
+ const customer_verification_snapshot_1 = require("../email/customer-verification-snapshot");
8
9
  const sentry_logger_1 = require("../public/sentry-logger");
9
10
  const options_1 = require("./options");
10
11
  /**
@@ -156,6 +157,9 @@ function buildFoodShopConfig(options, environment = process.env) {
156
157
  orderNotificationEmail: options.orderNotificationEmail,
157
158
  // The e-mail module appends "#token=<token>".
158
159
  passwordResetUrl: () => (0, config_1.shopUrl)(storefrontOrigin, `${storefrontPath}/reset-password`),
160
+ // Account confirmation (E-Mail toggle `customer_verification`);
161
+ // the e-mail module appends "#token=<token>".
162
+ verifyAccountUrl: () => (0, config_1.shopUrl)(storefrontOrigin, `${storefrontPath}/verify-account`),
159
163
  timeZone: options.timeZone,
160
164
  },
161
165
  },
@@ -227,6 +231,17 @@ function buildFoodShopConfig(options, environment = process.env) {
227
231
  authCors: env.AUTH_CORS,
228
232
  jwtSecret: env.JWT_SECRET,
229
233
  cookieSecret: env.COOKIE_SECRET,
234
+ // Medusa reads this synchronously on every login and keeps the
235
+ // `authVerificationsPerActor` object (defineConfig and ConfigManager
236
+ // copy `http` shallowly), so a getter switches e-mail confirmation of
237
+ // customer accounts at run time. It answers from an in-memory copy of
238
+ // the E-Mail plugin's `customer_verification` toggle, refreshed at
239
+ // most every 30 s (see customer-verification-snapshot.ts).
240
+ authVerificationsPerActor: {
241
+ get customer() {
242
+ return (0, customer_verification_snapshot_1.customerVerificationActors)();
243
+ },
244
+ },
230
245
  },
231
246
  // The storefront turns its customer JWT into a Medusa browser session
232
247
  // at login, so its browser-side cart and payment calls carry the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hartl-services/medusa-base",
3
- "version": "2.0.0",
3
+ "version": "2.1.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": [
@@ -88,7 +88,7 @@
88
88
  "mime-types": "3.0.1",
89
89
  "nodemailer": "6.10.1",
90
90
  "ulid": "^2.4.0",
91
- "@hartl-services/medusa-food-supplements-contracts": "^0.17.0"
91
+ "@hartl-services/medusa-food-supplements-contracts": "^0.18.0"
92
92
  },
93
93
  "devDependencies": {
94
94
  "@medusajs/admin-sdk": "2.19.0",