UNPKG

medusa-email-confirmation-plugin

Version:

medusa-email-confirmation-plugin is a Medusa plugin that adds obligatory requirement for customers to confirm their email used for sign up to Medusa ecommerce stores.

21 lines (20 loc) 779 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.config = void 0; exports.default = handleCustomerCreated; const medusa_1 = require("@medusajs/medusa"); async function handleCustomerCreated({ data, eventName, container, pluginOptions, }) { const emailConfirmationService = container.resolve("EmailConfirmationService"); let customer = data; if (customer) { if (customer.has_account && emailConfirmationService.options().autoinit_on_register) { const response = await emailConfirmationService.tokenRequest(customer.email, true); } } } exports.config = { event: medusa_1.CustomerService.Events.CREATED, context: { subscriberId: "customer-created-email-confirmation-handler", }, };