@awell-health/awell-extensions 1.0.21 → 1.0.22-beta4

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.
Files changed (54) hide show
  1. package/dist/extensions/calDotCom/actions/getBooking.js +3 -2
  2. package/dist/extensions/calDotCom/actions/getBooking.js.map +1 -1
  3. package/dist/extensions/calDotCom/calComApi.d.ts +1 -3
  4. package/dist/extensions/calDotCom/calComApi.js +7 -10
  5. package/dist/extensions/calDotCom/calComApi.js.map +1 -1
  6. package/dist/extensions/calDotCom/types.d.ts +70 -16
  7. package/dist/extensions/calDotCom/types.js +26 -0
  8. package/dist/extensions/calDotCom/types.js.map +1 -1
  9. package/dist/extensions/cmDotCom/client/client.d.ts +9 -0
  10. package/dist/extensions/cmDotCom/client/client.js +40 -0
  11. package/dist/extensions/cmDotCom/client/client.js.map +1 -0
  12. package/dist/extensions/cmDotCom/client/error.d.ts +4 -0
  13. package/dist/extensions/cmDotCom/client/error.js +43 -0
  14. package/dist/extensions/cmDotCom/client/error.js.map +1 -0
  15. package/dist/extensions/cmDotCom/client/index.d.ts +2 -0
  16. package/dist/extensions/cmDotCom/client/index.js +19 -0
  17. package/dist/extensions/cmDotCom/client/index.js.map +1 -0
  18. package/dist/extensions/cmDotCom/client/types.d.ts +48 -0
  19. package/dist/extensions/cmDotCom/client/types.js +3 -0
  20. package/dist/extensions/cmDotCom/client/types.js.map +1 -0
  21. package/dist/extensions/cmDotCom/index.d.ts +2 -0
  22. package/dist/extensions/cmDotCom/index.js +21 -0
  23. package/dist/extensions/cmDotCom/index.js.map +1 -0
  24. package/dist/extensions/cmDotCom/settings.d.ts +27 -0
  25. package/dist/extensions/cmDotCom/settings.js +30 -0
  26. package/dist/extensions/cmDotCom/settings.js.map +1 -0
  27. package/dist/extensions/cmDotCom/v1/actions/index.d.ts +1 -0
  28. package/dist/extensions/cmDotCom/v1/actions/index.js +6 -0
  29. package/dist/extensions/cmDotCom/v1/actions/index.js.map +1 -0
  30. package/dist/extensions/cmDotCom/v1/actions/sendSms/config/fields.d.ts +41 -0
  31. package/dist/extensions/cmDotCom/v1/actions/sendSms/config/fields.js +37 -0
  32. package/dist/extensions/cmDotCom/v1/actions/sendSms/config/fields.js.map +1 -0
  33. package/dist/extensions/cmDotCom/v1/actions/sendSms/config/index.d.ts +1 -0
  34. package/dist/extensions/cmDotCom/v1/actions/sendSms/config/index.js +7 -0
  35. package/dist/extensions/cmDotCom/v1/actions/sendSms/config/index.js.map +1 -0
  36. package/dist/extensions/cmDotCom/v1/actions/sendSms/index.d.ts +1 -0
  37. package/dist/extensions/cmDotCom/v1/actions/sendSms/index.js +6 -0
  38. package/dist/extensions/cmDotCom/v1/actions/sendSms/index.js.map +1 -0
  39. package/dist/extensions/cmDotCom/v1/actions/sendSms/sendSms.d.ts +4 -0
  40. package/dist/extensions/cmDotCom/v1/actions/sendSms/sendSms.js +91 -0
  41. package/dist/extensions/cmDotCom/v1/actions/sendSms/sendSms.js.map +1 -0
  42. package/dist/extensions/cmDotCom/v1/actions/sendSms/sendSms.test.d.ts +1 -0
  43. package/dist/extensions/cmDotCom/v1/actions/sendSms/sendSms.test.js +114 -0
  44. package/dist/extensions/cmDotCom/v1/actions/sendSms/sendSms.test.js.map +1 -0
  45. package/dist/extensions/cmDotCom/v1/tests/validation.test.d.ts +1 -0
  46. package/dist/extensions/cmDotCom/v1/tests/validation.test.js +23 -0
  47. package/dist/extensions/cmDotCom/v1/tests/validation.test.js.map +1 -0
  48. package/dist/extensions/cmDotCom/v1/validation.d.ts +2 -0
  49. package/dist/extensions/cmDotCom/v1/validation.js +18 -0
  50. package/dist/extensions/cmDotCom/v1/validation.js.map +1 -0
  51. package/dist/extensions/index.js +2 -0
  52. package/dist/extensions/index.js.map +1 -1
  53. package/dist/extensions/markdown.json +4 -0
  54. package/package.json +5 -3
@@ -72,7 +72,7 @@ exports.getBooking = {
72
72
  else {
73
73
  try {
74
74
  const calComApi = new calComApi_1.default(apiKey);
75
- const { booking } = await calComApi.getBooking(bookingId);
75
+ const booking = await calComApi.getBooking(bookingId);
76
76
  await onComplete({
77
77
  data_points: {
78
78
  eventTypeId: `${booking.eventTypeId}`,
@@ -87,12 +87,13 @@ exports.getBooking = {
87
87
  });
88
88
  }
89
89
  catch (error) {
90
+ const errorMessage = error.message;
90
91
  await onError({
91
92
  events: [
92
93
  {
93
94
  date: new Date().toISOString(),
94
95
  text: {
95
- en: `Error in calDotCom extension -> getBooking action: ${JSON.stringify(error)}`,
96
+ en: `Get Booking failed: ${errorMessage}`,
96
97
  },
97
98
  },
98
99
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"getBooking.js","sourceRoot":"","sources":["../../../../extensions/calDotCom/actions/getBooking.ts"],"names":[],"mappings":";;;;;;AAAA,mEAKsC;AACtC,mEAAwD;AACxD,6DAAoC;AAGpC,MAAM,MAAM,GAAG;IACb,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEjC,MAAM,UAAU,GAAG;IACjB,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;IACD,KAAK,EAAE;QACL,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,QAAQ;KACpB;IACD,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,MAAM;KAClB;IACD,OAAO,EAAE;QACP,GAAG,EAAE,SAAS;QACd,SAAS,EAAE,MAAM;KAClB;IACD,MAAM,EAAE;QACN,GAAG,EAAE,QAAQ;QACb,SAAS,EAAE,QAAQ;KACpB;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,aAAa,EAAE;QACb,GAAG,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D;iBACF,CAAC,CAAA;aACH;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BAC9B,IAAI,EAAE;gCACJ,EAAE,EAAE,sDAAsD,IAAI,CAAC,SAAS,CACtE,KAAK,CACN,EAAE;6BACJ;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;SACF;IACH,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"getBooking.js","sourceRoot":"","sources":["../../../../extensions/calDotCom/actions/getBooking.ts"],"names":[],"mappings":";;;;;;AAAA,mEAKsC;AACtC,mEAAwD;AACxD,6DAAoC;AAGpC,MAAM,MAAM,GAAG;IACb,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEjC,MAAM,UAAU,GAAG;IACjB,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;IACD,KAAK,EAAE;QACL,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,QAAQ;KACpB;IACD,WAAW,EAAE;QACX,GAAG,EAAE,aAAa;QAClB,SAAS,EAAE,QAAQ;KACpB;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,MAAM;KAClB;IACD,OAAO,EAAE;QACP,GAAG,EAAE,SAAS;QACd,SAAS,EAAE,MAAM;KAClB;IACD,MAAM,EAAE;QACN,GAAG,EAAE,QAAQ;QACb,SAAS,EAAE,QAAQ;KACpB;IACD,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,aAAa,EAAE;QACb,GAAG,EAAE,eAAe;QACpB,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA;AAElC,QAAA,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AC,OAAO,CAAA;gBAC7C,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BAC9B,IAAI,EAAE;gCACJ,EAAE,EAAE,uBAAuB,YAAY,EAAE;6BAC1C;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;SACF;IACH,CAAC;CACF,CAAA"}
@@ -4,8 +4,6 @@ declare class CalComApi {
4
4
  private readonly baseUrl;
5
5
  constructor(apiKey: string);
6
6
  private constructUrl;
7
- getBooking(id: string): Promise<{
8
- booking: Booking;
9
- }>;
7
+ getBooking(id: string): Promise<Booking>;
10
8
  }
11
9
  export default CalComApi;
@@ -1,22 +1,19 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const node_fetch_1 = __importDefault(require("node-fetch"));
3
+ const extensions_core_1 = require("@awell-health/extensions-core");
4
+ const types_1 = require("./types");
7
5
  class CalComApi {
8
6
  constructor(apiKey) {
9
7
  this.baseUrl = 'https://api.cal.com/v1';
10
8
  this.apiKey = apiKey;
11
9
  }
12
- constructUrl(url) { return `${this.baseUrl}${url}?apiKey=${this.apiKey}`; }
10
+ constructUrl(url) {
11
+ return `${this.baseUrl}${url}?apiKey=${this.apiKey}`;
12
+ }
13
13
  async getBooking(id) {
14
14
  const url = this.constructUrl(`/bookings/${id}`);
15
- const response = await (0, node_fetch_1.default)(url);
16
- if (!response.ok)
17
- throw Error(response.statusText);
18
- const data = await response.json();
19
- return data;
15
+ const response = await (0, extensions_core_1.fetchTyped)(url, types_1.GetBookingResponseSchema);
16
+ return response.booking;
20
17
  }
21
18
  }
22
19
  exports.default = CalComApi;
@@ -1 +1 @@
1
- {"version":3,"file":"calComApi.js","sourceRoot":"","sources":["../../../extensions/calDotCom/calComApi.ts"],"names":[],"mappings":";;;;;AAAA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AAQ,CAAC,OAAO,CAAA;IACzB,CAAC;CACF;AAED,kBAAe,SAAS,CAAA"}
@@ -1,20 +1,74 @@
1
- export interface Booking {
2
- id: number;
3
- userId: number;
1
+ import { z } from 'zod';
2
+ export declare const BookingSchema: z.ZodObject<{
3
+ eventTypeId: z.ZodNumber;
4
+ title: z.ZodString;
5
+ description: z.ZodString;
6
+ startTime: z.ZodString;
7
+ endTime: z.ZodString;
8
+ status: z.ZodString;
9
+ uid: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ endTime: string;
12
+ startTime: string;
13
+ title: string;
4
14
  description: string;
5
- eventTypeId: number;
15
+ status: string;
6
16
  uid: string;
7
- title: string;
8
- startTime: string;
17
+ eventTypeId: number;
18
+ }, {
9
19
  endTime: string;
10
- attendees: User[];
11
- user: User;
12
- metadata: Record<string, unknown>;
20
+ startTime: string;
21
+ title: string;
22
+ description: string;
13
23
  status: string;
14
- }
15
- export interface User {
16
- email: string;
17
- name: string;
18
- timeZone: string;
19
- locale?: string;
20
- }
24
+ uid: string;
25
+ eventTypeId: number;
26
+ }>;
27
+ export declare const GetBookingResponseSchema: z.ZodObject<{
28
+ booking: z.ZodObject<{
29
+ eventTypeId: z.ZodNumber;
30
+ title: z.ZodString;
31
+ description: z.ZodString;
32
+ startTime: z.ZodString;
33
+ endTime: z.ZodString;
34
+ status: z.ZodString;
35
+ uid: z.ZodString;
36
+ }, "strip", z.ZodTypeAny, {
37
+ endTime: string;
38
+ startTime: string;
39
+ title: string;
40
+ description: string;
41
+ status: string;
42
+ uid: string;
43
+ eventTypeId: number;
44
+ }, {
45
+ endTime: string;
46
+ startTime: string;
47
+ title: string;
48
+ description: string;
49
+ status: string;
50
+ uid: string;
51
+ eventTypeId: number;
52
+ }>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ booking: {
55
+ endTime: string;
56
+ startTime: string;
57
+ title: string;
58
+ description: string;
59
+ status: string;
60
+ uid: string;
61
+ eventTypeId: number;
62
+ };
63
+ }, {
64
+ booking: {
65
+ endTime: string;
66
+ startTime: string;
67
+ title: string;
68
+ description: string;
69
+ status: string;
70
+ uid: string;
71
+ eventTypeId: number;
72
+ };
73
+ }>;
74
+ export type Booking = z.infer<typeof BookingSchema>;
@@ -1,3 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetBookingResponseSchema = exports.BookingSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ // const UserSchema = z.object({
6
+ // email: z.string(),
7
+ // name: z.string(),
8
+ // timeZone: z.string(),
9
+ // locale: z.string().optional().nullable(),
10
+ // })
11
+ // export type User = z.infer<typeof UserSchema>
12
+ exports.BookingSchema = zod_1.z.object({
13
+ eventTypeId: zod_1.z.number(),
14
+ title: zod_1.z.string(),
15
+ description: zod_1.z.string(),
16
+ startTime: zod_1.z.string(),
17
+ endTime: zod_1.z.string(),
18
+ status: zod_1.z.string(),
19
+ uid: zod_1.z.string(),
20
+ // id: z.number(),
21
+ // userId: z.number(),
22
+ // user: UserSchema,
23
+ // attendees: z.array(UserSchema),
24
+ // metadata: z.record(z.unknown()),
25
+ });
26
+ exports.GetBookingResponseSchema = zod_1.z.object({
27
+ booking: exports.BookingSchema,
28
+ });
3
29
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../extensions/calDotCom/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../extensions/calDotCom/types.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEvB,gCAAgC;AAChC,uBAAuB;AACvB,sBAAsB;AACtB,0BAA0B;AAC1B,8CAA8C;AAC9C,KAAK;AAEL,gDAAgD;AAEnC,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;IACvB,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,oBAAoB;IACpB,wBAAwB;IACxB,sBAAsB;IACtB,oCAAoC;IACpC,qCAAqC;CACtC,CAAC,CAAA;AAEW,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,qBAAa;CACvB,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { type CmSDK, type MessageRequest } from './types';
2
+ export declare class CmClient {
3
+ private readonly _client;
4
+ private readonly _productToken;
5
+ constructor({ productToken }: {
6
+ productToken: string;
7
+ });
8
+ readonly sendSms: ({ from, to, message, reference, }: MessageRequest) => ReturnType<CmSDK['messages_SendMessage']>;
9
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CmClient = void 0;
7
+ const api_1 = __importDefault(require("api"));
8
+ class CmClient {
9
+ constructor({ productToken }) {
10
+ this.sendSms = async ({ from, to, message, reference, }) => {
11
+ return await this._client.messages_SendMessage({
12
+ messages: {
13
+ authentication: { productToken: this._productToken },
14
+ msg: [
15
+ {
16
+ from,
17
+ body: {
18
+ type: 'auto',
19
+ content: message,
20
+ },
21
+ reference,
22
+ to: [
23
+ {
24
+ number: to,
25
+ },
26
+ ],
27
+ allowedChannels: ['SMS'],
28
+ minimumNumberOfMessageParts: 1,
29
+ maximumNumberOfMessageParts: 8,
30
+ },
31
+ ],
32
+ },
33
+ });
34
+ };
35
+ this._productToken = productToken;
36
+ this._client = (0, api_1.default)('@messaging/v1.1#1f38u2plibh3cmv');
37
+ }
38
+ }
39
+ exports.CmClient = CmClient;
40
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../extensions/cmDotCom/client/client.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAqB;AAGrB,MAAa,QAAQ;IAInB,YAAY,EAAE,YAAY,EAA4B;QAK7C,YAAO,GAAG,KAAK,EAAE,EACxB,IAAI,EACJ,EAAE,EACF,OAAO,EACP,SAAS,GACM,EAA6C,EAAE;YAC9D,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;gBAC7C,QAAQ,EAAE;oBACR,cAAc,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,aAAa,EAAE;oBACpD,GAAG,EAAE;wBACH;4BACE,IAAI;4BACJ,IAAI,EAAE;gCACJ,IAAI,EAAE,MAAM;gCACZ,OAAO,EAAE,OAAO;6BACjB;4BACD,SAAS;4BACT,EAAE,EAAE;gCACF;oCACE,MAAM,EAAE,EAAE;iCACX;6BACF;4BACD,eAAe,EAAE,CAAC,KAAK,CAAC;4BACxB,2BAA2B,EAAE,CAAC;4BAC9B,2BAA2B,EAAE,CAAC;yBAC/B;qBACF;iBACF;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;QAjCC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAA;QACjC,IAAI,CAAC,OAAO,GAAG,IAAA,aAAG,EAAC,iCAAiC,CAAC,CAAA;IACvD,CAAC;CAgCF;AAvCD,4BAuCC"}
@@ -0,0 +1,4 @@
1
+ import { type ActivityEvent } from '@awell-health/extensions-core';
2
+ import { type MessageResponse } from './types';
3
+ export declare const isSmsError: (error: any) => error is MessageResponse;
4
+ export declare const smsErrorToActivityEvent: (error: MessageResponse) => ActivityEvent[];
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.smsErrorToActivityEvent = exports.isSmsError = void 0;
4
+ const isSmsError = (error) => {
5
+ return ('data' in error &&
6
+ 'details' in error.data &&
7
+ typeof error.data.details === 'string' &&
8
+ 'errorCode' in error.data);
9
+ };
10
+ exports.isSmsError = isSmsError;
11
+ const smsErrorToActivityEvent = (error) => {
12
+ var _a;
13
+ if (((_a = error.data.messages) === null || _a === void 0 ? void 0 : _a.length) > 0) {
14
+ return error.data.messages.map((errorItem) => {
15
+ const errorCode = errorItem.messageErrorCode;
16
+ const errorDetails = errorItem.messageDetails;
17
+ const message = `(${errorCode}) ${errorDetails}`;
18
+ return {
19
+ date: new Date().toISOString(),
20
+ text: { en: message },
21
+ error: {
22
+ category: 'SERVER_ERROR',
23
+ message,
24
+ },
25
+ };
26
+ });
27
+ }
28
+ const errorCode = error.data.errorCode;
29
+ const errorDetails = error.data.details;
30
+ const message = `(${errorCode}) ${errorDetails}`;
31
+ return [
32
+ {
33
+ date: new Date().toISOString(),
34
+ text: { en: message },
35
+ error: {
36
+ category: 'SERVER_ERROR',
37
+ message,
38
+ },
39
+ },
40
+ ];
41
+ };
42
+ exports.smsErrorToActivityEvent = smsErrorToActivityEvent;
43
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../extensions/cmDotCom/client/error.ts"],"names":[],"mappings":";;;AAGO,MAAM,UAAU,GAAG,CAAC,KAAU,EAA4B,EAAE;IACjE,OAAO,CACL,MAAM,IAAI,KAAK;QACf,SAAS,IAAI,KAAK,CAAC,IAAI;QACvB,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,QAAQ;QACtC,WAAW,IAAI,KAAK,CAAC,IAAI,CAC1B,CAAA;AACH,CAAC,CAAA;AAPY,QAAA,UAAU,cAOtB;AAEM,MAAM,uBAAuB,GAAG,CACrC,KAAsB,EACL,EAAE;;IACnB,IAAI,CAAA,MAAA,KAAK,CAAC,IAAI,CAAC,QAAQ,0CAAE,MAAM,IAAG,CAAC,EAAE;QACnC,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;YAC3C,MAAM,SAAS,GAAG,SAAS,CAAC,gBAAgB,CAAA;YAC5C,MAAM,YAAY,GAAG,SAAS,CAAC,cAAc,CAAA;YAC7C,MAAM,OAAO,GAAG,IAAI,SAAS,KAAK,YAAY,EAAE,CAAA;YAEhD,OAAO;gBACL,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;gBACrB,KAAK,EAAE;oBACL,QAAQ,EAAE,cAAc;oBACxB,OAAO;iBACR;aACF,CAAA;QACH,CAAC,CAAC,CAAA;KACH;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAA;IACtC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAA;IACvC,MAAM,OAAO,GAAG,IAAI,SAAS,KAAK,YAAY,EAAE,CAAA;IAEhD,OAAO;QACL;YACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;YACrB,KAAK,EAAE;gBACL,QAAQ,EAAE,cAAc;gBACxB,OAAO;aACR;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAlCY,QAAA,uBAAuB,2BAkCnC"}
@@ -0,0 +1,2 @@
1
+ export * from './client';
2
+ export * from './error';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client"), exports);
18
+ __exportStar(require("./error"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/cmDotCom/client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,0CAAuB"}
@@ -0,0 +1,48 @@
1
+ export interface MessageRequest {
2
+ from: string;
3
+ to: string;
4
+ message: string;
5
+ reference?: string;
6
+ }
7
+ interface BaseResponse<T> {
8
+ data: T;
9
+ }
10
+ export interface MessageResponse extends BaseResponse<{
11
+ details: string;
12
+ errorCode: number;
13
+ messages: Array<{
14
+ to: string;
15
+ status: string;
16
+ reference: string;
17
+ parts: number;
18
+ messageDetails: string;
19
+ messageErrorCode: number;
20
+ }>;
21
+ }> {
22
+ }
23
+ export interface CmSDK {
24
+ messages_SendMessage: (arg: {
25
+ messages: {
26
+ authentication: {
27
+ productToken: string;
28
+ };
29
+ msg: [
30
+ {
31
+ from: string;
32
+ body: {
33
+ type?: string;
34
+ content: string;
35
+ };
36
+ reference?: string;
37
+ to: Array<{
38
+ number: string;
39
+ }>;
40
+ allowedChannels?: string[];
41
+ minimumNumberOfMessageParts?: number;
42
+ maximumNumberOfMessageParts?: number;
43
+ }
44
+ ];
45
+ };
46
+ }) => Promise<MessageResponse>;
47
+ }
48
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../extensions/cmDotCom/client/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { type Extension } from '@awell-health/extensions-core';
2
+ export declare const CmDotCom: Extension;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CmDotCom = void 0;
4
+ const extensions_core_1 = require("@awell-health/extensions-core");
5
+ const actions_1 = require("./v1/actions");
6
+ const settings_1 = require("./settings");
7
+ exports.CmDotCom = {
8
+ key: 'cmDotCom',
9
+ title: 'cm.com',
10
+ icon_url: 'https://res.cloudinary.com/da7x4rzl4/image/upload/v1687860653/Awell%20Extensions/cm-f4ffa018.png',
11
+ description: 'cm.com is a communications Platform for Messaging & Voice',
12
+ category: extensions_core_1.Category.COMMUNICATION,
13
+ author: {
14
+ authorType: extensions_core_1.AuthorType.AWELL,
15
+ },
16
+ actions: {
17
+ sendSms: actions_1.sendSms,
18
+ },
19
+ settings: settings_1.settings,
20
+ };
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../extensions/cmDotCom/index.ts"],"names":[],"mappings":";;;AACA,mEAAoE;AACpE,0CAAsC;AACtC,yCAAqC;AAExB,QAAA,QAAQ,GAAc;IACjC,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,QAAQ;IACf,QAAQ,EACN,kGAAkG;IACpG,WAAW,EAAE,2DAA2D;IACxE,QAAQ,EAAE,0BAAQ,CAAC,aAAa;IAChC,MAAM,EAAE;QACN,UAAU,EAAE,4BAAU,CAAC,KAAK;KAC7B;IACD,OAAO,EAAE;QACP,OAAO,EAAP,iBAAO;KACR;IACD,QAAQ,EAAR,mBAAQ;CACT,CAAA"}
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ export declare const settings: {
3
+ productToken: {
4
+ label: string;
5
+ key: string;
6
+ obfuscated: true;
7
+ required: true;
8
+ description: string;
9
+ };
10
+ fromName: {
11
+ label: string;
12
+ key: string;
13
+ obfuscated: false;
14
+ required: false;
15
+ description: string;
16
+ };
17
+ };
18
+ export declare const SettingsValidationSchema: z.ZodObject<{
19
+ productToken: z.ZodString;
20
+ fromName: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodString]>, string | undefined, string>>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ productToken: string;
23
+ fromName?: string | undefined;
24
+ }, {
25
+ productToken: string;
26
+ fromName?: string | undefined;
27
+ }>;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsValidationSchema = exports.settings = void 0;
4
+ const zod_1 = require("zod");
5
+ const validation_1 = require("./v1/validation");
6
+ exports.settings = {
7
+ productToken: {
8
+ label: 'Product Token',
9
+ key: 'productToken',
10
+ obfuscated: true,
11
+ required: true,
12
+ description: 'This is the product token for authentication. Visit https://gateway.cmtelecom.com/ to retrieve your product token.',
13
+ },
14
+ fromName: {
15
+ label: 'From/sender name',
16
+ key: 'fromName',
17
+ obfuscated: false,
18
+ required: false,
19
+ description: "This is the sender's name. The maximum length is 11 alphanumerical characters or 16 digits",
20
+ },
21
+ };
22
+ exports.SettingsValidationSchema = zod_1.z.object({
23
+ productToken: zod_1.z
24
+ .string()
25
+ .nonempty({
26
+ message: 'Missing "product token in the extension settings."',
27
+ }),
28
+ fromName: validation_1.FromNameValidationSchema,
29
+ });
30
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../extensions/cmDotCom/settings.ts"],"names":[],"mappings":";;;AACA,6BAAwC;AACxC,gDAA0D;AAE7C,QAAA,QAAQ,GAAG;IACtB,YAAY,EAAE;QACZ,KAAK,EAAE,eAAe;QACtB,GAAG,EAAE,cAAc;QACnB,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,oHAAoH;KACvH;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,kBAAkB;QACzB,GAAG,EAAE,UAAU;QACf,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,4FAA4F;KAC/F;CACgC,CAAA;AAEtB,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,YAAY,EAAE,OAAC;SACZ,MAAM,EAAE;SACR,QAAQ,CAAC;QACR,OAAO,EAAE,oDAAoD;KAC9D,CAAC;IACJ,QAAQ,EAAE,qCAAwB;CACiB,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export { sendSms } from './sendSms';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendSms = void 0;
4
+ var sendSms_1 = require("./sendSms");
5
+ Object.defineProperty(exports, "sendSms", { enumerable: true, get: function () { return sendSms_1.sendSms; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../extensions/cmDotCom/v1/actions/index.ts"],"names":[],"mappings":";;;AAAA,qCAAmC;AAA1B,kGAAA,OAAO,OAAA"}
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ import { FieldType, StringType } from '@awell-health/extensions-core';
3
+ export declare const fields: {
4
+ fromName: {
5
+ label: string;
6
+ id: string;
7
+ type: FieldType.STRING;
8
+ required: false;
9
+ description: string;
10
+ };
11
+ recipient: {
12
+ id: string;
13
+ label: string;
14
+ type: FieldType.STRING;
15
+ stringType: StringType.PHONE;
16
+ description: string;
17
+ required: true;
18
+ };
19
+ message: {
20
+ id: string;
21
+ label: string;
22
+ description: string;
23
+ type: FieldType.TEXT;
24
+ required: true;
25
+ };
26
+ };
27
+ export declare const FieldsValidationSchema: z.ZodObject<{
28
+ fromName: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodString]>, string | undefined, string>>;
29
+ recipient: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, import("libphonenumber-js").PhoneNumber | import("libphonenumber-js").ParseError, string>, import("libphonenumber-js").PhoneNumber | import("libphonenumber-js").ParseError, string>, import("libphonenumber-js").E164Number, string>;
30
+ message: z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ message: string;
33
+ recipient: string & {
34
+ __tag?: "E164Number" | undefined;
35
+ };
36
+ fromName?: string | undefined;
37
+ }, {
38
+ message: string;
39
+ recipient: string;
40
+ fromName?: string | undefined;
41
+ }>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldsValidationSchema = exports.fields = void 0;
4
+ const zod_1 = require("zod");
5
+ const extensions_core_1 = require("@awell-health/extensions-core");
6
+ const extensions_core_2 = require("@awell-health/extensions-core");
7
+ const validation_1 = require("../../../validation");
8
+ exports.fields = {
9
+ fromName: {
10
+ label: 'From name',
11
+ id: 'fromName',
12
+ type: extensions_core_2.FieldType.STRING,
13
+ required: false,
14
+ description: 'This is the sender\'s name. The maximum length is 11 alphanumerical characters or 16 digits. When left blank, the "From name" from the extension settings will be used.',
15
+ },
16
+ recipient: {
17
+ id: 'recipient',
18
+ label: '"To" phone number',
19
+ type: extensions_core_2.FieldType.STRING,
20
+ stringType: extensions_core_2.StringType.PHONE,
21
+ description: 'The phone number you would like to send the text message to.',
22
+ required: true,
23
+ },
24
+ message: {
25
+ id: 'message',
26
+ label: 'Message',
27
+ description: 'The message you would like to send.',
28
+ type: extensions_core_2.FieldType.TEXT,
29
+ required: true,
30
+ },
31
+ };
32
+ exports.FieldsValidationSchema = zod_1.z.object({
33
+ fromName: validation_1.FromNameValidationSchema,
34
+ recipient: extensions_core_1.E164PhoneValidationSchema,
35
+ message: zod_1.z.string(),
36
+ });
37
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../../extensions/cmDotCom/v1/actions/sendSms/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAAyE;AACzE,mEAIsC;AACtC,oDAA8D;AAEjD,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE;QACR,KAAK,EAAE,WAAW;QAClB,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,yKAAyK;KAC5K;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,UAAU,EAAE,4BAAU,CAAC,KAAK;QAC5B,WAAW,EAAE,8DAA8D;QAC3E,QAAQ,EAAE,IAAI;KACf;IACD,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,qCAAqC;QAClD,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,QAAQ,EAAE,qCAAwB;IAClC,SAAS,EAAE,2CAAyB;IACpC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;CAC8B,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export { FieldsValidationSchema, fields } from './fields';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fields = exports.FieldsValidationSchema = void 0;
4
+ var fields_1 = require("./fields");
5
+ Object.defineProperty(exports, "FieldsValidationSchema", { enumerable: true, get: function () { return fields_1.FieldsValidationSchema; } });
6
+ Object.defineProperty(exports, "fields", { enumerable: true, get: function () { return fields_1.fields; } });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../extensions/cmDotCom/v1/actions/sendSms/config/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyD;AAAhD,gHAAA,sBAAsB,OAAA;AAAE,gGAAA,MAAM,OAAA"}
@@ -0,0 +1 @@
1
+ export { sendSms } from './sendSms';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendSms = void 0;
4
+ var sendSms_1 = require("./sendSms");
5
+ Object.defineProperty(exports, "sendSms", { enumerable: true, get: function () { return sendSms_1.sendSms; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/cmDotCom/v1/actions/sendSms/index.ts"],"names":[],"mappings":";;;AAAA,qCAAmC;AAA1B,kGAAA,OAAO,OAAA"}
@@ -0,0 +1,4 @@
1
+ import { type Action } from '@awell-health/extensions-core';
2
+ import { type settings } from '../../../settings';
3
+ import { fields } from './config';
4
+ export declare const sendSms: Action<typeof fields, typeof settings>;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendSms = void 0;
4
+ const zod_1 = require("zod");
5
+ const zod_validation_error_1 = require("zod-validation-error");
6
+ const extensions_core_1 = require("@awell-health/extensions-core");
7
+ const settings_1 = require("../../../settings");
8
+ const config_1 = require("./config");
9
+ const lodash_1 = require("lodash");
10
+ const client_1 = require("../../../client");
11
+ exports.sendSms = {
12
+ key: 'sendSms',
13
+ title: 'Send SMS',
14
+ description: 'Send a text message to a recipient of your choice.',
15
+ category: extensions_core_1.Category.COMMUNICATION,
16
+ fields: config_1.fields,
17
+ previewable: false,
18
+ onActivityCreated: async (payload, onComplete, onError) => {
19
+ var _a;
20
+ try {
21
+ const { activity: { id: activityId }, } = payload;
22
+ const { settings: { productToken, fromName: defaultFromName }, fields: { recipient, message, fromName }, } = (0, extensions_core_1.validate)({
23
+ schema: zod_1.z
24
+ .object({
25
+ settings: settings_1.SettingsValidationSchema,
26
+ fields: config_1.FieldsValidationSchema,
27
+ })
28
+ .superRefine((value, ctx) => {
29
+ // if both `from` values missing - throw error
30
+ if ((0, lodash_1.isNil)(value.settings.fromName) &&
31
+ (0, lodash_1.isNil)(value.fields.fromName)) {
32
+ ctx.addIssue({
33
+ code: zod_1.z.ZodIssueCode.custom,
34
+ fatal: true,
35
+ message: '"fromName" is missing in both settings and in the action field.',
36
+ });
37
+ }
38
+ }),
39
+ payload,
40
+ });
41
+ const client = new client_1.CmClient({
42
+ productToken,
43
+ });
44
+ await client.sendSms({
45
+ // default only for TypeScript check, in reality error will be thrown if both empty
46
+ from: (_a = fromName !== null && fromName !== void 0 ? fromName : defaultFromName) !== null && _a !== void 0 ? _a : '',
47
+ to: recipient,
48
+ message,
49
+ reference: activityId,
50
+ });
51
+ await onComplete();
52
+ }
53
+ catch (err) {
54
+ if (err instanceof zod_1.ZodError) {
55
+ const error = (0, zod_validation_error_1.fromZodError)(err);
56
+ await onError({
57
+ events: [
58
+ {
59
+ date: new Date().toISOString(),
60
+ text: { en: error.message },
61
+ error: {
62
+ category: 'WRONG_INPUT',
63
+ message: error.message,
64
+ },
65
+ },
66
+ ],
67
+ });
68
+ }
69
+ else if ((0, client_1.isSmsError)(err)) {
70
+ const events = (0, client_1.smsErrorToActivityEvent)(err);
71
+ await onError({ events });
72
+ }
73
+ else {
74
+ const message = err.message;
75
+ await onError({
76
+ events: [
77
+ {
78
+ date: new Date().toISOString(),
79
+ text: { en: message },
80
+ error: {
81
+ category: 'SERVER_ERROR',
82
+ message,
83
+ },
84
+ },
85
+ ],
86
+ });
87
+ }
88
+ }
89
+ },
90
+ };
91
+ //# sourceMappingURL=sendSms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendSms.js","sourceRoot":"","sources":["../../../../../../extensions/cmDotCom/v1/actions/sendSms/sendSms.ts"],"names":[],"mappings":";;;AAAA,6BAAiC;AACjC,+DAAmD;AAGnD,mEAAkE;AAClE,gDAA4D;AAC5D,qCAAyD;AACzD,mCAA8B;AAC9B,4CAA+E;AAElE,QAAA,OAAO,GAA2C;IAC7D,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,UAAU;IACjB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SAAS,EAAE,UAAU;aACtB,CAAC,CAAA;YAEF,MAAM,UAAU,EAAE,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,YAAY,cAAQ,EAAE;gBAC3B,MAAM,KAAK,GAAG,IAAA,mCAAY,EAAC,GAAG,CAAC,CAAA;gBAC/B,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE;4BAC3B,KAAK,EAAE;gCACL,QAAQ,EAAE,aAAa;gCACvB,OAAO,EAAE,KAAK,CAAC,OAAO;6BACvB;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;iBAAM,IAAI,IAAA,mBAAU,EAAC,GAAG,CAAC,EAAE;gBAC1B,MAAM,MAAM,GAAG,IAAA,gCAAuB,EAAC,GAAG,CAAC,CAAA;gBAC3C,MAAM,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;aAC1B;iBAAM;gBACL,MAAM,OAAO,GAAI,GAAa,CAAC,OAAO,CAAA;gBACtC,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;4BAC9B,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;4BACrB,KAAK,EAAE;gCACL,QAAQ,EAAE,cAAc;gCACxB,OAAO;6BACR;yBACF;qBACF;iBACF,CAAC,CAAA;aACH;SACF;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const __mocks__1 = require("../../../client/__mocks__");
4
+ const __1 = require("..");
5
+ jest.mock('../../../client');
6
+ describe('Send SMS', () => {
7
+ const onComplete = jest.fn();
8
+ const onError = jest.fn();
9
+ const basePayload = {
10
+ pathway: {
11
+ id: 'pathway-id',
12
+ definition_id: 'pathway-definition-id',
13
+ },
14
+ activity: {
15
+ id: 'activity-id',
16
+ },
17
+ patient: { id: 'test-patient' },
18
+ fields: {
19
+ fromName: 'fromName',
20
+ recipient: '+123456789',
21
+ message: 'message',
22
+ },
23
+ settings: {
24
+ productToken: 'productToken',
25
+ fromName: 'fromName',
26
+ },
27
+ };
28
+ beforeEach(() => {
29
+ jest.clearAllMocks();
30
+ });
31
+ test('Should call the onComplete callback', async () => {
32
+ await __1.sendSms.onActivityCreated(basePayload, onComplete, onError);
33
+ expect(__mocks__1.CmClientMockImplementation.sendSms).toHaveBeenCalledWith({
34
+ from: basePayload.fields.fromName,
35
+ to: basePayload.fields.recipient,
36
+ message: basePayload.fields.message,
37
+ reference: basePayload.activity.id,
38
+ });
39
+ expect(onComplete).toHaveBeenCalled();
40
+ expect(onError).not.toHaveBeenCalled();
41
+ });
42
+ test.each([{ value: undefined }, { value: '' }])('$#. Should use settings values when fields equal "$value"', async ({ value }) => {
43
+ await __1.sendSms.onActivityCreated({
44
+ ...basePayload,
45
+ fields: {
46
+ ...basePayload.fields,
47
+ fromName: value,
48
+ },
49
+ settings: {
50
+ ...basePayload.settings,
51
+ fromName: 'settings',
52
+ },
53
+ }, onComplete, onError);
54
+ expect(__mocks__1.CmClientMockImplementation.sendSms).toHaveBeenCalledWith({
55
+ from: 'settings',
56
+ to: basePayload.fields.recipient,
57
+ message: basePayload.fields.message,
58
+ reference: basePayload.activity.id,
59
+ });
60
+ expect(onComplete).toHaveBeenCalled();
61
+ expect(onError).not.toHaveBeenCalled();
62
+ });
63
+ test.each([
64
+ { settings: { fromName: undefined } },
65
+ { settings: { fromName: '' } },
66
+ { settings: { fromName: 'settings' } },
67
+ ])('$#. Should use fields values when provided and override settings values', async ({ settings }) => {
68
+ await __1.sendSms.onActivityCreated({
69
+ ...basePayload,
70
+ fields: {
71
+ ...basePayload.fields,
72
+ fromName: 'fields',
73
+ },
74
+ settings: {
75
+ ...basePayload.settings,
76
+ ...settings,
77
+ },
78
+ }, onComplete, onError);
79
+ expect(__mocks__1.CmClientMockImplementation.sendSms).toHaveBeenCalledWith({
80
+ from: 'fields',
81
+ to: basePayload.fields.recipient,
82
+ message: basePayload.fields.message,
83
+ reference: basePayload.activity.id,
84
+ });
85
+ expect(onComplete).toHaveBeenCalled();
86
+ expect(onError).not.toHaveBeenCalled();
87
+ });
88
+ test.each([{ value: undefined }, { value: '' }])('$#. Should throw error when fields and settings are not provided', async ({ value }) => {
89
+ await __1.sendSms.onActivityCreated({
90
+ ...basePayload,
91
+ fields: {
92
+ ...basePayload.fields,
93
+ fromName: value,
94
+ },
95
+ settings: {
96
+ ...basePayload.settings,
97
+ fromName: value,
98
+ },
99
+ }, onComplete, onError);
100
+ expect(__mocks__1.CmClientMockImplementation.sendSms).not.toHaveBeenCalled();
101
+ expect(onComplete).not.toHaveBeenCalled();
102
+ expect(onError).toHaveBeenCalledWith({
103
+ events: [
104
+ expect.objectContaining({
105
+ error: {
106
+ category: 'WRONG_INPUT',
107
+ message: 'Validation error: "fromName" is missing in both settings and in the action field.',
108
+ },
109
+ }),
110
+ ],
111
+ });
112
+ });
113
+ });
114
+ //# sourceMappingURL=sendSms.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendSms.test.js","sourceRoot":"","sources":["../../../../../../extensions/cmDotCom/v1/actions/sendSms/sendSms.test.ts"],"names":[],"mappings":";;AAAA,wDAAsE;AACtE,0BAA4B;AAE5B,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;AAE5B,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEzB,MAAM,WAAW,GAAG;QAClB,OAAO,EAAE;YACP,EAAE,EAAE,YAAY;YAChB,aAAa,EAAE,uBAAuB;SACvC;QACD,QAAQ,EAAE;YACR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nC,SAAS,EAAE,WAAW,CAAC,QAAQ,CAAC,EAAE;SACnC,CAAC,CAAA;QACF,MAAM,CAAC,UAAU,CAAC,CAAC,gBAAgB,EAAE,CAAA;QACrC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IACxC,CAAC,CACF,CAAA;IAED,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAC9C,kEAAkE,EAClE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAClB,MAAM,WAAO,CAAC,iBAAiB,CAC7B;YACE,GAAG,WAAW;YACd,MAAM,EAAE;gBACN,GAAG,WAAW,CAAC,MAAM;gBACrB,QAAQ,EAAE,KAAK;aAChB;YACD,QAAQ,EAAE;gBACR,GAAG,WAAW,CAAC,QAAQ;gBACvB,QAAQ,EAAE,KAAK;aAChB;SACF,EACD,UAAU,EACV,OAAO,CACR,CAAA;QACD,MAAM,CAAC,qCAA0B,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;QACjE,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;QACzC,MAAM,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC;YACnC,MAAM,EAAE;gBACN,MAAM,CAAC,gBAAgB,CAAC;oBACtB,KAAK,EAAE;wBACL,QAAQ,EAAE,aAAa;wBACvB,OAAO,EACL,mFAAmF;qBACtF;iBACF,CAAC;aACH;SACF,CAAC,CAAA;IACJ,CAAC,CACF,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const validation_1 = require("../validation");
4
+ describe('From name validation', () => {
5
+ test.each([
6
+ { value: '' },
7
+ { value: '1' },
8
+ { value: '123456789' },
9
+ { value: '0123456789123456' },
10
+ { value: 'abc' },
11
+ { value: 'abc123def45' },
12
+ ])('$#. Should validate when value equals "$value"', async ({ value }) => {
13
+ expect(() => {
14
+ validation_1.FromNameValidationSchema.parse(value);
15
+ }).not.toThrow();
16
+ });
17
+ test.each([{ value: '01234567891234567' }, { value: 'abc123def456' }])('$#. Should throw when value equals "$value"', async ({ value }) => {
18
+ expect(() => {
19
+ validation_1.FromNameValidationSchema.parse(value);
20
+ }).toThrow();
21
+ });
22
+ });
23
+ //# sourceMappingURL=validation.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.test.js","sourceRoot":"","sources":["../../../../../extensions/cmDotCom/v1/tests/validation.test.ts"],"names":[],"mappings":";;AAAA,8CAAwD;AAExD,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,IAAI,CAAC,IAAI,CAAC;QACR,EAAE,KAAK,EAAE,EAAE,EAAE;QACb,EAAE,KAAK,EAAE,GAAG,EAAE;QACd,EAAE,KAAK,EAAE,WAAW,EAAE;QACtB,EAAE,KAAK,EAAE,kBAAkB,EAAE;QAC7B,EAAE,KAAK,EAAE,KAAK,EAAE;QAChB,EAAE,KAAK,EAAE,aAAa,EAAE;KACzB,CAAC,CAAC,gDAAgD,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QACvE,MAAM,CAAC,GAAG,EAAE;YACV,qCAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,CACpE,6CAA6C,EAC7C,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAClB,MAAM,CAAC,GAAG,EAAE;YACV,qCAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACvC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;IACd,CAAC,CACF,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ import { z } from 'zod';
2
+ export declare const FromNameValidationSchema: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodString]>, string | undefined, string>>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FromNameValidationSchema = void 0;
4
+ const lodash_1 = require("lodash");
5
+ const zod_1 = require("zod");
6
+ exports.FromNameValidationSchema = zod_1.z
7
+ .union([
8
+ // 11 alphanumerical characters
9
+ zod_1.z.string().max(11),
10
+ // 16 digits
11
+ zod_1.z.string().max(16).regex(/^\d+$/, {
12
+ message: '"From/sender name" can contain either up to 11 alphanumerical characters or up to 16 digits',
13
+ }),
14
+ ])
15
+ // if value is empty - treat it as undefined
16
+ .transform((value) => ((0, lodash_1.isEmpty)(value) ? undefined : value))
17
+ .optional();
18
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../extensions/cmDotCom/v1/validation.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAChC,6BAAuB;AAEV,QAAA,wBAAwB,GAAG,OAAC;KACtC,KAAK,CAAC;IACL,+BAA+B;IAC/B,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;IAClB,YAAY;IACZ,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE;QAChC,OAAO,EACL,6FAA6F;KAChG,CAAC;CACH,CAAC;IACF,4CAA4C;KAC3C,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAA,gBAAO,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KAC1D,QAAQ,EAAE,CAAA"}
@@ -40,6 +40,7 @@ const messagebird_1 = require("./messagebird");
40
40
  const metriport_1 = require("./metriport");
41
41
  const twilio_1 = require("./twilio");
42
42
  const wellinks_1 = require("./wellinks");
43
+ const cmDotCom_1 = require("./cmDotCom");
43
44
  const json = __importStar(require("./markdown.json"));
44
45
  exports.markdown = json;
45
46
  exports.extensions = [
@@ -59,5 +60,6 @@ exports.extensions = [
59
60
  metriport_1.Metriport,
60
61
  twilio_1.Twilio,
61
62
  wellinks_1.Wellinks,
63
+ cmDotCom_1.CmDotCom,
62
64
  ];
63
65
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../extensions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,mCAA+B;AAC/B,2CAAuC;AACvC,6CAAyC;AACzC,+CAA2C;AAC3C,uCAAmC;AACnC,yCAAqC;AACrC,yCAAqC;AACrC,+CAA0C;AAC1C,2CAAuC;AACvC,uCAAmC;AACnC,iCAAsC;AACtC,+CAA2C;AAC3C,2CAAuC;AACvC,qCAAiC;AACjC,yCAAqC;AACrC,sDAAuC;AAG1B,QAAA,QAAQ,GAAa,IAAI,CAAA;AAEzB,QAAA,UAAU,GAAG;IACxB,oFAAoF;IACpF,aAAK;IACL,qBAAS;IACT,uBAAU;IACV,yBAAW;IACX,iBAAO;IACP,mBAAQ;IACR,mBAAQ;IACR,wBAAU;IACV,qBAAS;IACT,iBAAO;IACP,oBAAa;IACb,yBAAW;IACX,qBAAS;IACT,eAAM;IACN,mBAAQ;CACT,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../extensions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,mCAA+B;AAC/B,2CAAuC;AACvC,6CAAyC;AACzC,+CAA2C;AAC3C,uCAAmC;AACnC,yCAAqC;AACrC,yCAAqC;AACrC,+CAA0C;AAC1C,2CAAuC;AACvC,uCAAmC;AACnC,iCAAsC;AACtC,+CAA2C;AAC3C,2CAAuC;AACvC,qCAAiC;AACjC,yCAAqC;AACrC,yCAAqC;AACrC,sDAAuC;AAG1B,QAAA,QAAQ,GAAa,IAAI,CAAA;AAEzB,QAAA,UAAU,GAAG;IACxB,oFAAoF;IACpF,aAAK;IACL,qBAAS;IACT,uBAAU;IACV,yBAAW;IACX,iBAAO;IACP,mBAAQ;IACR,mBAAQ;IACR,wBAAU;IACV,qBAAS;IACT,iBAAO;IACP,oBAAa;IACb,yBAAW;IACX,qBAAS;IACT,eAAM;IACN,mBAAQ;IACR,mBAAQ;CACT,CAAA"}
@@ -15,6 +15,10 @@
15
15
  "readme": "# Cloudinary\n\nCloudinary is a cloud-based image and video management platform that provides a comprehensive set of tools for storing, managing, and delivering digital media assets. It enables users to upload, manipulate, optimize, and deliver media files to any device or website quickly and easily.\n\nThe platform offers features such as image and video transformation, automatic image optimization, and responsive image delivery. Cloudinary also provides tools for organizing media assets, including tags, folders, and metadata.\n\n## Custom Actions\n\n### Upload files\n\nThis action allows a given stakeholder to upload one or many files (all file types allowed). Additionally, you can specify in what folder you would like to upload the assets.\n\n**Prerequisites:**\n\n1. You have a Cloudinary account\n2. You have created an upload preset that allows for unsigned uploads\n\n**Limitations:**\n\n- You cannot manage or browse uploaded file(s) in Awell. You can only do that in Cloudinary. To make searching files as easy as possible, you can assign tags to uploaded files and each uploaded file automatically has metadata attached (pathway id and activity id)\n- Only support for unsigned uploads\n- As a user, you cannot delete files you already uploaded\n",
16
16
  "changelog": "# Cloudinary changelog"
17
17
  },
18
+ "cmDotCom": {
19
+ "readme": "# CM.com\n\nCM.com is a global communication and digital services provider based in the Netherlands. It offers a wide range of services and solutions in the areas of messaging, payments, voice, and customer experience.\n\nCM.com enables businesses to communicate with their customers through various channels such as SMS, email, push notifications, social media messaging, and more.\n\n## Extension settings\n\nIn order to set up this extension, you will need:\n\n1. A **Product Token** - visit https://gateway.cmtelecom.com/ to retrieve your product token.\n2. A **From/sender name** - the maximum length is 11 alphanumerical characters or 16 digit\n\n## Custom Actions\n\n### Send SMS\n\nSend an SMS with CM.com to a recipient of your liking.\n",
20
+ "changelog": "# CM.com changelog\n"
21
+ },
18
22
  "dropboxSign": {
19
23
  "readme": "# Dropbox Sign\n\nDropbox Sign (formerly HelloSign) is the easiest way to send, receive and manage legally binding electronic signatures.\n\n## Extension settings\n\nIn order to set up this extension, you will need to provide the following settings:\n\n1. API Key\n2. Client ID - the id of the API app created in Dropbox Sign. Only required if want to use embedded signature requests.\n3. Test mode - whether you want to execute all API calls to DropboxSign in test mode. When test mode is enabled, signature requests will not be legally binding. When disabled, keep in mind that you must upgrade to a paid DropboxSign API plan to create signature requests via the extension.\n\n## Custom Actions\n\n### Embedded signing\n\nEmbedded Signing gives users the ability to sign documents directly from Awell Hosted Pages using Dropbox Sign's embedded signing feature. First an embedded signature request with a template is created and then a signing URL is generated for the signature request. Via the signing URL, we can let the user sign the request from within Awell.\n\nEmbedded signing behaves as a blocking action where the action is only completed when the signature request is effectively signed.\n\n**In order to add embedded signing, you need to add 2 actions to you care flow:**\n\n1. First, add the \"Create embedded signature request with template\" action. This action will create an embedded signature request based on a template and return a **sign URL**.\n2. Second, add the \"Embedded signing\" action. In this action you will have to configure the **sign URL** you got from the first action.\n\n**Please note that the signing URL generated in the first step is only valid for 1 hour.** This means that from as soon as the first action is activated, the user has 1 hour to complete the signing request. When the sign URL has expired, the document cannot be signed anymore and and the process would have to be repeated.\n\n### Send signature request with template\n\nCreates and sends a new SignatureRequest based off of a template specified with the template id parameter. The request will be send to specified signer via email. Please note that is a non-blocking action and that the care flow will automatically continue once the request is sent. It won't wait for the actual signing of the request.\n\nTo send signature requests via the DropboxSign API you must upgrade to a [paid API plan](https://app.hellosign.com/api/pricing).\n\n### Get signature request\n\nReturns the SignatureRequest specified by the signature request id parameter.\n\n### Send request reminder\n\nSends an email to the signer reminding them to sign the signature request. You cannot send a reminder within 1 hour of the last reminder that was sent. This includes manual AND automatic reminders.\n\n**Important:**\n\n- The email address specified to send the reminder to needs to be an email address of an actual signer linked to the signature request. If not, the action will fail.\n- This action can not be used with embedded signature requests.\n\n### Cancel signature request\n\nCancels an incomplete signature request. This action is not reversible.\n",
20
24
  "changelog": "# Dropbox Sign changelog"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "1.0.21",
3
+ "version": "1.0.22-beta4",
4
4
  "packageManager": "yarn@3.4.1",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {
@@ -58,10 +58,11 @@
58
58
  "typescript": "4.9.5"
59
59
  },
60
60
  "dependencies": {
61
- "@awell-health/extensions-core": "0.1.6",
61
+ "@awell-health/extensions-core": "0.1.7-beta31",
62
62
  "@dropbox/sign": "^1.1.3",
63
63
  "@mailchimp/mailchimp_transactional": "^1.0.50",
64
64
  "@metriport/api": "^3.1.5",
65
+ "api": "^6.0.0",
65
66
  "axios": "^1.3.4",
66
67
  "date-fns": "^2.29.3",
67
68
  "driver-license-validator": "2.0.2",
@@ -79,5 +80,6 @@
79
80
  "twilio": "^4.8.0",
80
81
  "zod": "^3.21.4",
81
82
  "zod-validation-error": "^1.0.1"
82
- }
83
+ },
84
+ "stableVersion": "1.0.22"
83
85
  }