@vrplatform/email 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import type { EmailBaseProps } from '../types';
2
+ type NotificationKey = keyof Liveblocks['ActivitiesData'];
3
+ export type DailyDigestEmailTemplateProps = {
4
+ mode: EmailBaseProps['mode'];
5
+ unreadNotifications: Record<NotificationKey, {
6
+ id: string;
7
+ name: string;
8
+ }[]>;
9
+ };
10
+ export declare const DailyDigestEmailTemplate: ({ mode, unreadNotifications, }: DailyDigestEmailTemplateProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,97 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Heading } from '@react-email/heading';
3
+ import { Link } from '@react-email/link';
4
+ import { Text } from '@react-email/text';
5
+ import { EmailContainer } from '../components';
6
+ import { Button } from '../components/Button';
7
+ const THEME_VRP = [
8
+ // baseColor: #012F64
9
+ '#E6F1FF',
10
+ '#B8D9FE',
11
+ '#8BC0FE',
12
+ '#5DA8FD',
13
+ '#308FFD',
14
+ '#0377FC',
15
+ '#025FCA',
16
+ '#024797',
17
+ '#012F65',
18
+ '#011832',
19
+ ];
20
+ const THEME_NEUTRAL = [
21
+ '#fafafa',
22
+ '#f5f5f5',
23
+ '#e5e5e5',
24
+ '#d4d4d4',
25
+ '#a3a3a3',
26
+ '#737373',
27
+ '#525252',
28
+ '#404040',
29
+ '#262626',
30
+ '#171717',
31
+ // "#0a0a0a"
32
+ ];
33
+ const NOTIFICATION_ORDER = {
34
+ $inviteOwnerAccepted: {
35
+ title: 'Owners invitations',
36
+ text: 'accepted invite',
37
+ order: 1,
38
+ },
39
+ $inviteTeamMemberAccepted: {
40
+ title: 'Team member invitations',
41
+ text: 'accepted invite',
42
+ order: 2,
43
+ },
44
+ $ownerStatementInReview: {
45
+ title: 'Owner statements ready for review',
46
+ text: 'is ready for review',
47
+ order: 3,
48
+ },
49
+ $ownerStatementPublished: {
50
+ title: 'Owner statements were published',
51
+ text: 'was published to owner portal',
52
+ order: 4,
53
+ },
54
+ $1099StatementPublished: {
55
+ title: '1099 tax statements were published',
56
+ text: 'was finalized and published',
57
+ order: 5,
58
+ },
59
+ };
60
+ export const DailyDigestEmailTemplate = ({ mode, unreadNotifications, }) => {
61
+ const total = Object.values(unreadNotifications).reduce((acc, curr) => acc + curr.length, 0);
62
+ const emailTitle = `You have ${total} unread notification${total > 1 ? 's' : ''}`;
63
+ const link = 'https://portal.vrplatform.app/dashboard/inbox';
64
+ return (_jsxs(EmailContainer, { title: emailTitle, shortDescription: "Login to VRPlatform now to check your team's activity!", tenant: {
65
+ logo: undefined,
66
+ }, mode: mode, children: [_jsx(Heading, { style: {
67
+ fontSize: 26,
68
+ fontWeight: 600,
69
+ marginBottom: '50px',
70
+ }, children: emailTitle }), Object.entries(unreadNotifications)
71
+ .sort(([aKey], [bKey]) => {
72
+ const a = NOTIFICATION_ORDER[aKey]?.order ?? 0;
73
+ const b = NOTIFICATION_ORDER[bKey]?.order ?? 0;
74
+ return a - b;
75
+ })
76
+ .map(([key, notifications]) => {
77
+ const data = NOTIFICATION_ORDER[key];
78
+ if (notifications.length === 0 || !data)
79
+ return null;
80
+ return (_jsxs("div", { style: {
81
+ marginBottom: '42px',
82
+ }, children: [_jsx(Text, { style: {
83
+ color: THEME_NEUTRAL[5],
84
+ }, children: data.title }), notifications.map((not) => (_jsxs(Text, { style: { color: THEME_NEUTRAL[5] }, children: [_jsx("span", { style: {
85
+ fontWeight: 800,
86
+ color: '#000',
87
+ }, children: not.name }), ' ', data.text] }, not.id)))] }, key));
88
+ }), _jsx(Button, { href: link, mode: mode, "data-testid": "accept-invite-button", label: 'Go to VRPlatform', themeColors: THEME_VRP, style: {
89
+ marginTop: '50px',
90
+ marginBottom: '50px',
91
+ } }), _jsx(Text, { children: "Best, VRPlatform" }), _jsxs(Text, { children: ["If you have any trouble with the button, you can copy and paste the link below into your browser:", ' ', _jsx(Link, { href: link, style: {
92
+ display: 'inline',
93
+ wordBreak: 'break-all',
94
+ color: THEME_VRP[7],
95
+ }, children: link })] })] }));
96
+ };
97
+ //# sourceMappingURL=DailyDigestEmailTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DailyDigestEmailTemplate.js","sourceRoot":"src/","sources":["templates/DailyDigestEmailTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,MAAM,SAAS,GAAG;IAChB,qBAAqB;IACrB,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACD,CAAC;AAEX,MAAM,aAAa,GAAG;IACpB,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,YAAY;CACb,CAAC;AAEF,MAAM,kBAAkB,GAOpB;IACF,oBAAoB,EAAE;QACpB,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,CAAC;KACT;IACD,yBAAyB,EAAE;QACzB,KAAK,EAAE,yBAAyB;QAChC,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,CAAC;KACT;IACD,uBAAuB,EAAE;QACvB,KAAK,EAAE,mCAAmC;QAC1C,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,CAAC;KACT;IACD,wBAAwB,EAAE;QACxB,KAAK,EAAE,iCAAiC;QACxC,IAAI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AC"}
@@ -5,3 +5,4 @@ export * from './OwnerStatementEmailTemplate';
5
5
  export * from './OwnerTaxStatementEmailTemplate';
6
6
  export * from './InviteOwnerEmailTemplate';
7
7
  export * from './InvitePmEmailTemplate';
8
+ export * from './DailyDigestEmailTemplate';
@@ -9,4 +9,6 @@ export * from './OwnerTaxStatementEmailTemplate';
9
9
  // Invitations
10
10
  export * from './InviteOwnerEmailTemplate';
11
11
  export * from './InvitePmEmailTemplate';
12
+ // Daily Digest
13
+ export * from './DailyDigestEmailTemplate';
12
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["templates/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,mBAAmB;AACnB,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAE9C,uBAAuB;AACvB,cAAc,kCAAkC,CAAC;AAEjD,cAAc;AACd,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["templates/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,mBAAmB;AACnB,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAE9C,uBAAuB;AACvB,cAAc,kCAAkC,CAAC;AAEjD,cAAc;AACd,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AAExC,eAAe;AACf,cAAc,4BAA4B,CAAC"}
@@ -1 +1 @@
1
- {"root":["../../src/const.ts","../../src/extensions.ts","../../src/index.ts","../../src/theme.ts","../../src/types.ts","../../src/components/actionemailtemplate.tsx","../../src/components/button.tsx","../../src/components/emailcontainer.tsx","../../src/components/index.ts","../../src/components/utils/index.ts","../../src/components/utils/parse-email-html.test.ts","../../src/components/utils/parse-email-html.ts","../../src/templates/inviteowneremailtemplate.tsx","../../src/templates/invitepmemailtemplate.tsx","../../src/templates/ownerstatementemailtemplate.tsx","../../src/templates/ownerstatementsummaryemailtemplate.tsx","../../src/templates/ownertaxstatementemailtemplate.tsx","../../src/templates/tenantdeletionemailtemplate.tsx","../../src/templates/tenantsuspensionemailtemplate.tsx","../../src/templates/index.ts","../../src/utils/index.ts","../../src/utils/send-email.ts"],"version":"5.8.3"}
1
+ {"root":["../../src/const.ts","../../src/extensions.ts","../../src/index.ts","../../src/liveblocks.d.ts","../../src/theme.ts","../../src/types.ts","../../src/components/actionemailtemplate.tsx","../../src/components/button.tsx","../../src/components/emailcontainer.tsx","../../src/components/index.ts","../../src/components/utils/index.ts","../../src/components/utils/parse-email-html.test.ts","../../src/components/utils/parse-email-html.ts","../../src/templates/dailydigestemailtemplate.tsx","../../src/templates/inviteowneremailtemplate.tsx","../../src/templates/invitepmemailtemplate.tsx","../../src/templates/ownerstatementemailtemplate.tsx","../../src/templates/ownerstatementsummaryemailtemplate.tsx","../../src/templates/ownertaxstatementemailtemplate.tsx","../../src/templates/tenantdeletionemailtemplate.tsx","../../src/templates/tenantsuspensionemailtemplate.tsx","../../src/templates/index.ts","../../src/utils/index.ts","../../src/utils/send-email.ts"],"version":"5.8.3"}
@@ -0,0 +1,11 @@
1
+ import type { EmailBaseProps } from '../types';
2
+ type NotificationKey = keyof Liveblocks['ActivitiesData'];
3
+ export type DailyDigestEmailTemplateProps = {
4
+ mode: EmailBaseProps['mode'];
5
+ unreadNotifications: Record<NotificationKey, {
6
+ id: string;
7
+ name: string;
8
+ }[]>;
9
+ };
10
+ export declare const DailyDigestEmailTemplate: ({ mode, unreadNotifications, }: DailyDigestEmailTemplateProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,97 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Heading } from '@react-email/heading';
3
+ import { Link } from '@react-email/link';
4
+ import { Text } from '@react-email/text';
5
+ import { EmailContainer } from '../components';
6
+ import { Button } from '../components/Button';
7
+ const THEME_VRP = [
8
+ // baseColor: #012F64
9
+ '#E6F1FF',
10
+ '#B8D9FE',
11
+ '#8BC0FE',
12
+ '#5DA8FD',
13
+ '#308FFD',
14
+ '#0377FC',
15
+ '#025FCA',
16
+ '#024797',
17
+ '#012F65',
18
+ '#011832',
19
+ ];
20
+ const THEME_NEUTRAL = [
21
+ '#fafafa',
22
+ '#f5f5f5',
23
+ '#e5e5e5',
24
+ '#d4d4d4',
25
+ '#a3a3a3',
26
+ '#737373',
27
+ '#525252',
28
+ '#404040',
29
+ '#262626',
30
+ '#171717',
31
+ // "#0a0a0a"
32
+ ];
33
+ const NOTIFICATION_ORDER = {
34
+ $inviteOwnerAccepted: {
35
+ title: 'Owners invitations',
36
+ text: 'accepted invite',
37
+ order: 1,
38
+ },
39
+ $inviteTeamMemberAccepted: {
40
+ title: 'Team member invitations',
41
+ text: 'accepted invite',
42
+ order: 2,
43
+ },
44
+ $ownerStatementInReview: {
45
+ title: 'Owner statements ready for review',
46
+ text: 'is ready for review',
47
+ order: 3,
48
+ },
49
+ $ownerStatementPublished: {
50
+ title: 'Owner statements were published',
51
+ text: 'was published to owner portal',
52
+ order: 4,
53
+ },
54
+ $1099StatementPublished: {
55
+ title: '1099 tax statements were published',
56
+ text: 'was finalized and published',
57
+ order: 5,
58
+ },
59
+ };
60
+ export const DailyDigestEmailTemplate = ({ mode, unreadNotifications, }) => {
61
+ const total = Object.values(unreadNotifications).reduce((acc, curr) => acc + curr.length, 0);
62
+ const emailTitle = `You have ${total} unread notification${total > 1 ? 's' : ''}`;
63
+ const link = 'https://portal.vrplatform.app/dashboard/inbox';
64
+ return (_jsxs(EmailContainer, { title: emailTitle, shortDescription: "Login to VRPlatform now to check your team's activity!", tenant: {
65
+ logo: undefined,
66
+ }, mode: mode, children: [_jsx(Heading, { style: {
67
+ fontSize: 26,
68
+ fontWeight: 600,
69
+ marginBottom: '50px',
70
+ }, children: emailTitle }), Object.entries(unreadNotifications)
71
+ .sort(([aKey], [bKey]) => {
72
+ const a = NOTIFICATION_ORDER[aKey]?.order ?? 0;
73
+ const b = NOTIFICATION_ORDER[bKey]?.order ?? 0;
74
+ return a - b;
75
+ })
76
+ .map(([key, notifications]) => {
77
+ const data = NOTIFICATION_ORDER[key];
78
+ if (notifications.length === 0 || !data)
79
+ return null;
80
+ return (_jsxs("div", { style: {
81
+ marginBottom: '42px',
82
+ }, children: [_jsx(Text, { style: {
83
+ color: THEME_NEUTRAL[5],
84
+ }, children: data.title }), notifications.map((not) => (_jsxs(Text, { style: { color: THEME_NEUTRAL[5] }, children: [_jsx("span", { style: {
85
+ fontWeight: 800,
86
+ color: '#000',
87
+ }, children: not.name }), ' ', data.text] }, not.id)))] }, key));
88
+ }), _jsx(Button, { href: link, mode: mode, "data-testid": "accept-invite-button", label: 'Go to VRPlatform', themeColors: THEME_VRP, style: {
89
+ marginTop: '50px',
90
+ marginBottom: '50px',
91
+ } }), _jsx(Text, { children: "Best, VRPlatform" }), _jsxs(Text, { children: ["If you have any trouble with the button, you can copy and paste the link below into your browser:", ' ', _jsx(Link, { href: link, style: {
92
+ display: 'inline',
93
+ wordBreak: 'break-all',
94
+ color: THEME_VRP[7],
95
+ }, children: link })] })] }));
96
+ };
97
+ //# sourceMappingURL=DailyDigestEmailTemplate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DailyDigestEmailTemplate.js","sourceRoot":"src/","sources":["templates/DailyDigestEmailTemplate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C,MAAM,SAAS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,UAAU,EAAE,GAAG;wCACf,KAAK,EAAE,MAAM;qCACd,YAEA,GAAG,CAAC,IAAI,GACJ,EAAC,GAAG,EACV,IAAI,CAAC,IAAI,KATD,GAAG,CAAC,EAAE,CAUV,CACR,CAAC,KAxBG,GAAG,CAyBJ,CACP,CAAC;YACJ,CAAC,CAAC,EAEJ,KAAC,MAAM,IACL,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,iBACE,sBAAsB,EAClC,KAAK,EAAE,kBAAkB,EACzB,WAAW,EAAE,SAAS,EACtB,KAAK,EAAE;oBACL,SAAS,EAAE,MAAM;oBACjB,YAAY,EAAE,MAAM;iBACrB,GACD,EAEF,KAAC,IAAI,mCAAwB,EAE7B,MAAC,IAAI,oHAEsB,GAAG,EAC5B,KAAC,IAAI,IACH,IAAI,EAAE,IAAI,EACV,KAAK,EAAE;4BACL,OAAO,EAAE,QAAQ;4BACjB,SAAS,EAAE,WAAW;4BACtB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;yBACpB,YAEA,IAAI,GACA,IACF,IACQ,CAClB,CAAC;AACJ,CAAC,CAAC"}
@@ -5,3 +5,4 @@ export * from './OwnerStatementEmailTemplate';
5
5
  export * from './OwnerTaxStatementEmailTemplate';
6
6
  export * from './InviteOwnerEmailTemplate';
7
7
  export * from './InvitePmEmailTemplate';
8
+ export * from './DailyDigestEmailTemplate';
@@ -9,4 +9,6 @@ export * from './OwnerTaxStatementEmailTemplate';
9
9
  // Invitations
10
10
  export * from './InviteOwnerEmailTemplate';
11
11
  export * from './InvitePmEmailTemplate';
12
+ // Daily Digest
13
+ export * from './DailyDigestEmailTemplate';
12
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["templates/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,mBAAmB;AACnB,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAE9C,uBAAuB;AACvB,cAAc,kCAAkC,CAAC;AAEjD,cAAc;AACd,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"src/","sources":["templates/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC;AAE9C,mBAAmB;AACnB,cAAc,sCAAsC,CAAC;AACrD,cAAc,+BAA+B,CAAC;AAE9C,uBAAuB;AACvB,cAAc,kCAAkC,CAAC;AAEjD,cAAc;AACd,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AAExC,eAAe;AACf,cAAc,4BAA4B,CAAC"}
@@ -1 +1 @@
1
- {"root":["../../src/const.ts","../../src/extensions.ts","../../src/index.ts","../../src/theme.ts","../../src/types.ts","../../src/components/actionemailtemplate.tsx","../../src/components/button.tsx","../../src/components/emailcontainer.tsx","../../src/components/index.ts","../../src/components/utils/index.ts","../../src/components/utils/parse-email-html.test.ts","../../src/components/utils/parse-email-html.ts","../../src/templates/inviteowneremailtemplate.tsx","../../src/templates/invitepmemailtemplate.tsx","../../src/templates/ownerstatementemailtemplate.tsx","../../src/templates/ownerstatementsummaryemailtemplate.tsx","../../src/templates/ownertaxstatementemailtemplate.tsx","../../src/templates/tenantdeletionemailtemplate.tsx","../../src/templates/tenantsuspensionemailtemplate.tsx","../../src/templates/index.ts","../../src/utils/index.ts","../../src/utils/send-email.ts"],"version":"5.8.3"}
1
+ {"root":["../../src/const.ts","../../src/extensions.ts","../../src/index.ts","../../src/liveblocks.d.ts","../../src/theme.ts","../../src/types.ts","../../src/components/actionemailtemplate.tsx","../../src/components/button.tsx","../../src/components/emailcontainer.tsx","../../src/components/index.ts","../../src/components/utils/index.ts","../../src/components/utils/parse-email-html.test.ts","../../src/components/utils/parse-email-html.ts","../../src/templates/dailydigestemailtemplate.tsx","../../src/templates/inviteowneremailtemplate.tsx","../../src/templates/invitepmemailtemplate.tsx","../../src/templates/ownerstatementemailtemplate.tsx","../../src/templates/ownerstatementsummaryemailtemplate.tsx","../../src/templates/ownertaxstatementemailtemplate.tsx","../../src/templates/tenantdeletionemailtemplate.tsx","../../src/templates/tenantsuspensionemailtemplate.tsx","../../src/templates/index.ts","../../src/utils/index.ts","../../src/utils/send-email.ts"],"version":"5.8.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrplatform/email",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "keywords": [],
5
5
  "license": "ISC",
6
6
  "main": "build/main/index.js",
@@ -38,7 +38,7 @@
38
38
  "typescript": "*"
39
39
  },
40
40
  "scripts": {
41
- "pub": "bun run build && pnpm publish --no-git-checks",
41
+ "pub": "bun run build && pnpm version patch --no-commit-hooks --no-git-tag-version --no-workspaces-update && pnpm publish --no-git-checks",
42
42
  "build": "bun build:main & bun build:module",
43
43
  "build:main": "tsc -b tsconfig.main.json",
44
44
  "build:module": "tsc -b tsconfig.esm.json",
@@ -0,0 +1,88 @@
1
+ // Define Liveblocks types for your application
2
+ // https://liveblocks.io/docs/api-reference/liveblocks-react#Typing-your-data
3
+ declare global {
4
+ interface Liveblocks {
5
+ ActivitiesData: {
6
+ $ownerStatementInReview: {
7
+ ownerStatementId: string;
8
+ listingId: string;
9
+ startAt: string;
10
+ tenantId: string;
11
+ triggeredByUserId: string;
12
+ };
13
+ $ownerStatementPublished: {
14
+ ownerStatementId: string;
15
+ tenantId: string;
16
+ listingId: string;
17
+ startAt: string;
18
+ status: 'posted' | 'published';
19
+ triggeredByUserId?: string;
20
+ };
21
+ $inviteOwnerAccepted: {
22
+ userId: string;
23
+ tenantId: string;
24
+ };
25
+ $inviteTeamMemberAccepted: {
26
+ userId: string;
27
+ tenantId: string;
28
+ };
29
+ $1099StatementPublished: {
30
+ taxStatementId: string;
31
+ tenantId: string;
32
+ year: number;
33
+ status: 'ready' | 'submitted';
34
+ triggeredByUserId?: string;
35
+ };
36
+ };
37
+
38
+ // Each user's Presence, for useMyPresence, useOthers, etc.
39
+ // biome-ignore lint/complexity/noBannedTypes: <explanation>
40
+ Presence: {
41
+ // Example, real-time cursor coordinates
42
+ // cursor: { x: number; y: number };
43
+ };
44
+
45
+ // The Storage tree for the room, for useMutation, useStorage, etc.
46
+ // biome-ignore lint/complexity/noBannedTypes: <explanation>
47
+ Storage: {
48
+ // Example, a conflict-free list
49
+ // animals: LiveList<string>;
50
+ };
51
+
52
+ // Custom user info set when authenticating with a secret key
53
+ UserMeta: {
54
+ id: string;
55
+ // biome-ignore lint/complexity/noBannedTypes: <explanation>
56
+ info: {
57
+ // Example properties, for useSelf, useUser, useOthers, etc.
58
+ // name: string;
59
+ // avatar: string;
60
+ };
61
+ };
62
+
63
+ // Custom events, for useBroadcastEvent, useEventListener
64
+ // biome-ignore lint/complexity/noBannedTypes: <explanation>
65
+ RoomEvent: {};
66
+ // Example has two events, using a union
67
+ // | { type: "PLAY" }
68
+ // | { type: "REACTION"; emoji: "🔥" };
69
+
70
+ // Custom metadata set on threads, for useThreads, useCreateThread, etc.
71
+ // biome-ignore lint/complexity/noBannedTypes: <explanation>
72
+ ThreadMetadata: {
73
+ // Example, attaching coordinates to a thread
74
+ // x: number;
75
+ // y: number;
76
+ };
77
+
78
+ // Custom room info set with resolveRoomsInfo, for useRoomInfo
79
+ // biome-ignore lint/complexity/noBannedTypes: <explanation>
80
+ RoomInfo: {
81
+ // Example, rooms with a title and url
82
+ // title: string;
83
+ // url: string;
84
+ };
85
+ }
86
+ }
87
+
88
+ export type {};
@@ -0,0 +1,186 @@
1
+ import { Heading } from '@react-email/heading';
2
+ import { Link } from '@react-email/link';
3
+ import { Text } from '@react-email/text';
4
+ import { EmailContainer } from '../components';
5
+ import { Button } from '../components/Button';
6
+ import type { EmailBaseProps } from '../types';
7
+
8
+ type NotificationKey = keyof Liveblocks['ActivitiesData'];
9
+
10
+ export type DailyDigestEmailTemplateProps = {
11
+ mode: EmailBaseProps['mode'];
12
+ unreadNotifications: Record<NotificationKey, { id: string; name: string }[]>;
13
+ };
14
+
15
+ const THEME_VRP = [
16
+ // baseColor: #012F64
17
+ '#E6F1FF',
18
+ '#B8D9FE',
19
+ '#8BC0FE',
20
+ '#5DA8FD',
21
+ '#308FFD',
22
+ '#0377FC',
23
+ '#025FCA',
24
+ '#024797',
25
+ '#012F65',
26
+ '#011832',
27
+ ] as const;
28
+
29
+ const THEME_NEUTRAL = [
30
+ '#fafafa',
31
+ '#f5f5f5',
32
+ '#e5e5e5',
33
+ '#d4d4d4',
34
+ '#a3a3a3',
35
+ '#737373',
36
+ '#525252',
37
+ '#404040',
38
+ '#262626',
39
+ '#171717',
40
+ // "#0a0a0a"
41
+ ];
42
+
43
+ const NOTIFICATION_ORDER: Record<
44
+ NotificationKey,
45
+ {
46
+ title: string;
47
+ text: string;
48
+ order: number;
49
+ }
50
+ > = {
51
+ $inviteOwnerAccepted: {
52
+ title: 'Owners invitations',
53
+ text: 'accepted invite',
54
+ order: 1,
55
+ },
56
+ $inviteTeamMemberAccepted: {
57
+ title: 'Team member invitations',
58
+ text: 'accepted invite',
59
+ order: 2,
60
+ },
61
+ $ownerStatementInReview: {
62
+ title: 'Owner statements ready for review',
63
+ text: 'is ready for review',
64
+ order: 3,
65
+ },
66
+ $ownerStatementPublished: {
67
+ title: 'Owner statements were published',
68
+ text: 'was published to owner portal',
69
+ order: 4,
70
+ },
71
+ $1099StatementPublished: {
72
+ title: '1099 tax statements were published',
73
+ text: 'was finalized and published',
74
+ order: 5,
75
+ },
76
+ };
77
+
78
+ export const DailyDigestEmailTemplate = ({
79
+ mode,
80
+
81
+ unreadNotifications,
82
+ }: DailyDigestEmailTemplateProps) => {
83
+ const total = Object.values(unreadNotifications).reduce(
84
+ (acc, curr) => acc + curr.length,
85
+ 0
86
+ );
87
+
88
+ const emailTitle = `You have ${total} unread notification${total > 1 ? 's' : ''}`;
89
+
90
+ const link = 'https://portal.vrplatform.app/dashboard/inbox';
91
+
92
+ return (
93
+ <EmailContainer
94
+ title={emailTitle}
95
+ shortDescription={
96
+ "Login to VRPlatform now to check your team's activity!"
97
+ }
98
+ tenant={{
99
+ logo: undefined,
100
+ }}
101
+ mode={mode}
102
+ >
103
+ <Heading
104
+ style={{
105
+ fontSize: 26,
106
+ fontWeight: 600,
107
+ marginBottom: '50px',
108
+ }}
109
+ >
110
+ {emailTitle}
111
+ </Heading>
112
+
113
+ {Object.entries(unreadNotifications)
114
+ .sort(([aKey], [bKey]) => {
115
+ const a = NOTIFICATION_ORDER[aKey as NotificationKey]?.order ?? 0;
116
+ const b = NOTIFICATION_ORDER[bKey as NotificationKey]?.order ?? 0;
117
+
118
+ return a - b;
119
+ })
120
+ .map(([key, notifications]) => {
121
+ const data = NOTIFICATION_ORDER[key as NotificationKey];
122
+
123
+ if (notifications.length === 0 || !data) return null;
124
+
125
+ return (
126
+ <div
127
+ key={key}
128
+ style={{
129
+ marginBottom: '42px',
130
+ }}
131
+ >
132
+ <Text
133
+ style={{
134
+ color: THEME_NEUTRAL[5],
135
+ }}
136
+ >
137
+ {data.title}
138
+ </Text>
139
+ {notifications.map((not) => (
140
+ <Text key={not.id} style={{ color: THEME_NEUTRAL[5] }}>
141
+ <span
142
+ style={{
143
+ fontWeight: 800,
144
+ color: '#000',
145
+ }}
146
+ >
147
+ {not.name}
148
+ </span>{' '}
149
+ {data.text}
150
+ </Text>
151
+ ))}
152
+ </div>
153
+ );
154
+ })}
155
+
156
+ <Button
157
+ href={link}
158
+ mode={mode}
159
+ data-testid="accept-invite-button"
160
+ label={'Go to VRPlatform'}
161
+ themeColors={THEME_VRP}
162
+ style={{
163
+ marginTop: '50px',
164
+ marginBottom: '50px',
165
+ }}
166
+ />
167
+
168
+ <Text>Best, VRPlatform</Text>
169
+
170
+ <Text>
171
+ If you have any trouble with the button, you can copy and paste the link
172
+ below into your browser:{' '}
173
+ <Link
174
+ href={link}
175
+ style={{
176
+ display: 'inline',
177
+ wordBreak: 'break-all',
178
+ color: THEME_VRP[7],
179
+ }}
180
+ >
181
+ {link}
182
+ </Link>
183
+ </Text>
184
+ </EmailContainer>
185
+ );
186
+ };
@@ -12,3 +12,6 @@ export * from './OwnerTaxStatementEmailTemplate';
12
12
  // Invitations
13
13
  export * from './InviteOwnerEmailTemplate';
14
14
  export * from './InvitePmEmailTemplate';
15
+
16
+ // Daily Digest
17
+ export * from './DailyDigestEmailTemplate';