-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add internationalization for newsletter preview and add salutation bl…
…ock for testing (#73) * Add internationalization for newsletter preview and add salutation block for testing * Add changeset * Adapt changeset - specify that previewUrl was removed
- Loading branch information
1 parent
7e56895
commit e5dbbfa
Showing
19 changed files
with
108 additions
and
29 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,13 @@ | ||
--- | ||
"@comet/brevo-admin": major | ||
--- | ||
|
||
Add `resolvePreviewUrlForScope` in `BrevoConfigProvider` to be able to provide internationalization for the preview. The previous `previewUrl` option has been removed and must be defined via the `resolvePreviewUrlForScope`. | ||
|
||
**The project can then call different urls based on the scope like that:** | ||
|
||
```typescript | ||
resolvePreviewUrlForScope: (scope: ContentScope) => { | ||
return `${config.campaignUrl}/preview/${scope.domain}/${scope.language}`; | ||
}, | ||
``` |
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
10 changes: 10 additions & 0 deletions
10
demo/admin/src/emailCampaigns/blocks/EmailCampaignSalutationBlock.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,10 @@ | ||
import { BlockCategory, createCompositeBlock } from "@comet/blocks-admin"; | ||
import * as React from "react"; | ||
import { FormattedMessage } from "react-intl"; | ||
|
||
export const EmailCampaignSalutationBlock = createCompositeBlock({ | ||
name: "EmailCampaignSalutation", | ||
displayName: <FormattedMessage id="emailCampaign.salutationBlock.displayName" defaultMessage="Salutation" />, | ||
category: BlockCategory.TextAndContent, | ||
blocks: {}, | ||
}); |
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
15 changes: 15 additions & 0 deletions
15
demo/api/src/email-campaign/blocks/email-campaign-salutation.block.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,15 @@ | ||
import { BlockData, BlockInput, createBlock, inputToData } from "@comet/blocks-api"; | ||
|
||
class EmailCampaignSalutationBlockData extends BlockData {} | ||
|
||
class EmailCampaignSalutationBlockInput extends BlockInput { | ||
transformToBlockData(): EmailCampaignSalutationBlockData { | ||
return inputToData(EmailCampaignSalutationBlockData, this); | ||
} | ||
} | ||
|
||
export const EmailCampaignSalutationBlock = createBlock( | ||
EmailCampaignSalutationBlockData, | ||
EmailCampaignSalutationBlockInput, | ||
"EmailCampaignSalutation", | ||
); |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.next/ | ||
block-meta.json | ||
lang-compiled/ | ||
lang-extracted/ | ||
lang/ | ||
preBuild/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { PropsWithData } from "@comet/cms-site"; | ||
import { MjmlColumn, MjmlText } from "@luma-team/mjml-react"; | ||
import { RichTextBlockData } from "@src/blocks.generated"; | ||
import { IndentedSectionGroup } from "@src/components/IndentedSectionGroup"; | ||
import * as React from "react"; | ||
import { FormattedMessage } from "react-intl"; | ||
|
||
export const SalutationBlock: React.FC<PropsWithData<RichTextBlockData>> = ({ data }) => { | ||
return ( | ||
<IndentedSectionGroup> | ||
<MjmlColumn> | ||
<MjmlText> | ||
<FormattedMessage id="salutationBlock.salutation" defaultMessage="Dear customer!" /> | ||
</MjmlText> | ||
</MjmlColumn> | ||
</IndentedSectionGroup> | ||
); | ||
}; |
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