Skip to content

Commit 75d6ab3

Browse files
authored
Merge pull request #6 from codee-sh/feat-import-fixes
Feat import fixes
2 parents 8b49e5c + 901b9d7 commit 75d6ab3

5 files changed

Lines changed: 11 additions & 6 deletions

File tree

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"fixed": [],
66
"linked": [],
77
"access": "public",
8-
"baseBranch": "master",
8+
"baseBranch": "main",
99
"updateInternalDependencies": "patch",
1010
"ignore": []
1111
}

.changeset/open-actors-wish.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@codee-sh/medusa-plugin-automations": patch
3+
---
4+
5+
Update the fixes with import template module

.github/workflows/changeset-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Version Bump
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77

88
jobs:
99
version:

src/modules/mpn-automation/services/service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,8 @@ class MpnAutomationService extends MedusaService({
332332

333333
try {
334334
const templateModule = await import(templateValue)
335-
const name = `render${templateName.charAt(0).toUpperCase() + templateName.slice(1)}`
336-
337-
renderer = templateModule[name] || templateModule.default
335+
const template = templateModule.default
336+
renderer = template?.default || template
338337

339338
if (!renderer) {
340339
this.logger_.warn(
@@ -351,6 +350,7 @@ class MpnAutomationService extends MedusaService({
351350

352351
if (templateName) {
353352
handler.registerTemplate!(templateName, renderer)
353+
354354
this.logger_.info(
355355
`Custom template "${templateName}" registered for handler "${actionConfig.id}"`
356356
)

src/modules/mpn-automation/services/slack-action-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class SlackActionService extends BaseActionService {
4040
options?: any
4141
}): Promise<{ text: string; blocks: SlackBlock[] }> {
4242
const renderer = this.getTemplate(params.templateName) as SlackTemplateRenderer | undefined
43-
43+
4444
if (!renderer) {
4545
throw new Error(
4646
`Slack template "${params.templateName}" not found. Available templates: ${Array.from(this.templates_.keys()).join(", ")}`

0 commit comments

Comments
 (0)