-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/location-ui-fixes
- Loading branch information
Showing
147 changed files
with
3,419 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@medusajs/medusa": patch | ||
--- | ||
|
||
chore(medusa): cleanup admin function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@medusajs/medusa": patch | ||
--- | ||
|
||
chore(medusa): strict zod versions in workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@medusajs/medusa": patch | ||
--- | ||
|
||
fix(medusa): Missing middlewares export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@medusajs/modules-sdk": minor | ||
"@medusajs/types": minor | ||
"@medusajs/utils": minor | ||
"@medusajs/notification": patch | ||
--- | ||
|
||
Add basic implementation of a notification module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@medusajs/utils": patch | ||
--- | ||
|
||
chore(utils): Provide a mikro orm base entity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@medusajs/notification-sendgrid": patch | ||
"@medusajs/notification-logger": patch | ||
"@medusajs/types": patch | ||
--- | ||
|
||
Add sendgrid and logger notification providers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'type: docs': | ||
- changed-files: | ||
- any-glob-to-any-file: www/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: "Add Docs PR Label" | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
labeler: | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: label-the-PR | ||
uses: actions/labeler@v5 |
128 changes: 128 additions & 0 deletions
128
integration-tests/modules/__tests__/notification/admin/notification.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
import { ModuleRegistrationName } from "@medusajs/modules-sdk" | ||
import { | ||
CreateNotificationDTO, | ||
INotificationModuleService, | ||
Logger, | ||
} from "@medusajs/types" | ||
import { ContainerRegistrationKeys } from "@medusajs/utils" | ||
import { medusaIntegrationTestRunner } from "medusa-test-utils" | ||
|
||
jest.setTimeout(50000) | ||
|
||
const env = { MEDUSA_FF_MEDUSA_V2: true } | ||
medusaIntegrationTestRunner({ | ||
env, | ||
testSuite: ({ getContainer }) => { | ||
describe("Notification module", () => { | ||
let service: INotificationModuleService | ||
let logger: Logger | ||
|
||
beforeAll(async () => { | ||
service = getContainer().resolve(ModuleRegistrationName.NOTIFICATION) | ||
logger = getContainer().resolve(ContainerRegistrationKeys.LOGGER) | ||
}) | ||
|
||
afterEach(() => { | ||
jest.restoreAllMocks() | ||
}) | ||
|
||
it("should successfully send a notification for an available channel", async () => { | ||
const logSpy = jest.spyOn(logger, "info") | ||
const notification = { | ||
to: "[email protected]", | ||
channel: "email", | ||
template: "order-created", | ||
data: { username: "john-doe" }, | ||
trigger_type: "order-created", | ||
resource_id: "order-id", | ||
resource_type: "order", | ||
} as CreateNotificationDTO | ||
|
||
const result = await service.create(notification) | ||
const fromDB = await service.retrieve(result.id) | ||
|
||
expect(result).toEqual( | ||
expect.objectContaining({ | ||
id: expect.any(String), | ||
to: "[email protected]", | ||
provider_id: "local-notification-provider", | ||
}) | ||
) | ||
|
||
delete fromDB.original_notification_id | ||
delete fromDB.external_id | ||
delete fromDB.receiver_id | ||
delete (fromDB as any).idempotency_key | ||
delete (fromDB as any).provider | ||
|
||
expect(result).toEqual(fromDB) | ||
expect(logSpy).toHaveBeenCalledWith( | ||
'Attempting to send a notification to: [email protected] on the channel: email with template: order-created and data: {"username":"john-doe"}' | ||
) | ||
}) | ||
|
||
it("should throw an exception if there is no provider for the channel", async () => { | ||
const notification = { | ||
to: "[email protected]", | ||
channel: "sms", | ||
} as CreateNotificationDTO | ||
|
||
const error = await service.create(notification).catch((e) => e) | ||
expect(error.message).toEqual( | ||
"Could not find a notification provider for channel: sms" | ||
) | ||
}) | ||
|
||
it("should allow listing all notifications with filters", async () => { | ||
const notification1 = { | ||
to: "[email protected]", | ||
channel: "email", | ||
template: "order-created", | ||
} as CreateNotificationDTO | ||
|
||
const notification2 = { | ||
to: "[email protected]", | ||
channel: "log", | ||
template: "product-created", | ||
} as CreateNotificationDTO | ||
|
||
await service.create([notification1, notification2]) | ||
|
||
const notifications = await service.list({ channel: "log" }) | ||
expect(notifications).toHaveLength(1) | ||
expect(notifications[0]).toEqual( | ||
expect.objectContaining({ | ||
to: "[email protected]", | ||
channel: "log", | ||
template: "product-created", | ||
}) | ||
) | ||
}) | ||
|
||
it("should allow retrieving a notification", async () => { | ||
const notification1 = { | ||
to: "[email protected]", | ||
channel: "email", | ||
template: "order-created", | ||
} as CreateNotificationDTO | ||
|
||
const notification2 = { | ||
to: "[email protected]", | ||
channel: "log", | ||
template: "product-created", | ||
} as CreateNotificationDTO | ||
|
||
const [first] = await service.create([notification1, notification2]) | ||
|
||
const notification = await service.retrieve(first.id) | ||
expect(notification).toEqual( | ||
expect.objectContaining({ | ||
to: "[email protected]", | ||
channel: "email", | ||
template: "order-created", | ||
}) | ||
) | ||
}) | ||
}) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...ext/dashboard/src/v2-routes/campaigns/add-campaign-promotions/add-campaign-promotions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { useParams } from "react-router-dom" | ||
import { RouteFocusModal } from "../../../components/route-modal" | ||
import { useCampaign } from "../../../hooks/api/campaigns" | ||
import { AddCampaignPromotionsForm } from "./components" | ||
|
||
export const AddCampaignPromotions = () => { | ||
const { id } = useParams() | ||
const { campaign, isError, error } = useCampaign(id!) | ||
|
||
if (isError) { | ||
throw error | ||
} | ||
|
||
return ( | ||
<RouteFocusModal> | ||
{campaign && <AddCampaignPromotionsForm campaign={campaign} />} | ||
</RouteFocusModal> | ||
) | ||
} |
Oops, something went wrong.