@vrplatform/email 1.0.1 → 1.0.2

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.
@@ -1,5 +1,5 @@
1
1
  import type { EmailBaseProps } from '../types';
2
- type NotificationKey = keyof Liveblocks['ActivitiesData'];
2
+ type NotificationKey = '$ownerStatementInReview' | '$ownerStatementPublished' | '$inviteOwnerAccepted' | '$inviteTeamMemberAccepted' | '$1099StatementPublished';
3
3
  export type DailyDigestEmailTemplateProps = {
4
4
  mode: EmailBaseProps['mode'];
5
5
  unreadNotifications: Record<NotificationKey, {
@@ -1 +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;Q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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"}
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;AAgB9C,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,E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GACA,IACF,IACQ,CAClB,CAAC;AACJ,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Maybe } from '@finalytic/utils';
1
+ import type { Maybe } from '@vrplatform/utils';
2
2
  export declare const getOwnerPortalColor: (color: Maybe<string>) => string | undefined;
3
3
  export declare const OWNER_PORTAL_COLORS: {
4
4
  orange: string;
@@ -1 +1 @@
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"}
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.9.3"}
@@ -1,5 +1,18 @@
1
- export declare const sendEmail: ({ POSTMARK_TOKEN, data, }: {
1
+ import type { logger as log } from '@trigger.dev/sdk';
2
+ type SentryErrorOptions = {
3
+ skipSentry?: boolean;
4
+ sentryMessage?: string;
5
+ statusCode?: number;
6
+ };
7
+ export declare class SentryError extends Error {
8
+ readonly skipSentry: boolean;
9
+ readonly sentryMessage?: string;
10
+ readonly statusCode?: number;
11
+ constructor(message: string, options?: SentryErrorOptions);
12
+ }
13
+ export declare const sendEmail: ({ POSTMARK_TOKEN, data, logger, }: {
2
14
  POSTMARK_TOKEN: string;
15
+ logger: typeof log;
3
16
  data: {
4
17
  to: string;
5
18
  subject: string;
@@ -7,4 +20,5 @@ export declare const sendEmail: ({ POSTMARK_TOKEN, data, }: {
7
20
  html: string;
8
21
  replyTo?: string;
9
22
  };
10
- }) => Promise<Response>;
23
+ }) => Promise<void>;
24
+ export {};
@@ -1,4 +1,13 @@
1
- export const sendEmail = async ({ POSTMARK_TOKEN, data, }) => {
1
+ export class SentryError extends Error {
2
+ constructor(message, options = {}) {
3
+ super(message);
4
+ this.name = 'SentryError';
5
+ this.skipSentry = options.skipSentry ?? false;
6
+ this.sentryMessage = options.sentryMessage;
7
+ this.statusCode = options.statusCode;
8
+ }
9
+ }
10
+ export const sendEmail = async ({ POSTMARK_TOKEN, data, logger, }) => {
2
11
  const response = await fetch('https://api.postmarkapp.com/email', {
3
12
  method: 'POST',
4
13
  headers: {
@@ -16,9 +25,24 @@ export const sendEmail = async ({ POSTMARK_TOKEN, data, }) => {
16
25
  MessageStream: 'outbound',
17
26
  }),
18
27
  });
28
+ const json = await response.json().catch(() => ({}));
29
+ logger.info('Postmark Response', {
30
+ status: response.status,
31
+ statusText: response.statusText,
32
+ body: JSON.stringify(json, null, 2),
33
+ });
19
34
  if (!response.ok) {
20
- throw new Error(`Failed to send email: ${response.statusText}`);
35
+ if (response.status === 422 &&
36
+ 'Message' in json &&
37
+ typeof json.Message === 'string') {
38
+ throw new SentryError(json.Message, {
39
+ skipSentry: true,
40
+ statusCode: 422,
41
+ });
42
+ }
43
+ throw new SentryError(`Failed to send email: ${response.statusText}`, {
44
+ sentryMessage: `Failed to send email to ${data.to} with subject ${data.subject}: ${response.statusText}`,
45
+ });
21
46
  }
22
- return response;
23
47
  };
24
48
  //# sourceMappingURL=send-email.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"send-email.js","sourceRoot":"src/","sources":["utils/send-email.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,EAC9B,cAAc,EACd,IAAI,GAUL,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,mCAAmC,EAAE;QAChE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;YAClC,yBAAyB,EAAE,cAAc;SAC1C;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,IAAI,EAAE,2CAA2C;YACjD,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,aAAa,EAAE,UAAU;SAC1B,CAAC;KACH,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
1
+ {"version":3,"file":"send-email.js","sourceRoot":"src/","sources":["utils/send-email.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,WAAY,SAAQ,KAAK;IAKpC,YAAY,OAAe,EAAE,UAA8B,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,CAAC,EAAE,EAAE,CAAC;QACjB,IACE,QAAQ,CAAC,MAAM,KAAK,GAAG;YACvB,SAAS,IAAI,IAAI;YACjB,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAChC,CAAC;YACD,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE;gBAClC,UAAU,EAAE,IAAI;gBAChB,UAAU,EAAE,GAAG;aAChB,CAAC,CAAC;QACL,CAAC;QAED,MAAM,IAAI,WAAW,CAAC,yBAAyB,QAAQ,CAAC,UAAU,EAAE,EAAE;YACpE,aAAa,EAAE,2BAA2B,IAAI,CAAC,EAAE,iBAAiB,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,UAAU,EAAE;SACzG,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { EmailBaseProps } from '../types';
2
- type NotificationKey = keyof Liveblocks['ActivitiesData'];
2
+ type NotificationKey = '$ownerStatementInReview' | '$ownerStatementPublished' | '$inviteOwnerAccepted' | '$inviteTeamMemberAccepted' | '$1099StatementPublished';
3
3
  export type DailyDigestEmailTemplateProps = {
4
4
  mode: EmailBaseProps['mode'];
5
5
  unreadNotifications: Record<NotificationKey, {
@@ -1 +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,SAA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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"}
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;AAgB9C,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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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"}
@@ -1,4 +1,4 @@
1
- import type { Maybe } from '@finalytic/utils';
1
+ import type { Maybe } from '@vrplatform/utils';
2
2
  export declare const getOwnerPortalColor: (color: Maybe<string>) => string | undefined;
3
3
  export declare const OWNER_PORTAL_COLORS: {
4
4
  orange: string;
@@ -1 +1 @@
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"}
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.9.3"}
@@ -1,5 +1,18 @@
1
- export declare const sendEmail: ({ POSTMARK_TOKEN, data, }: {
1
+ import type { logger as log } from '@trigger.dev/sdk';
2
+ type SentryErrorOptions = {
3
+ skipSentry?: boolean;
4
+ sentryMessage?: string;
5
+ statusCode?: number;
6
+ };
7
+ export declare class SentryError extends Error {
8
+ readonly skipSentry: boolean;
9
+ readonly sentryMessage?: string;
10
+ readonly statusCode?: number;
11
+ constructor(message: string, options?: SentryErrorOptions);
12
+ }
13
+ export declare const sendEmail: ({ POSTMARK_TOKEN, data, logger, }: {
2
14
  POSTMARK_TOKEN: string;
15
+ logger: typeof log;
3
16
  data: {
4
17
  to: string;
5
18
  subject: string;
@@ -7,4 +20,5 @@ export declare const sendEmail: ({ POSTMARK_TOKEN, data, }: {
7
20
  html: string;
8
21
  replyTo?: string;
9
22
  };
10
- }) => Promise<Response>;
23
+ }) => Promise<void>;
24
+ export {};
@@ -1,4 +1,16 @@
1
- export const sendEmail = async ({ POSTMARK_TOKEN, data, }) => {
1
+ export class SentryError extends Error {
2
+ skipSentry;
3
+ sentryMessage;
4
+ statusCode;
5
+ constructor(message, options = {}) {
6
+ super(message);
7
+ this.name = 'SentryError';
8
+ this.skipSentry = options.skipSentry ?? false;
9
+ this.sentryMessage = options.sentryMessage;
10
+ this.statusCode = options.statusCode;
11
+ }
12
+ }
13
+ export const sendEmail = async ({ POSTMARK_TOKEN, data, logger, }) => {
2
14
  const response = await fetch('https://api.postmarkapp.com/email', {
3
15
  method: 'POST',
4
16
  headers: {
@@ -16,9 +28,24 @@ export const sendEmail = async ({ POSTMARK_TOKEN, data, }) => {
16
28
  MessageStream: 'outbound',
17
29
  }),
18
30
  });
31
+ const json = await response.json().catch(() => ({}));
32
+ logger.info('Postmark Response', {
33
+ status: response.status,
34
+ statusText: response.statusText,
35
+ body: JSON.stringify(json, null, 2),
36
+ });
19
37
  if (!response.ok) {
20
- throw new Error(`Failed to send email: ${response.statusText}`);
38
+ if (response.status === 422 &&
39
+ 'Message' in json &&
40
+ typeof json.Message === 'string') {
41
+ throw new SentryError(json.Message, {
42
+ skipSentry: true,
43
+ statusCode: 422,
44
+ });
45
+ }
46
+ throw new SentryError(`Failed to send email: ${response.statusText}`, {
47
+ sentryMessage: `Failed to send email to ${data.to} with subject ${data.subject}: ${response.statusText}`,
48
+ });
21
49
  }
22
- return response;
23
50
  };
24
51
  //# sourceMappingURL=send-email.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"send-email.js","sourceRoot":"src/","sources":["utils/send-email.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAE,EAC9B,cAAc,EACd,IAAI,GAUL,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,mCAAmC,EAAE;QAChE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,MAAM,EAAE,kBAAkB;YAC1B,cAAc,EAAE,kBAAkB;YAClC,yBAAyB,EAAE,cAAc;SAC1C;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,IAAI,EAAE,2CAA2C;YACjD,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,I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Q,EAAE,IAAI,CAAC,IAAI;YACnB,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,aAAa,EAAE,UAAU;SAC1B,CAAC;KACH,CAAC,CAAC;IAEH,MAAM,IAAI,GAA4B,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE9E,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE;QAC/B,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;KACpC,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,IACE,QAAQ,CAAC,MAAM,KAAK,GAAG;YACvB,SAAS,IAAI,IAAI;YACjB,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAChC,CAAC;YACD,MAAM,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE;gBAClC,UAAU,EAAE,IAAI;gBAChB,UAAU,EAAE,GAAG;aAChB,CAAC,CAAC;QACL,CAAC;QAED,MAAM,IAAI,WAAW,CAAC,yBAAyB,QAAQ,CAAC,UAAU,EAAE,EAAE;YACpE,aAAa,EAAE,2BAA2B,IAAI,CAAC,EAAE,iBAAiB,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,UAAU,EAAE;SACzG,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrplatform/email",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "keywords": [],
5
5
  "license": "ISC",
6
6
  "main": "build/main/index.js",
@@ -16,7 +16,7 @@
16
16
  "access": "public"
17
17
  },
18
18
  "dependencies": {
19
- "@finalytic/utils": "*",
19
+ "@vrplatform/utils": "*",
20
20
  "@react-email/html": "0.0.9",
21
21
  "@react-email/body": "0.0.9",
22
22
  "@react-email/button": "0.0.16",
@@ -28,12 +28,12 @@
28
28
  "@react-email/img": "0.0.9",
29
29
  "@react-email/render": "0.0.17",
30
30
  "@react-email/preview": "0.0.10",
31
- "@react-email/link": "0.0.9"
31
+ "@react-email/link": "0.0.9",
32
+ "@trigger.dev/sdk": "*"
32
33
  },
33
34
  "devDependencies": {
34
- "@biomejs/biome": "*",
35
35
  "@types/bun": "*",
36
- "@types/react": "^19.0.12",
36
+ "@types/react": "19.2.7",
37
37
  "react-email": "3.0.1",
38
38
  "typescript": "*"
39
39
  },
@@ -5,7 +5,13 @@ import { EmailContainer } from '../components';
5
5
  import { Button } from '../components/Button';
6
6
  import type { EmailBaseProps } from '../types';
7
7
 
8
- type NotificationKey = keyof Liveblocks['ActivitiesData'];
8
+ // type NotificationKey = keyof Liveblocks['ActivitiesData'];
9
+ type NotificationKey =
10
+ | '$ownerStatementInReview'
11
+ | '$ownerStatementPublished'
12
+ | '$inviteOwnerAccepted'
13
+ | '$inviteTeamMemberAccepted'
14
+ | '$1099StatementPublished';
9
15
 
10
16
  export type DailyDigestEmailTemplateProps = {
11
17
  mode: EmailBaseProps['mode'];
package/src/theme.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Maybe } from '@finalytic/utils';
1
+ import type { Maybe } from '@vrplatform/utils';
2
2
 
3
3
  export const getOwnerPortalColor = (color: Maybe<string>) => {
4
4
  if (!color) return undefined;
@@ -1,8 +1,32 @@
1
+ import type { logger as log } from '@trigger.dev/sdk';
2
+
3
+ type SentryErrorOptions = {
4
+ skipSentry?: boolean;
5
+ sentryMessage?: string;
6
+ statusCode?: number;
7
+ };
8
+
9
+ export class SentryError extends Error {
10
+ readonly skipSentry: boolean;
11
+ readonly sentryMessage?: string;
12
+ readonly statusCode?: number;
13
+
14
+ constructor(message: string, options: SentryErrorOptions = {}) {
15
+ super(message);
16
+ this.name = 'SentryError';
17
+ this.skipSentry = options.skipSentry ?? false;
18
+ this.sentryMessage = options.sentryMessage;
19
+ this.statusCode = options.statusCode;
20
+ }
21
+ }
22
+
1
23
  export const sendEmail = async ({
2
24
  POSTMARK_TOKEN,
3
25
  data,
26
+ logger,
4
27
  }: {
5
28
  POSTMARK_TOKEN: string;
29
+ logger: typeof log;
6
30
  data: {
7
31
  to: string;
8
32
  subject: string;
@@ -29,9 +53,28 @@ export const sendEmail = async ({
29
53
  }),
30
54
  });
31
55
 
56
+ const json: Record<string, unknown> = await response.json().catch(() => ({}));
57
+
58
+ logger.info('Postmark Response', {
59
+ status: response.status,
60
+ statusText: response.statusText,
61
+ body: JSON.stringify(json, null, 2),
62
+ });
63
+
32
64
  if (!response.ok) {
33
- throw new Error(`Failed to send email: ${response.statusText}`);
34
- }
65
+ if (
66
+ response.status === 422 &&
67
+ 'Message' in json &&
68
+ typeof json.Message === 'string'
69
+ ) {
70
+ throw new SentryError(json.Message, {
71
+ skipSentry: true,
72
+ statusCode: 422,
73
+ });
74
+ }
35
75
 
36
- return response;
76
+ throw new SentryError(`Failed to send email: ${response.statusText}`, {
77
+ sentryMessage: `Failed to send email to ${data.to} with subject ${data.subject}: ${response.statusText}`,
78
+ });
79
+ }
37
80
  };