medusa-plugin-ses 2.0.0 → 2.0.2

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/README.md CHANGED
@@ -56,7 +56,7 @@ SES_TEMPLATE_PATH="/full/absolute/path/to/medusa-server/data/templates"
56
56
 
57
57
  - The SES_FROM email address must be a verified sender in your AWS account.
58
58
 
59
- - The template path is the relative path from the medusa-server root folder. For example, create a 'data/templates' folder and make 'data/templates' the SES_TEMPLATE_PATH variable.
59
+ - The template path must be the full absolute path to the folder. For example, if your build runs from /home/medusa/medusa-server/, create a 'data/templates' folder and include the entire path in the SES_TEMPLATE_PATH variable.
60
60
  ```
61
61
  medusa-server // root directory
62
62
  |-data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "medusa-plugin-ses",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "AWS SES transactional emails using local handlebars templates",
5
5
  "main": "index.js",
6
6
  "repository": {
package/services/ses.js CHANGED
@@ -295,8 +295,8 @@ var SESService = /*#__PURE__*/function (_NotificationService) {
295
295
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
296
296
  while (1) switch (_context3.prev = _context3.next) {
297
297
  case 0:
298
- base = _path["default"].resolve(__dirname, '../../', this.options_.template_path, templateId); // The absolute path below is useful when using yarn link or npm link
299
- //const base = path.resolve(this.options_.template_path, templateId)
298
+ //const base = path.resolve(__dirname, '../../../', this.options_.template_path, templateId)
299
+ base = _path["default"].resolve(this.options_.template_path, templateId);
300
300
  subjectTemplate = _handlebars["default"].compile(_fs["default"].readFileSync(_path["default"].join(base, 'subject.hbs'), "utf8"));
301
301
  htmlTemplate = _handlebars["default"].compile(_fs["default"].readFileSync(_path["default"].join(base, 'html.hbs'), "utf8"));
302
302
  textTemplate = _handlebars["default"].compile(_fs["default"].readFileSync(_path["default"].join(base, 'text.hbs'), "utf8"));
@@ -227,9 +227,8 @@ class SESService extends NotificationService {
227
227
  }
228
228
 
229
229
  async compileTemplate(templateId, data) {
230
- const base = path.resolve(__dirname, '../../', this.options_.template_path, templateId)
231
- // The absolute path below is useful when using yarn link or npm link
232
- //const base = path.resolve(this.options_.template_path, templateId)
230
+ //const base = path.resolve(__dirname, '../../../', this.options_.template_path, templateId)
231
+ const base = path.resolve(this.options_.template_path, templateId)
233
232
  const subjectTemplate = Handlebars.compile(fs.readFileSync(path.join(base, 'subject.hbs'), "utf8"))
234
233
  const htmlTemplate = Handlebars.compile(fs.readFileSync(path.join(base, 'html.hbs'), "utf8"))
235
234
  const textTemplate = Handlebars.compile(fs.readFileSync(path.join(base, 'text.hbs'), "utf8"))