medusa-plugin-ses 2.0.2 → 2.0.4
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/package.json +1 -1
- package/services/ses.js +5 -6
- package/.babelrc +0 -13
- package/jest.config.js +0 -3
- package/src/api/index.js +0 -33
- package/src/services/ses.js +0 -1291
- package/src/subscribers/order.js +0 -20
- package/src/subscribers/restock.js +0 -41
- package/src/subscribers/user.js +0 -17
package/src/subscribers/order.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
class OrderSubscriber {
|
|
2
|
-
constructor({ notificationService }) {
|
|
3
|
-
this.notificationService_ = notificationService
|
|
4
|
-
|
|
5
|
-
this.notificationService_.subscribe("order.shipment_created", "ses")
|
|
6
|
-
this.notificationService_.subscribe("order.gift_card_created", "ses")
|
|
7
|
-
this.notificationService_.subscribe("gift_card.created", "ses")
|
|
8
|
-
this.notificationService_.subscribe("order.placed", "ses")
|
|
9
|
-
this.notificationService_.subscribe("order.canceled", "ses")
|
|
10
|
-
this.notificationService_.subscribe("customer.password_reset", "ses")
|
|
11
|
-
this.notificationService_.subscribe("claim.shipment_created", "ses")
|
|
12
|
-
this.notificationService_.subscribe("swap.shipment_created", "ses")
|
|
13
|
-
this.notificationService_.subscribe("swap.created", "ses")
|
|
14
|
-
this.notificationService_.subscribe("order.items_returned", "ses")
|
|
15
|
-
this.notificationService_.subscribe("order.return_requested", "ses")
|
|
16
|
-
this.notificationService_.subscribe("order.refund_created", "ses")
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default OrderSubscriber
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
class RestockNotification {
|
|
2
|
-
constructor({ eventBusService, sesService }) {
|
|
3
|
-
eventBusService.subscribe(
|
|
4
|
-
"restock-notification.restocked",
|
|
5
|
-
async (eventData) => {
|
|
6
|
-
const templateId = await sesService.getTemplateId(
|
|
7
|
-
"restock-notification.restocked"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
if (!templateId) {
|
|
11
|
-
return
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const data = await sesService.fetchData(
|
|
15
|
-
"restock-notification.restocked",
|
|
16
|
-
eventData,
|
|
17
|
-
null
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
if (!data.emails) {
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return await Promise.all(
|
|
25
|
-
data.emails.map(async (e) => {
|
|
26
|
-
const sendOptions = {
|
|
27
|
-
template_id: templateId,
|
|
28
|
-
from: sesService.options_.from,
|
|
29
|
-
to: e,
|
|
30
|
-
dynamic_template_data: data,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return await sesService.sendEmail(sendOptions)
|
|
34
|
-
})
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export default RestockNotification
|
package/src/subscribers/user.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
class UserSubscriber {
|
|
2
|
-
constructor({ sesService, eventBusService }) {
|
|
3
|
-
this.sesService_ = sesService
|
|
4
|
-
|
|
5
|
-
this.eventBus_ = eventBusService
|
|
6
|
-
|
|
7
|
-
this.eventBus_.subscribe("user.password_reset", async (data) => {
|
|
8
|
-
await this.sesService_.sendNotification(
|
|
9
|
-
"user.password_reset",
|
|
10
|
-
data,
|
|
11
|
-
null
|
|
12
|
-
)
|
|
13
|
-
})
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default UserSubscriber
|