@bondsports/types 2.1.75 → 2.1.76

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,7 @@
9
9
  * ************************
10
10
  * ************************
11
11
  */
12
- import { NotificationDeliveryChannel } from '../types/enums/notification.enums';
12
+ import { NotificationClassification, NotificationDeliveryChannel } from '../types/enums/notification.enums';
13
13
  export declare class SenderDto {
14
14
  static UNKNOWN_USER_ID: number;
15
15
  userId: number;
@@ -36,6 +36,7 @@ export declare class ContentDto {
36
36
  }
37
37
  export declare class NotificationCreateDto {
38
38
  channel: NotificationDeliveryChannel;
39
+ classification?: NotificationClassification;
39
40
  sender: SenderDto;
40
41
  recipients: RecipientsDto[];
41
42
  content: ContentDto;
@@ -56,11 +56,15 @@ class ContentDto {
56
56
  }
57
57
  exports.ContentDto = ContentDto;
58
58
  class NotificationCreateDto {
59
+ constructor() {
60
+ this.classification = notification_enums_1.NotificationClassification.UNKNOWN;
61
+ }
59
62
  // Added for convenience.
60
63
  // Not part of NotificationsService object definitions.
61
64
  static sendgridTemplate(toEmailAddress, dynamicTemplateData, sendingUserId, sendingOrganizationId, sendingFacilityId) {
62
65
  const note = new NotificationCreateDto();
63
66
  note.channel = notification_enums_1.NotificationDeliveryChannel.EMAIL;
67
+ note.classification = notification_enums_1.NotificationClassification.TRANSACTIONAL;
64
68
  note.sender = new SenderDto(sendingUserId, sendingOrganizationId, sendingFacilityId);
65
69
  note.recipients = [RecipientsDto.to(toEmailAddress)];
66
70
  // there is no Content object when using a sendgrid template, it's the template and dynamic data:
@@ -1 +1 @@
1
- {"version":3,"file":"notification.create.dto.js","sourceRoot":"","sources":["../../../../src/types/notifications/dto/notification.create.dto.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,0EAAgF;AAEhF,0EAA0E;AAE1E,2CAA2C;AAC3C,6CAA6C;AAE7C,MAAa,SAAS;IAcrB,yBAAyB;IACzB,uDAAuD;IACvD,YACC,MAAc,EACd,cAAuB,EACvB,UAAmB,EACnB,OAAgB,EAChB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E,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,gDAA2B,CAAC,KAAK,CAAC;QACjD,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC,aAAa,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;QACrF,IAAI,CAAC,UAAU,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;QACrD,iGAAiG;QACjG,IAAI,CAAC,eAAe,GAAG;YACtB,wGAAwG;YACxG,mBAAmB,EAAE,mBAAmB;SACxC,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AApCD,sDAoCC"}
1
+ {"version":3,"file":"notification.create.dto.js","sourceRoot":"","sources":["../../../../src/types/notifications/dto/notification.create.dto.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,0EAA4G;AAE5G,0EAA0E;AAE1E,2CAA2C;AAC3C,6CAA6C;AAE7C,MAAa,SAAS;IAcrB,yBAAyB;IACzB,uDAAuD;IACvD,YACC,MAAc,EACd,cAAuB,EACvB,UAAmB,EACnB,OAAgB,EAChB,eAAwB;QAExB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACxC,CAAC;;AA5BF,8BA6BC;AA5BA,0GAA0G;AACnG,yBAAe,GAAG,CAAC,EAAE,CAAC;AA6B9B,MAAa,aAAa;IAYzB,yBAAyB;IACzB,uDAAuD;IACvD,MAAM,CAAC,EAAE,CAAC,EAAW;QACpB,MAAM,CAAC,GAAG,IAAI,aAAa,EAAE,CAAC;QAC9B,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtB,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enum NotificationDeliveryChannel {
12
12
  EMAIL = "EMAIL",
13
13
  SMS = "SMS"
14
14
  }
15
+ /**
16
+ * Transactional communications do not need to provide opt-out (for email, at least).
17
+ * Commercial communications (aka marketing messages) must provide a one-click opt-out mechanism for email
18
+ *
19
+ * NB: We may not wish to trust TENENT emails when they self-classify as transactional.
20
+ */
21
+ export declare enum NotificationClassification {
22
+ TRANSACTIONAL = "TRANSACTIONAL",
23
+ COMMERCIAL = "COMMERCIAL",
24
+ UNKNOWN = "UNKNOWN"
25
+ }
15
26
  export declare enum SendErrorCode {
16
27
  BAD_DELIVERY_CHANNEL = 400,
17
28
  SENDGRID_ERROR = 401,
@@ -10,13 +10,25 @@
10
10
  * ************************
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.SendErrorCode = exports.NotificationDeliveryChannel = void 0;
13
+ exports.SendErrorCode = exports.NotificationClassification = exports.NotificationDeliveryChannel = void 0;
14
14
  var NotificationDeliveryChannel;
15
15
  (function (NotificationDeliveryChannel) {
16
16
  NotificationDeliveryChannel["EMAIL"] = "EMAIL";
17
17
  // SMS is not yet implemented. Error will be returned if attempted.
18
18
  NotificationDeliveryChannel["SMS"] = "SMS";
19
19
  })(NotificationDeliveryChannel = exports.NotificationDeliveryChannel || (exports.NotificationDeliveryChannel = {}));
20
+ /**
21
+ * Transactional communications do not need to provide opt-out (for email, at least).
22
+ * Commercial communications (aka marketing messages) must provide a one-click opt-out mechanism for email
23
+ *
24
+ * NB: We may not wish to trust TENENT emails when they self-classify as transactional.
25
+ */
26
+ var NotificationClassification;
27
+ (function (NotificationClassification) {
28
+ NotificationClassification["TRANSACTIONAL"] = "TRANSACTIONAL";
29
+ NotificationClassification["COMMERCIAL"] = "COMMERCIAL";
30
+ NotificationClassification["UNKNOWN"] = "UNKNOWN";
31
+ })(NotificationClassification = exports.NotificationClassification || (exports.NotificationClassification = {}));
20
32
  // Internal error codes.
21
33
  // NB: Specific errors (ie. from Sendgrid) will be logged and returned directly.
22
34
  // We are not translating each, as they are quite granular, and prone to frequent updates by service providers.
@@ -1 +1 @@
1
- {"version":3,"file":"notification.enums.js","sourceRoot":"","sources":["../../../../../src/types/notifications/types/enums/notification.enums.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,IAAY,2BAIX;AAJD,WAAY,2BAA2B;IACtC,8CAAe,CAAA;IACf,oEAAoE;IACpE,0CAAW,CAAA;AACZ,CAAC,EAJW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAItC;AAED,wBAAwB;AACxB,gFAAgF;AAChF,+GAA+G;AAC/G,IAAY,aAIX;AAJD,WAAY,aAAa;IACxB,mFAA0B,CAAA;IAC1B,uEAAoB,CAAA;IACpB,uEAAoB,CAAA;AACrB,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB"}
1
+ {"version":3,"file":"notification.enums.js","sourceRoot":"","sources":["../../../../../src/types/notifications/types/enums/notification.enums.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,IAAY,2BAIX;AAJD,WAAY,2BAA2B;IACtC,8CAAe,CAAA;IACf,oEAAoE;IACpE,0CAAW,CAAA;AACZ,CAAC,EAJW,2BAA2B,GAA3B,mCAA2B,KAA3B,mCAA2B,QAItC;AAED;;;;;GAKG;AACH,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACrC,6DAA+B,CAAA;IAC/B,uDAAyB,CAAA;IACzB,iDAAmB,CAAA;AACpB,CAAC,EAJW,0BAA0B,GAA1B,kCAA0B,KAA1B,kCAA0B,QAIrC;AAED,wBAAwB;AACxB,gFAAgF;AAChF,+GAA+G;AAC/G,IAAY,aAIX;AAJD,WAAY,aAAa;IACxB,mFAA0B,CAAA;IAC1B,uEAAoB,CAAA;IACpB,uEAAoB,CAAA;AACrB,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bondsports/types",
3
- "version": "2.1.75",
3
+ "version": "2.1.76",
4
4
  "description": "backend types module for Bond-Sports",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {