-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(root): Release 2025-02-06 11:01 (#7673)
- Loading branch information
Showing
75 changed files
with
1,380 additions
and
421 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
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
39 changes: 39 additions & 0 deletions
39
apps/api/src/app/environments-v1/usecases/output-renderers/maily-to-liquid/maily-utils.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,39 @@ | ||
import { JSONContent as MailyJSONContent } from '@maily-to/render'; | ||
|
||
import { MailyAttrsEnum, MailyContentTypeEnum } from './maily.types'; | ||
|
||
export const isRepeatNode = ( | ||
node: MailyJSONContent | ||
): node is MailyJSONContent & { attrs: { [MailyAttrsEnum.EACH_KEY]: string } } => { | ||
return !!( | ||
(node.type === MailyContentTypeEnum.REPEAT || node.type === MailyContentTypeEnum.FOR) && | ||
node.attrs && | ||
node.attrs[MailyAttrsEnum.EACH_KEY] !== undefined && | ||
typeof node.attrs[MailyAttrsEnum.EACH_KEY] === 'string' | ||
); | ||
}; | ||
|
||
export const isVariableNode = ( | ||
node: MailyJSONContent | ||
): node is MailyJSONContent & { attrs: { [MailyAttrsEnum.ID]: string } } => { | ||
return !!( | ||
node.type === MailyContentTypeEnum.VARIABLE && | ||
node.attrs && | ||
node.attrs[MailyAttrsEnum.ID] !== undefined && | ||
typeof node.attrs[MailyAttrsEnum.ID] === 'string' | ||
); | ||
}; | ||
|
||
export const hasShow = ( | ||
node: MailyJSONContent | ||
): node is MailyJSONContent & { attrs: { [MailyAttrsEnum.SHOW_IF_KEY]: string } } => { | ||
return node.attrs?.[MailyAttrsEnum.SHOW_IF_KEY] !== undefined && node.attrs?.[MailyAttrsEnum.SHOW_IF_KEY] !== null; | ||
}; | ||
|
||
export const hasAttrs = (node: MailyJSONContent): node is MailyJSONContent & { attrs: Record<string, any> } => { | ||
return !!node.attrs; | ||
}; | ||
|
||
export const hasMarks = (node: MailyJSONContent): node is MailyJSONContent & { marks: Record<string, any>[] } => { | ||
return !!node.marks; | ||
}; |
5 changes: 5 additions & 0 deletions
5
apps/api/src/app/environments-v1/usecases/output-renderers/maily-to-liquid/maily.types.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
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
Oops, something went wrong.