Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: onboarding experiment #5249

Closed
wants to merge 243 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
243 commits
Select commit Hold shift + click to select a range
5820004
feat: add dropzone package
BiswaViraj Jan 23, 2024
695fccc
Merge pull request #5108 from novuhq/nv-2908-upload-translation-files…
BiswaViraj Jan 25, 2024
a5fb8ba
Merge branch 'next' into translation-management-beta
ainouzgali Jan 28, 2024
ecbe70f
feat: add file upload support for cypress
BiswaViraj Jan 29, 2024
9bb1ca1
feat(wip): routes for preview
ainouzgali Jan 29, 2024
776a205
Update apps/web/cypress/tests/translations/translation-group.spec-ee.ts
BiswaViraj Jan 29, 2024
6774901
fix: test
BiswaViraj Jan 29, 2024
6e3a8c0
Merge pull request #5127 from novuhq/nv-3336-translation-add-ability-…
BiswaViraj Jan 30, 2024
1cac2fc
feat: preview sidebar actions
ainouzgali Jan 31, 2024
7800cb1
Merge branch 'translation-management-beta' into nv-3007-create-the-ch…
ainouzgali Jan 31, 2024
5135136
test: initial tests fix
ainouzgali Jan 31, 2024
a6c3538
Merge remote-tracking branch 'origin/nv-3007-create-the-channel-previ…
ainouzgali Jan 31, 2024
307afdf
test: change to new test id of name input
ainouzgali Jan 31, 2024
f22b030
test: preview different test id for conditions action
ainouzgali Jan 31, 2024
197f35f
test: adjust tests
ainouzgali Feb 1, 2024
36965ad
test: adjust variant test
ainouzgali Feb 1, 2024
f65bcd1
test: step actions tests
ainouzgali Feb 1, 2024
8650933
test: edit channel
ainouzgali Feb 1, 2024
29c9c54
test: wait for close of tenant sidebar
ainouzgali Feb 1, 2024
7fc2360
Merge pull request #5128 from novuhq/nv-3007-create-the-channel-previ…
ainouzgali Feb 4, 2024
cc949fe
feat: email preview
BiswaViraj Feb 1, 2024
62164cc
feat: add custom locale support
BiswaViraj Feb 1, 2024
66ba987
feat: add locale selection state
BiswaViraj Feb 1, 2024
2dafcc2
feat: remove log
BiswaViraj Feb 1, 2024
f58e970
feat: added locale dropdown
BiswaViraj Feb 3, 2024
c3cb3b0
refactor: file structure
BiswaViraj Feb 3, 2024
19ca87e
feat: email preview
BiswaViraj Feb 1, 2024
be3ac43
feat: added locale dropdown
BiswaViraj Feb 3, 2024
097ea7d
feat: implemented chat preview foundation
BiswaViraj Feb 3, 2024
e4cc4bc
feat: update locale select
BiswaViraj Feb 3, 2024
d26128d
feat: error
BiswaViraj Feb 3, 2024
81e6e6b
fix: error
BiswaViraj Feb 3, 2024
6d3c122
feat: overlay
BiswaViraj Feb 3, 2024
c9ca994
feat: chat preview
ainouzgali Feb 4, 2024
5ce224b
fix: tests
BiswaViraj Feb 5, 2024
5f93f0f
Merge pull request #5157 from novuhq/nv-2997-reusable-chat-preview-co…
BiswaViraj Feb 6, 2024
228d579
feat: click on overlay
BiswaViraj Feb 6, 2024
391d323
feat: apply suggestions
BiswaViraj Feb 6, 2024
321d62f
fix: pass locale
BiswaViraj Feb 6, 2024
9f8d83e
fix: text row
BiswaViraj Feb 6, 2024
45cbd76
feat: reusable header skeleton
BiswaViraj Feb 6, 2024
4c751eb
feat: reusable skeleton for email
BiswaViraj Feb 6, 2024
f021b52
Merge branch 'next' into translation-management-beta
LetItRock Feb 7, 2024
7e87e0e
Merge branch 'translation-management-beta' into nv-2995-reusable-emai…
LetItRock Feb 7, 2024
bd9d984
fix: removed duplicate file
BiswaViraj Feb 7, 2024
a8f4db0
feat: pr suggestions
BiswaViraj Feb 7, 2024
9f7f2b1
fix: overlapping input
BiswaViraj Feb 7, 2024
3c9483d
Merge branch 'nv-2995-reusable-email-preview-component' of https://gi…
BiswaViraj Feb 7, 2024
2847b89
Merge branch 'next' into translation-management-beta
LetItRock Feb 7, 2024
593af6a
Merge branch 'translation-management-beta' into nv-2995-reusable-emai…
LetItRock Feb 7, 2024
8da6a70
feat: test
BiswaViraj Feb 8, 2024
fcd7932
feat(web): reusable sms preview component
LetItRock Feb 8, 2024
2ee0ed5
chore: remove unnecessary files
LetItRock Feb 9, 2024
bfd20c5
Merge branch 'next' into translation-management-beta
LetItRock Feb 9, 2024
0f52753
Merge branch 'translation-management-beta' into nv-2995-reusable-emai…
LetItRock Feb 9, 2024
9ae98ee
chore: update the source file
LetItRock Feb 9, 2024
d5f8f68
Merge branch 'nv-2995-reusable-email-preview-component' into nv-2998-…
LetItRock Feb 9, 2024
cd9f145
fix: test
BiswaViraj Feb 9, 2024
729c99e
Merge pull request #5143 from novuhq/nv-2995-reusable-email-preview-c…
BiswaViraj Feb 9, 2024
870a165
Merge branch 'translation-management-beta' into nv-2998-reusable-sms-…
BiswaViraj Feb 9, 2024
35203b7
feat: push preview
BiswaViraj Feb 9, 2024
c4eeb8a
feat: moved simulator
BiswaViraj Feb 9, 2024
37aa85e
feat: Update subproject commit hash
BiswaViraj Feb 9, 2024
0e04cd6
feat: add title support
BiswaViraj Feb 10, 2024
90b96c3
feat: add push preview hook
BiswaViraj Feb 10, 2024
ee2aaac
feat: added push preview support with backgrounds
BiswaViraj Feb 10, 2024
b83a1c4
feat: add channel props
BiswaViraj Feb 10, 2024
356e970
refactor: rename folder to lowercase email
BiswaViraj Feb 10, 2024
7bea6e5
feat: export phone simulator
BiswaViraj Feb 10, 2024
f4f377e
feat: update to use simulator and implement locales
BiswaViraj Feb 10, 2024
3e67687
feat: limit title to single row
BiswaViraj Feb 10, 2024
fdcffdd
feat: hook to get combined errors
BiswaViraj Feb 10, 2024
62f8e8a
feat: implemented combined error hook
BiswaViraj Feb 10, 2024
1ba72a7
feat: skeletons
BiswaViraj Feb 10, 2024
7d956ee
feat: light theme text and logo
BiswaViraj Feb 11, 2024
611feec
feat: removed old mobile
BiswaViraj Feb 11, 2024
6d11530
refactor: removed unused styles
BiswaViraj Feb 11, 2024
1fc1cc9
feat: content styles
BiswaViraj Feb 11, 2024
27f7afc
refactor: removed unused imports
BiswaViraj Feb 11, 2024
665680c
feat: overlay for push
BiswaViraj Feb 11, 2024
cd06a7b
fix: chat blur overlay
BiswaViraj Feb 11, 2024
6b26ad6
fix: overlay blur on email web preview
BiswaViraj Feb 11, 2024
edfb5f9
fix: locale select width on chat preview
BiswaViraj Feb 11, 2024
e28932a
fix: inccorect variable name
BiswaViraj Feb 12, 2024
dbad0a7
refactor: moved icons to icon folder
BiswaViraj Feb 12, 2024
27ca69f
feat: lowercase folder name
BiswaViraj Feb 12, 2024
9167433
refactor: move files
BiswaViraj Feb 12, 2024
c6dbaee
refactor: move files back to workflow
BiswaViraj Feb 12, 2024
0a0e999
refactor: remove unused file
BiswaViraj Feb 12, 2024
88246eb
feat: chat editor layout
ainouzgali Feb 12, 2024
05445b4
Merge remote-tracking branch 'origin/next' into translation-managemen…
ainouzgali Feb 12, 2024
7796dcd
Merge remote-tracking branch 'origin/translation-management-beta' int…
ainouzgali Feb 12, 2024
2386a11
feat: chat editor
ainouzgali Feb 12, 2024
e953840
test: fix tests and add light theme
ainouzgali Feb 12, 2024
ce581ae
fix: size of variables popover
ainouzgali Feb 12, 2024
752f691
feat(web): reusable sms preview suggestions from the pr #5173
LetItRock Feb 12, 2024
9e96127
Merge branch 'nv-2998-reusable-sms-preview' into nv-2996-reusable-pus…
LetItRock Feb 12, 2024
0ddf3fb
chore(web): renamed the hook
LetItRock Feb 12, 2024
12453f9
chore(web): reusable sms preview suggestions from the pr #5173
LetItRock Feb 13, 2024
863ea10
feat: update props to withbackground
BiswaViraj Feb 13, 2024
f3f287e
feat: use rems
BiswaViraj Feb 13, 2024
3456a3f
feat: use rems
BiswaViraj Feb 13, 2024
88700cf
feat: skeletons
BiswaViraj Feb 13, 2024
8b47c66
feat: renamed to sms
BiswaViraj Feb 13, 2024
03890d9
feat: usepreviewpushtemplate
BiswaViraj Feb 13, 2024
55b91fb
feat: use webp images
BiswaViraj Feb 13, 2024
aadc3e7
refactor: remove unused imports
BiswaViraj Feb 13, 2024
f572f2a
fix: merge
BiswaViraj Feb 13, 2024
e19d62d
refactor: remove empty line
BiswaViraj Feb 13, 2024
a3fb7cc
Merge remote-tracking branch 'origin/nv-2998-reusable-sms-preview' in…
BiswaViraj Feb 13, 2024
a49b3a0
fix: margin-top value
BiswaViraj Feb 13, 2024
55b7894
feat: update hook to take content and title as parameters
BiswaViraj Feb 13, 2024
6a1f6e0
chore(web): use the use hover hook
LetItRock Feb 13, 2024
24526c2
Merge pull request #5173 from novuhq/nv-2998-reusable-sms-preview
LetItRock Feb 13, 2024
77a5257
Merge branch 'next' into translation-management-beta
LetItRock Feb 13, 2024
a454a46
Merge remote-tracking branch 'origin/translation-management-beta' int…
ainouzgali Feb 13, 2024
3860091
Merge branch 'translation-management-beta' into nv-2996-reusable-push…
LetItRock Feb 13, 2024
d7d1cc1
refactor: extract to hook and change names for variable management
ainouzgali Feb 13, 2024
6fecdd7
Merge pull request #5178 from novuhq/nv-2996-reusable-push-preview-co…
LetItRock Feb 13, 2024
5cc3081
Merge remote-tracking branch 'origin/translation-management-beta' int…
ainouzgali Feb 13, 2024
a74612b
feat: merge conflicts
ainouzgali Feb 13, 2024
aa528ba
Merge pull request #5180 from novuhq/nv-3006-the-new-chat-editor
ainouzgali Feb 13, 2024
416a089
Merge branch 'next' into translation-management-beta
LetItRock Feb 13, 2024
1a953aa
feat: readonly mode in prod for editor
BiswaViraj Feb 13, 2024
a31d2a9
feat: add push editor
BiswaViraj Feb 13, 2024
aacebf2
fix: filename
BiswaViraj Feb 14, 2024
83a6441
feat: implemented push preview
BiswaViraj Feb 14, 2024
c05ee5e
feat: realtime updates for preview
BiswaViraj Feb 14, 2024
ccb90c7
feat: add height for title editor
BiswaViraj Feb 14, 2024
1da7f12
fix: tests
BiswaViraj Feb 14, 2024
666e3bc
fix: tests
BiswaViraj Feb 14, 2024
323e7d9
fix: add data test id
BiswaViraj Feb 14, 2024
430b3cc
feat: sms preview in editor
ainouzgali Feb 14, 2024
ebe986f
refactor: remove unused imports
BiswaViraj Feb 14, 2024
07b1ac0
fix: test
BiswaViraj Feb 14, 2024
9014894
fix: try adding wait
BiswaViraj Feb 14, 2024
723824c
refactor: wait
BiswaViraj Feb 15, 2024
f5e1213
feat: check editor content
BiswaViraj Feb 15, 2024
2e2b324
feat: update to use selectall
BiswaViraj Feb 15, 2024
4b6f4c7
fix: remove check content
BiswaViraj Feb 15, 2024
a81d858
feat: sms editor with preview
ainouzgali Feb 15, 2024
5a1ee17
test: adjust tests for sms content
ainouzgali Feb 15, 2024
44108fc
refactor: remove wait
BiswaViraj Feb 15, 2024
1c7fd2e
feat: center preview and optional overlay
BiswaViraj Feb 15, 2024
ae4610d
feat: parse paylod
BiswaViraj Feb 15, 2024
0f97ef8
feat: allow controlled preview
BiswaViraj Feb 15, 2024
85cf90b
test: fix tests
ainouzgali Feb 15, 2024
bc0e517
fix: parse payload
BiswaViraj Feb 15, 2024
cb5db89
feat: span grids
BiswaViraj Feb 15, 2024
cfa16df
feat: add gutter
BiswaViraj Feb 15, 2024
943db3f
feat: usedataref
BiswaViraj Feb 15, 2024
21089d4
test: fix tests
ainouzgali Feb 15, 2024
2c49b8e
Merge pull request #5197 from novuhq/nv-3005-the-new-sms-editor
LetItRock Feb 16, 2024
5061671
Merge branch 'translation-management-beta' into nv-3004-the-new-push-…
LetItRock Feb 16, 2024
57c8204
feat(web): translation management variants preview
LetItRock Feb 16, 2024
dd41b95
chore(web): fixing failing cypress e2e tests
LetItRock Feb 17, 2024
1406841
chore(web): marketing utm campaign on doc links
LetItRock Feb 17, 2024
c38cf99
chore(web): trying to fix e2e tests
LetItRock Feb 17, 2024
2f3bc3c
chore(web): trying to fix e2e tests
LetItRock Feb 18, 2024
65a81a0
Merge pull request #5191 from novuhq/nv-3004-the-new-push-editor
BiswaViraj Feb 18, 2024
c5974af
Merge branch 'next' into nv-3465-update-utm-campaign
LetItRock Feb 18, 2024
dd4638e
Merge branch 'translation-management-beta' into nv-3416-variants-preview
LetItRock Feb 18, 2024
dc64174
chore(web): sms preview fix loading state
LetItRock Feb 18, 2024
aa2a2ee
chore(web,shared): utm campaign query params
LetItRock Feb 19, 2024
7836d48
feat: initial setup
BiswaViraj Feb 15, 2024
312ab0b
feat: header icons
BiswaViraj Feb 15, 2024
1ae3357
feat: reusable in app preview
BiswaViraj Feb 17, 2024
41b180f
feat: add overaly props
BiswaViraj Feb 17, 2024
e7e3da7
fix: payload
BiswaViraj Feb 17, 2024
31c425b
feat: editor preview in-app
BiswaViraj Feb 17, 2024
56f1132
feat: removed translation banner
BiswaViraj Feb 17, 2024
6c0e067
refactor: typo
BiswaViraj Feb 17, 2024
8ba87a0
fix: test
BiswaViraj Feb 17, 2024
af17bfd
fix: test content
BiswaViraj Feb 17, 2024
8c47d0c
fix: tests by getting the latest processedvariables
BiswaViraj Feb 17, 2024
181b2fe
feat: update props type
BiswaViraj Feb 18, 2024
7cf0f57
feat: light theme fills
BiswaViraj Feb 18, 2024
251f71e
feat: ligh theme fixes
BiswaViraj Feb 18, 2024
93987c0
feat: merge from variants pr
ainouzgali Feb 18, 2024
60c1f34
Merge remote-tracking branch 'origin/nv-3416-variants-preview' into n…
ainouzgali Feb 18, 2024
bfecffd
feat: fix dependency use effect warning
ainouzgali Feb 18, 2024
4fefa3a
feat: adjust to the changes in the variant pr
ainouzgali Feb 18, 2024
d4d445c
fix: test
BiswaViraj Feb 19, 2024
663ab20
fix: test
BiswaViraj Feb 19, 2024
3a73435
fix: test
BiswaViraj Feb 19, 2024
483a5a1
feat: remove docker checks
BiswaViraj Feb 20, 2024
cf4c72d
refactor: add test id
BiswaViraj Feb 20, 2024
6175c21
fix: fix some issues found in translations
ainouzgali Feb 19, 2024
170da26
chore: update ref
BiswaViraj Feb 20, 2024
1a061b1
feat: implement cta and avatar
BiswaViraj Feb 20, 2024
6ebf979
feat: fix test
BiswaViraj Feb 20, 2024
14f83f7
chore: update hash
BiswaViraj Feb 20, 2024
a07dbfb
fix: update test id
BiswaViraj Feb 20, 2024
df6b8b5
fix: test
BiswaViraj Feb 20, 2024
9e0bcc5
refactor: remove unused imports
BiswaViraj Feb 20, 2024
51e4cc4
feat: add fallback lng
ainouzgali Feb 20, 2024
2448447
Merge pull request #5217 from novuhq/nv-3511-implement-avatar-and-cta…
BiswaViraj Feb 20, 2024
d18248d
Merge branch 'nv-2993-reusable-in-app-preview-component' into nv-3520…
ainouzgali Feb 20, 2024
cde09aa
feat: update source
ainouzgali Feb 20, 2024
4b849f6
chore(design-system): empty line before return statement
LetItRock Feb 20, 2024
c627999
Merge pull request #5222 from novuhq/nv-3520-use-default-locale-of-th…
ainouzgali Feb 20, 2024
f23e851
Merge pull request #5204 from novuhq/nv-2993-reusable-in-app-preview-…
ainouzgali Feb 20, 2024
80c41f9
Merge pull request #5203 from novuhq/nv-3465-update-utm-campaign
LetItRock Feb 20, 2024
867ce4e
Update Helm installation instructions and remove default encryption key
Cliftonz Feb 21, 2024
d655db2
Merge pull request #5226 from novuhq/fix-helm-encryption-key
Cliftonz Feb 21, 2024
7f39775
Make multiline comments a warning (#5227)
antonjoel82 Feb 22, 2024
e9501ee
fix: remove embed
scopsy Feb 22, 2024
7d7aac2
Merge branch 'main' into next
scopsy Feb 22, 2024
b96e0ae
fix(web): pagination search params on activity feed page
LetItRock Feb 23, 2024
9a3de53
fix: subscriber details not available for digest filters
MasonD Feb 24, 2024
a09636e
fix: show changes details for translations
ainouzgali Feb 25, 2024
e194818
fix: remove unrelated change
ainouzgali Feb 25, 2024
866d324
fix: disable api call for chat while typing
ainouzgali Feb 25, 2024
85b094b
fix: use org id
ainouzgali Feb 25, 2024
7c29156
Merge remote-tracking branch 'origin/next' into translation-managemen…
ainouzgali Feb 25, 2024
49bff2b
Merge remote-tracking branch 'origin/next' into translation-managemen…
ainouzgali Feb 25, 2024
8624d82
Merge remote-tracking branch 'origin/translation-management-beta' int…
ainouzgali Feb 25, 2024
ac0f957
Merge remote-tracking branch 'origin/translation-management-beta' int…
ainouzgali Feb 25, 2024
91ee23b
Merge pull request #5202 from novuhq/nv-3416-variants-preview
ainouzgali Feb 25, 2024
4995f6d
feat: add props to center modal
BiswaViraj Feb 23, 2024
3f5df42
chore(web): added suggestions from the pr #5231
LetItRock Feb 26, 2024
ce1d583
Merge pull request #5230 from novuhq/nv-3420-css-inconsistencies-with…
ainouzgali Feb 26, 2024
7f104d6
Merge pull request #5234 from MasonD/digest-filter-bug
ainouzgali Feb 26, 2024
aec095f
Merge branch 'next' into translation-management-beta
ainouzgali Feb 26, 2024
07196f9
chore(web): fixed failing eslint check
LetItRock Feb 26, 2024
9006c58
fix: update source
ainouzgali Feb 26, 2024
c0087f4
Merge pull request #5124 from novuhq/translation-management-beta
ainouzgali Feb 26, 2024
100795e
Merge pull request #5231 from novuhq/fix-pagination-search-params
LetItRock Feb 26, 2024
ab64500
chore(enterprise): symlinks for the billing
LetItRock Feb 26, 2024
df51622
fix: NV-3497 - Pagination Tweaks (#5242)
antonjoel82 Feb 27, 2024
a60cb9c
Merge remote-tracking branch 'origin/next' into nv-3519-translations-…
ainouzgali Feb 28, 2024
45e8cae
Merge pull request #5237 from novuhq/nv-3519-translations-changes-not…
ainouzgali Feb 29, 2024
dd5a250
feat: onboarding experiment
jainpawan21 Mar 1, 2024
22a748a
fix: experiment typo
jainpawan21 Mar 1, 2024
3ccedb5
fix: button typo
jainpawan21 Mar 1, 2024
1fb0f17
Merge branch 'next' into feature/onboarding-experiment
jainpawan21 Mar 1, 2024
af65ffd
fix: disable experiment for self hosted users
jainpawan21 Mar 1, 2024
b6abe1f
fix: add loading and disabled states
jainpawan21 Mar 1, 2024
b685fa8
fix: remove layout fix changes
jainpawan21 Mar 1, 2024
4d611cc
fix: select default layout while creating workflow with email step
jainpawan21 Mar 1, 2024
8a1e652
chore(web): small improvements on loading button logic
LetItRock Mar 1, 2024
5a915f1
chore(web): fixing failing e2e cypress tests pr #5250
LetItRock Mar 1, 2024
dae3b9f
chore(web): fixing failing component cypress tests pr #5250
LetItRock Mar 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Expand Up @@ -27,7 +27,7 @@ module.exports = {
'@typescript-eslint/lines-between-class-members': 'off',
'react/jsx-wrap-multilines': 'off',
'react/jsx-filename-extension': 'off',
'multiline-comment-style': ['error', 'starred-block'],
'multiline-comment-style': ['warn', 'starred-block'],
'promise/catch-or-return': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
Expand Down
2 changes: 1 addition & 1 deletion .source
Expand Up @@ -11,6 +11,8 @@ import {
import { ChangeEntityTypeEnum } from '@novu/shared';
import { ChangesResponseDto } from '../../dtos/change-response.dto';
import { GetChangesCommand } from './get-changes.command';
import { ApiException } from '../../../shared/exceptions/api.exception';
import { ModuleRef } from '@nestjs/core';

interface IViewEntity {
templateName: string;
Expand All @@ -32,7 +34,8 @@ export class GetChanges {
private messageTemplateRepository: MessageTemplateRepository,
private notificationGroupRepository: NotificationGroupRepository,
private feedRepository: FeedRepository,
private layoutRepository: LayoutRepository
private layoutRepository: LayoutRepository,
protected moduleRef: ModuleRef
) {}

async execute(command: GetChangesCommand): Promise<ChangesResponseDto> {
Expand Down Expand Up @@ -65,6 +68,12 @@ export class GetChanges {
if (change.type === ChangeEntityTypeEnum.DEFAULT_LAYOUT) {
item = await this.getTemplateDataForDefaultLayout(change._entityId, command.environmentId);
}
if (change.type === ChangeEntityTypeEnum.TRANSLATION) {
item = await this.getTemplateDataForTranslation(change._entityId, command.environmentId);
}
if (change.type === ChangeEntityTypeEnum.TRANSLATION_GROUP) {
item = await this.getTemplateDataForTranslationGroup(change._entityId, command.environmentId);
}

list.push({
...change,
Expand Down Expand Up @@ -133,6 +142,54 @@ export class GetChanges {
};
}

private async getTemplateDataForTranslationGroup(
entityId: string,
environmentId: string
): Promise<IViewEntity | Record<string, unknown>> {
try {
if (process.env.NOVU_ENTERPRISE === 'true' || process.env.CI_EE_TEST === 'true') {
if (!require('@novu/ee-translation')?.TranslationsService) {
throw new ApiException('Translation module is not loaded');
}
const service = this.moduleRef.get(require('@novu/ee-translation')?.TranslationsService, { strict: false });
const { name, identifier } = await service.getTranslationGroupData(environmentId, entityId);

return {
templateId: identifier,
templateName: name,
};
}
} catch (e) {
Logger.error(e, `Unexpected error while importing enterprise modules`, 'TranslationsService');
}

return {};
}

private async getTemplateDataForTranslation(
entityId: string,
environmentId: string
): Promise<IViewEntity | Record<string, unknown>> {
try {
if (process.env.NOVU_ENTERPRISE === 'true' || process.env.CI_EE_TEST === 'true') {
if (!require('@novu/ee-translation')?.TranslationsService) {
throw new ApiException('Translation module is not loaded');
}
const service = this.moduleRef.get(require('@novu/ee-translation')?.TranslationsService, { strict: false });
const { name, group } = await service.getTranslationData(environmentId, entityId);

return {
templateName: name,
translationGroup: group,
};
}
} catch (e) {
Logger.error(e, `Unexpected error while importing enterprise modules`, 'TranslationsService');
}

return {};
}

private async getTemplateDataForNotificationGroup(
entityId: string,
environmentId: string
Expand Down
32 changes: 26 additions & 6 deletions apps/api/src/app/content-templates/content-templates.controller.ts
Expand Up @@ -34,7 +34,8 @@ export class ContentTemplatesController {
@Body('contentType') contentType: MessageTemplateContentType,
@Body('payload') payload: any,
@Body('subject') subject: string,
@Body('layoutId') layoutId: string
@Body('layoutId') layoutId: string,
@Body('locale') locale?: string
) {
return this.compileEmailTemplateUsecase.execute(
CompileEmailTemplateCommand.create({
Expand All @@ -46,6 +47,7 @@ export class ContentTemplatesController {
payload,
subject,
layoutId,
locale,
}),
this.initiateTranslations.bind(this)
);
Expand All @@ -56,7 +58,8 @@ export class ContentTemplatesController {
@UserSession() user: IJwtPayload,
@Body('content') content: string,
@Body('payload') payload: any,
@Body('cta') cta: IMessageCTA
@Body('cta') cta: IMessageCTA,
@Body('locale') locale?: string
) {
return this.compileInAppTemplate.execute(
CompileInAppTemplateCommand.create({
Expand All @@ -66,20 +69,27 @@ export class ContentTemplatesController {
content,
payload,
cta,
locale,
}),
this.initiateTranslations.bind(this)
);
}
// TODO: refactor this to use params and single endpoint to manage all the channels
@Post('/preview/sms')
public previewSms(@UserSession() user: IJwtPayload, @Body('content') content: string, @Body('payload') payload: any) {
public previewSms(
@UserSession() user: IJwtPayload,
@Body('content') content: string,
@Body('payload') payload: any,
@Body('locale') locale?: string
) {
return this.compileStepTemplate.execute(
CompileStepTemplateCommand.create({
userId: user._id,
organizationId: user.organizationId,
environmentId: user.environmentId,
content,
payload,
locale,
}),
this.initiateTranslations.bind(this)
);
Expand All @@ -89,7 +99,8 @@ export class ContentTemplatesController {
public previewChat(
@UserSession() user: IJwtPayload,
@Body('content') content: string,
@Body('payload') payload: any
@Body('payload') payload: any,
@Body('locale') locale?: string
) {
return this.compileStepTemplate.execute(
CompileStepTemplateCommand.create({
Expand All @@ -98,6 +109,7 @@ export class ContentTemplatesController {
environmentId: user.environmentId,
content,
payload,
locale,
}),
this.initiateTranslations.bind(this)
);
Expand All @@ -107,7 +119,9 @@ export class ContentTemplatesController {
public previewPush(
@UserSession() user: IJwtPayload,
@Body('content') content: string,
@Body('payload') payload: any
@Body('title') title: string,
@Body('payload') payload: any,
@Body('locale') locale?: string
) {
return this.compileStepTemplate.execute(
CompileStepTemplateCommand.create({
Expand All @@ -116,6 +130,8 @@ export class ContentTemplatesController {
environmentId: user.environmentId,
content,
payload,
locale,
title,
}),
this.initiateTranslations.bind(this)
);
Expand All @@ -128,7 +144,10 @@ export class ContentTemplatesController {
throw new ApiException('Translation module is not loaded');
}
const service = this.moduleRef.get(require('@novu/ee-translation')?.TranslationsService, { strict: false });
const { namespaces, resources } = await service.getTranslationsList(environmentId, organizationId);
const { namespaces, resources, defaultLocale } = await service.getTranslationsList(
environmentId,
organizationId
);

await i18next.init({
resources,
Expand All @@ -137,6 +156,7 @@ export class ContentTemplatesController {
nsSeparator: '.',
lng: locale || 'en',
compatibilityJSON: 'v2',
fallbackLng: defaultLocale,
interpolation: {
formatSeparator: ',',
format: function (value, formatting, lng) {
Expand Down
@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common';
import { MessageTemplateEntity, MessageTemplateRepository } from '@novu/dal';
import { ChangeEntityTypeEnum, IMessageAction } from '@novu/shared';
import { MessageTemplateEntity, MessageTemplateRepository, LayoutEntity, LayoutRepository } from '@novu/dal';
import { ChangeEntityTypeEnum, IMessageAction, StepTypeEnum } from '@novu/shared';

import { CreateMessageTemplateCommand } from './create-message-template.command';
import { sanitizeMessageContent } from '../../shared/sanitizer.service';
Expand All @@ -13,6 +13,7 @@ import { ApiException, CreateChange, CreateChangeCommand } from '@novu/applicati
export class CreateMessageTemplate {
constructor(
private messageTemplateRepository: MessageTemplateRepository,
private layoutRepository: LayoutRepository,
private createChange: CreateChange,
private updateChange: UpdateChange
) {}
Expand All @@ -22,6 +23,14 @@ export class CreateMessageTemplate {
throw new ApiException('Please provide a valid CTA action');
}

let layoutId: string | undefined | null;
if (command.type === StepTypeEnum.EMAIL && !command.layoutId) {
const defaultLayout = await this.layoutRepository.findDefault(command.environmentId, command.organizationId);
layoutId = defaultLayout?._id;
} else {
layoutId = command.layoutId;
}

let item: MessageTemplateEntity = await this.messageTemplateRepository.create({
cta: command.cta,
name: command.name,
Expand All @@ -32,7 +41,7 @@ export class CreateMessageTemplate {
title: command.title,
type: command.type,
_feedId: command.feedId ? command.feedId : null,
_layoutId: command.layoutId || null,
_layoutId: layoutId,
_organizationId: command.organizationId,
_environmentId: command.environmentId,
_creatorId: command.userId,
Expand Down
@@ -0,0 +1,36 @@
import { UserSession } from '@novu/testing';
import { expect } from 'chai';

const createTranslationGroup = {
name: 'test',
identifier: 'test',
locales: ['hi_IN', 'en_US'],
};

const content = 'Hello {{i18n "test.key1"}}, {{i18n "test.key2"}}, {{i18n "test.key3"}}';

describe('Get locales from content - /translations/groups/:identifier/locales/:locale (PATCH)', async () => {
let session: UserSession;

before(async () => {
session = new UserSession();
await session.initialize();
await session.testAgent.put(`/v1/organizations/language`).send({
locale: createTranslationGroup.locales[0],
});

await session.testAgent.post('/v1/translations/groups').send(createTranslationGroup);
});

it('should get locales from the content', async () => {
const { body } = await session.testAgent.post('/v1/translations/groups/preview/locales').send({
content,
});

const locales = body.data;

expect(locales.length).to.equal(2);
expect(locales[0].langIso).to.equal(createTranslationGroup.locales[0]);
expect(locales[1].langIso).to.equal(createTranslationGroup.locales[1]);
});
});
19 changes: 19 additions & 0 deletions apps/web/cypress/fixtures/translation.json
@@ -0,0 +1,19 @@
{
"key": "value",
"keyDeep": {
"inner": "value"
},
"keyNesting": "reuse $t(keyDeep.inner)",
"keyInterpolate": "replace this {{value}}",
"keyInterpolateUnescaped": "replace this {{- value}}",
"keyContext_male": "the male variant",
"keyContext_female": "the female variant",
"keyPluralSimple": "the singular",
"keyPluralSimple_plural": "the plural",
"keyPluralMultipleEgArabic_0": "the plural form 0",
"keyPluralMultipleEgArabic_1": "the plural form 1",
"keyPluralMultipleEgArabic_2": "the plural form 2",
"keyPluralMultipleEgArabic_3": "the plural form 3",
"keyPluralMultipleEgArabic_11": "the plural form 4",
"keyPluralMultipleEgArabic_100": "the plural form 5"
}
19 changes: 10 additions & 9 deletions apps/web/cypress/support/commands.ts
Expand Up @@ -3,6 +3,7 @@

import { MemberRoleEnum, MemberStatusEnum } from '@novu/shared';
import 'cypress-wait-until';
import 'cypress-file-upload';

Cypress.Commands.add('getByTestId', (selector, ...args) => {
return cy.get(`[data-test-id=${selector}]`, ...args);
Expand All @@ -13,22 +14,22 @@ Cypress.Commands.add('getBySelectorLike', (selector, ...args) => {
});

Cypress.Commands.add('waitLoadEnv', (beforeWait: () => void): void => {
cy.intercept('GET', 'http://127.0.0.1:1336/v1/environments').as('environments');
cy.intercept('GET', 'http://127.0.0.1:1336/v1/environments/me').as('environments-me');
cy.intercept('GET', '**/v1/environments').as('environments');
cy.intercept('GET', '**/v1/environments/me').as('environments-me');

beforeWait && beforeWait();

cy.wait(['@environments', '@environments-me']);
});

Cypress.Commands.add('waitLoadTemplatePage', (beforeWait: () => void): void => {
cy.intercept('GET', 'http://127.0.0.1:1336/v1/environments').as('environments');
cy.intercept('GET', 'http://127.0.0.1:1336/v1/organizations').as('organizations');
cy.intercept('GET', 'http://127.0.0.1:1336/v1/environments/me').as('environments-me');
cy.intercept('GET', 'http://127.0.0.1:1336/v1/notification-groups').as('notification-groups');
cy.intercept('GET', 'http://127.0.0.1:1336/v1/changes/count').as('changes-count');
cy.intercept('GET', 'http://127.0.0.1:1336/v1/integrations/active').as('active-integrations');
cy.intercept('GET', 'http://127.0.0.1:1336/v1/users/me').as('me');
cy.intercept('GET', '**/v1/environments').as('environments');
cy.intercept('GET', '**/v1/organizations').as('organizations');
cy.intercept('GET', '**/v1/environments/me').as('environments-me');
cy.intercept('GET', '**/v1/notification-groups').as('notification-groups');
cy.intercept('GET', '**/v1/changes/count').as('changes-count');
cy.intercept('GET', '**/v1/integrations/active').as('active-integrations');
cy.intercept('GET', '**/v1/users/me').as('me');

beforeWait && beforeWait();

Expand Down
6 changes: 3 additions & 3 deletions apps/web/cypress/tests/changes.spec.ts
@@ -1,4 +1,4 @@
import { dragAndDrop } from './notification-editor';
import { dragAndDrop, editChannel } from './notification-editor';
import { goBack } from './notification-editor';

describe('Changes Screen', function () {
Expand Down Expand Up @@ -122,7 +122,7 @@ function createNotification() {
cy.visit('/workflows/create');
cy.waitForNetworkIdle(500);

cy.getByTestId('title').clear().type('Test Notification Title');
cy.getByTestId('name-input').clear().type('Test Notification Title');

cy.getByTestId('settings-page').click();
cy.waitForNetworkIdle(500);
Expand All @@ -135,7 +135,7 @@ function createNotification() {
dragAndDrop('email');
cy.waitForNetworkIdle(500);

cy.clickWorkflowNode(`node-emailSelector`);
editChannel('email');
cy.waitForNetworkIdle(500);

cy.getByTestId('emailSubject').type('this is email subject');
Expand Down
2 changes: 1 addition & 1 deletion apps/web/cypress/tests/digest-playground.spec.ts
Expand Up @@ -16,7 +16,7 @@ describe('Digest Playground Workflow Page', function () {
cy.url().should('include', '/digest-playground');
cy.contains('Digest Workflow Playground');

cy.get('a[href="https://docs.novu.co/workflows/digest"]').contains('Learn more in docs');
cy.get('a[href="https://docs.novu.co/workflows/digest?utm_campaign=in-app"]').contains('Learn more in docs');
});

it('the set up digest workflow should redirect to template edit page', function () {
Expand Down