@awell-health/awell-extensions 1.0.102 → 1.0.103
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.
- package/dist/extensions/markdown.json +1 -1
- package/dist/extensions/wellinks/actions/createFlourishCustomer/config/fields.d.ts +58 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/config/fields.js +56 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/config/fields.js.map +1 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/config/index.d.ts +2 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/config/index.js +9 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/config/index.js.map +1 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/config/settings.d.ts +35 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/config/settings.js +17 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/config/settings.js.map +1 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/createFlourishCustomer.d.ts +11 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/createFlourishCustomer.js +56 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/createFlourishCustomer.js.map +1 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/createFlourishCustomer.test.d.ts +1 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/createFlourishCustomer.test.js +53 -0
- package/dist/extensions/wellinks/actions/createFlourishCustomer/createFlourishCustomer.test.js.map +1 -0
- package/dist/extensions/wellinks/actions/index.d.ts +108 -0
- package/dist/extensions/wellinks/actions/index.js +3 -1
- package/dist/extensions/wellinks/actions/index.js.map +1 -1
- package/dist/extensions/wellinks/actions/submitPamSurvey/config/fields.js +2 -2
- package/dist/extensions/wellinks/actions/submitPamSurvey/config/fields.js.map +1 -1
- package/dist/extensions/wellinks/actions/submitPamSurvey/submitPamSurvey.test.js +2 -2
- package/dist/extensions/wellinks/actions/submitPamSurvey/submitPamSurvey.test.js.map +1 -1
- package/dist/extensions/wellinks/api/clients/wellinksFlourishClient.d.ts +1 -0
- package/dist/extensions/wellinks/api/clients/wellinksFlourishClient.js +44 -0
- package/dist/extensions/wellinks/api/clients/wellinksFlourishClient.js.map +1 -1
- package/dist/extensions/wellinks/api/test/wellinksFlourishClient.test.js +161 -105
- package/dist/extensions/wellinks/api/test/wellinksFlourishClient.test.js.map +1 -1
- package/package.json +1 -1
@@ -81,6 +81,6 @@
|
|
81
81
|
},
|
82
82
|
"wellinks": {
|
83
83
|
"readme": "---\ntitle: Wellinks\ndescription: The purpose of this extension is to keep application logic out of the Pathways and Tracks. Some actions require interactions with the Healthie API, hence the need for the API URL and Key in the settings.\n---\n# Wellinks Extension\n\nThe purpose of this extension is to keep application logic out of the Pathways and Tracks. Some actions require interactions with the Healthie API, hence the need for the API URL and Key in the settings.\n\n## Extension Settings\n\nYou will need to provide the API URL and Key for the Wellinks Healthie instance.\n\n# Custom Actions\n\n## Check for Override\n\nChecks to see if the patient in Healthie has an active Override form.\n\n## Check for Scheduled Appointments\n\nChecks to see if the patient in Healthie has an appointment of a specific type scheduled in the future.\n\n## Check for Chat\n\nChecks that a Chat message (either to or from a patient and coach) has happened at least 24 hours after an appointment\n\n## Insert Member List Event\n\nAdds an Insert Member List Event to the Platform Database.\n\n## Check for Flourish Customer\n\nQueries Flourish to see if there is a record that has a matching ThirdPartyIdentifier. Returns True/False.\n\n## Submit a PAM Survey\n\nSubmits a PAM 13 Survey (completed in the Careflow) to Flourish and returns the PAM Score and Levl.",
|
84
|
-
"changelog": "# Wellinks Changelog\n\n## May 18th, 2023\n\nAdded the checkForOverride action.\n\n## May 19th, 2023\n\nAdded the checkForScheduledAppointment action.\n\n## May 25th, 2023\n\nAdded datapoints for actions\n\n\n## July 6th, 2023\n\nAdded new action to unenroll user from Sendgrid.\n\n## July 16th, 2023\n\nAdded a new action to insert a Member Event List to the Platform DB. This requires setting the platform API URL and API Key values for the extension.\n\n## September 12th, 2023\n\nAdds a new action to check Flourish for a customer with a matching ThirdPartyIdentifier.\n\n## September 18th, 2023\n\nAdds a new action to submit a PAM13 survey to Flourish"
|
84
|
+
"changelog": "# Wellinks Changelog\n\n## May 18th, 2023\n\nAdded the checkForOverride action.\n\n## May 19th, 2023\n\nAdded the checkForScheduledAppointment action.\n\n## May 25th, 2023\n\nAdded datapoints for actions\n\n\n## July 6th, 2023\n\nAdded new action to unenroll user from Sendgrid.\n\n## July 16th, 2023\n\nAdded a new action to insert a Member Event List to the Platform DB. This requires setting the platform API URL and API Key values for the extension.\n\n## September 12th, 2023\n\nAdds a new action to check Flourish for a customer with a matching ThirdPartyIdentifier.\n\n## September 18th, 2023\n\nAdds a new action to submit a PAM13 survey to Flourish, returning a PAM Score, level, and whether or not the submission was a success.\n\n## September 19th, 2023\n\nAdds a new action to create a customer in Flourish, returning true or false based on whether or not the creation was a success."
|
85
85
|
}
|
86
86
|
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { FieldType } from '@awell-health/extensions-core';
|
3
|
+
export declare const fields: {
|
4
|
+
firstName: {
|
5
|
+
id: string;
|
6
|
+
label: string;
|
7
|
+
description: string;
|
8
|
+
type: FieldType.STRING;
|
9
|
+
required: true;
|
10
|
+
};
|
11
|
+
lastName: {
|
12
|
+
id: string;
|
13
|
+
label: string;
|
14
|
+
description: string;
|
15
|
+
type: FieldType.STRING;
|
16
|
+
required: true;
|
17
|
+
};
|
18
|
+
dateOfBirth: {
|
19
|
+
id: string;
|
20
|
+
label: string;
|
21
|
+
description: string;
|
22
|
+
type: FieldType.DATE;
|
23
|
+
required: true;
|
24
|
+
};
|
25
|
+
subgroupId: {
|
26
|
+
id: string;
|
27
|
+
label: string;
|
28
|
+
description: string;
|
29
|
+
type: FieldType.STRING;
|
30
|
+
required: true;
|
31
|
+
};
|
32
|
+
thirdPartyIdentifier: {
|
33
|
+
id: string;
|
34
|
+
label: string;
|
35
|
+
description: string;
|
36
|
+
type: FieldType.STRING;
|
37
|
+
required: true;
|
38
|
+
};
|
39
|
+
};
|
40
|
+
export declare const FieldsValidationSchema: z.ZodObject<{
|
41
|
+
firstName: z.ZodString;
|
42
|
+
lastName: z.ZodString;
|
43
|
+
dateOfBirth: z.ZodString;
|
44
|
+
subgroupId: z.ZodString;
|
45
|
+
thirdPartyIdentifier: z.ZodString;
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
47
|
+
firstName: string;
|
48
|
+
lastName: string;
|
49
|
+
thirdPartyIdentifier: string;
|
50
|
+
dateOfBirth: string;
|
51
|
+
subgroupId: string;
|
52
|
+
}, {
|
53
|
+
firstName: string;
|
54
|
+
lastName: string;
|
55
|
+
thirdPartyIdentifier: string;
|
56
|
+
dateOfBirth: string;
|
57
|
+
subgroupId: string;
|
58
|
+
}>;
|
@@ -0,0 +1,56 @@
|
|
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
|
+
exports.fields = {
|
7
|
+
firstName: {
|
8
|
+
id: 'firstName',
|
9
|
+
label: 'First Name',
|
10
|
+
description: 'The first name of the user to create in Flourish.',
|
11
|
+
type: extensions_core_1.FieldType.STRING,
|
12
|
+
required: true,
|
13
|
+
},
|
14
|
+
lastName: {
|
15
|
+
id: 'lastName',
|
16
|
+
label: 'Last Name',
|
17
|
+
description: 'The last name of the user to create in Flourish.',
|
18
|
+
type: extensions_core_1.FieldType.STRING,
|
19
|
+
required: true,
|
20
|
+
},
|
21
|
+
dateOfBirth: {
|
22
|
+
id: 'dateOfBirth',
|
23
|
+
label: 'Date of Birth',
|
24
|
+
description: 'The date of birth of the user to create in Flourish in YYYY-MM-DD format.',
|
25
|
+
type: extensions_core_1.FieldType.DATE,
|
26
|
+
required: true,
|
27
|
+
},
|
28
|
+
subgroupId: {
|
29
|
+
id: 'subgroupId',
|
30
|
+
label: 'Subgroup ID',
|
31
|
+
description: 'The subgroup ID of the user to create in Flourish.',
|
32
|
+
type: extensions_core_1.FieldType.STRING,
|
33
|
+
required: true,
|
34
|
+
},
|
35
|
+
thirdPartyIdentifier: {
|
36
|
+
id: 'thirdPartyIdentifier',
|
37
|
+
label: 'Third Party Identifier',
|
38
|
+
description: 'The third party identifier of the user to create in Flourish.',
|
39
|
+
type: extensions_core_1.FieldType.STRING,
|
40
|
+
required: true,
|
41
|
+
},
|
42
|
+
};
|
43
|
+
exports.FieldsValidationSchema = zod_1.z.object({
|
44
|
+
firstName: zod_1.z.string(),
|
45
|
+
lastName: zod_1.z.string(),
|
46
|
+
dateOfBirth: zod_1.z
|
47
|
+
.string({
|
48
|
+
errorMap: () => ({
|
49
|
+
message: 'Admin date is required and must be of format YYYY-MM-DD',
|
50
|
+
}),
|
51
|
+
})
|
52
|
+
.datetime(),
|
53
|
+
subgroupId: zod_1.z.string(),
|
54
|
+
thirdPartyIdentifier: zod_1.z.string(),
|
55
|
+
});
|
56
|
+
//# sourceMappingURL=fields.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/wellinks/actions/createFlourishCustomer/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAAqE;AAExD,QAAA,MAAM,GAAG;IACpB,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,mDAAmD;QAChE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,kDAAkD;QAC/D,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,2EAA2E;QAC7E,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;KACf;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,sBAAsB;QAC1B,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,+DAA+D;QACjE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,OAAC;SACX,MAAM,CAAC;QACN,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;YACf,OAAO,EAAE,yDAAyD;SACnE,CAAC;KACH,CAAC;SACD,QAAQ,EAAE;IACb,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;IACtB,oBAAoB,EAAE,OAAC,CAAC,MAAM,EAAE;CACiB,CAAC,CAAA"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SettingsValidationSchema = exports.FieldsValidationSchema = exports.fields = void 0;
|
4
|
+
var fields_1 = require("./fields");
|
5
|
+
Object.defineProperty(exports, "fields", { enumerable: true, get: function () { return fields_1.fields; } });
|
6
|
+
Object.defineProperty(exports, "FieldsValidationSchema", { enumerable: true, get: function () { return fields_1.FieldsValidationSchema; } });
|
7
|
+
var settings_1 = require("./settings");
|
8
|
+
Object.defineProperty(exports, "SettingsValidationSchema", { enumerable: true, get: function () { return settings_1.SettingsValidationSchema; } });
|
9
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../extensions/wellinks/actions/createFlourishCustomer/config/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyD;AAAhD,gGAAA,MAAM,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AACvC,uCAAqD;AAA5C,oHAAA,wBAAwB,OAAA"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
export declare const SettingsValidationSchema: z.ZodObject<{
|
3
|
+
platformApiKey: z.ZodOptional<z.ZodString>;
|
4
|
+
platformApiUrl: z.ZodOptional<z.ZodString>;
|
5
|
+
apiUrl: z.ZodOptional<z.ZodString>;
|
6
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
7
|
+
selectEventTypeQuestion: z.ZodOptional<z.ZodString>;
|
8
|
+
startSendingRemindersQuestions: z.ZodOptional<z.ZodString>;
|
9
|
+
memberEventFormId: z.ZodOptional<z.ZodString>;
|
10
|
+
flourishApiKey: z.ZodString;
|
11
|
+
flourishApiUrl: z.ZodString;
|
12
|
+
flourishClientExtId: z.ZodString;
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
14
|
+
flourishApiUrl: string;
|
15
|
+
flourishApiKey: string;
|
16
|
+
flourishClientExtId: string;
|
17
|
+
platformApiKey?: string | undefined;
|
18
|
+
platformApiUrl?: string | undefined;
|
19
|
+
apiUrl?: string | undefined;
|
20
|
+
apiKey?: string | undefined;
|
21
|
+
selectEventTypeQuestion?: string | undefined;
|
22
|
+
startSendingRemindersQuestions?: string | undefined;
|
23
|
+
memberEventFormId?: string | undefined;
|
24
|
+
}, {
|
25
|
+
flourishApiUrl: string;
|
26
|
+
flourishApiKey: string;
|
27
|
+
flourishClientExtId: string;
|
28
|
+
platformApiKey?: string | undefined;
|
29
|
+
platformApiUrl?: string | undefined;
|
30
|
+
apiUrl?: string | undefined;
|
31
|
+
apiKey?: string | undefined;
|
32
|
+
selectEventTypeQuestion?: string | undefined;
|
33
|
+
startSendingRemindersQuestions?: string | undefined;
|
34
|
+
memberEventFormId?: string | undefined;
|
35
|
+
}>;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SettingsValidationSchema = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
exports.SettingsValidationSchema = zod_1.z.object({
|
6
|
+
platformApiKey: zod_1.z.string().optional(),
|
7
|
+
platformApiUrl: zod_1.z.string().optional(),
|
8
|
+
apiUrl: zod_1.z.string().optional(),
|
9
|
+
apiKey: zod_1.z.string().optional(),
|
10
|
+
selectEventTypeQuestion: zod_1.z.string().optional(),
|
11
|
+
startSendingRemindersQuestions: zod_1.z.string().optional(),
|
12
|
+
memberEventFormId: zod_1.z.string().optional(),
|
13
|
+
flourishApiKey: zod_1.z.string(),
|
14
|
+
flourishApiUrl: zod_1.z.string(),
|
15
|
+
flourishClientExtId: zod_1.z.string(),
|
16
|
+
});
|
17
|
+
//# sourceMappingURL=settings.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../../../extensions/wellinks/actions/createFlourishCustomer/config/settings.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AAE3B,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,uBAAuB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9C,8BAA8B,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrD,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE;IAC1B,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE;IAC1B,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE;CACoB,CAAC,CAAA"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { type Action } from '@awell-health/extensions-core';
|
2
|
+
import { type settings } from '../../config/settings';
|
3
|
+
import { fields } from './config';
|
4
|
+
declare const dataPoints: {
|
5
|
+
createSuccessful: {
|
6
|
+
key: string;
|
7
|
+
valueType: "boolean";
|
8
|
+
};
|
9
|
+
};
|
10
|
+
export declare const createFlourishCustomer: Action<typeof fields, typeof settings, keyof typeof dataPoints>;
|
11
|
+
export {};
|
@@ -0,0 +1,56 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createFlourishCustomer = void 0;
|
4
|
+
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
|
+
const wellinksFlourishClient_1 = require("../../api/clients/wellinksFlourishClient");
|
6
|
+
const config_1 = require("./config");
|
7
|
+
const zod_1 = require("zod");
|
8
|
+
const dataPoints = {
|
9
|
+
createSuccessful: {
|
10
|
+
key: 'createSuccessful',
|
11
|
+
valueType: 'boolean',
|
12
|
+
},
|
13
|
+
};
|
14
|
+
exports.createFlourishCustomer = {
|
15
|
+
key: 'createFlourishCustomer',
|
16
|
+
category: extensions_core_1.Category.EHR_INTEGRATIONS,
|
17
|
+
title: 'Create a Flourish Customer',
|
18
|
+
description: 'Creates a customer in Flourish using supplied information.',
|
19
|
+
fields: config_1.fields,
|
20
|
+
dataPoints,
|
21
|
+
previewable: true,
|
22
|
+
onActivityCreated: async (payload, onComplete, onError) => {
|
23
|
+
const { fields: { firstName, lastName, dateOfBirth, subgroupId, thirdPartyIdentifier, }, settings: { flourishApiKey, flourishApiUrl, flourishClientExtId }, } = (0, extensions_core_1.validate)({
|
24
|
+
schema: zod_1.z.object({
|
25
|
+
fields: config_1.FieldsValidationSchema,
|
26
|
+
settings: config_1.SettingsValidationSchema,
|
27
|
+
}),
|
28
|
+
payload,
|
29
|
+
});
|
30
|
+
const client = new wellinksFlourishClient_1.WellinksFlourishClient(flourishApiUrl, flourishApiKey, flourishClientExtId);
|
31
|
+
try {
|
32
|
+
const result = await client.user.create(firstName, lastName, dateOfBirth, subgroupId, thirdPartyIdentifier);
|
33
|
+
await onComplete({
|
34
|
+
data_points: {
|
35
|
+
createSuccessful: result.toString(),
|
36
|
+
},
|
37
|
+
});
|
38
|
+
}
|
39
|
+
catch (err) {
|
40
|
+
const error = err;
|
41
|
+
await onError({
|
42
|
+
events: [
|
43
|
+
{
|
44
|
+
date: new Date().toISOString(),
|
45
|
+
text: { en: 'Something went wrong while orchestration the action' },
|
46
|
+
error: {
|
47
|
+
category: 'SERVER_ERROR',
|
48
|
+
message: error.message,
|
49
|
+
},
|
50
|
+
},
|
51
|
+
],
|
52
|
+
});
|
53
|
+
}
|
54
|
+
},
|
55
|
+
};
|
56
|
+
//# sourceMappingURL=createFlourishCustomer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createFlourishCustomer.js","sourceRoot":"","sources":["../../../../../extensions/wellinks/actions/createFlourishCustomer/createFlourishCustomer.ts"],"names":[],"mappings":";;;AAAA,mEAKsC;AAEtC,qFAAiF;AACjF,qCAIiB;AACjB,6BAAuB;AAEvB,MAAM,UAAU,GAAG;IACjB,gBAAgB,EAAE;QAChB,GAAG,EAAE,kBAAkB;QACvB,SAAS,EAAE,SAAS;KACrB;CAC4C,CAAA;AAElC,QAAA,sBAAsB,GAI/B;IACF,GAAG,EAAE,wBAAwB;IAC7B,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,4BAA4B;IACnC,WAAW,EAAE,4DAA4D;IACzE,MAAM,EAAN,eAAM;IACN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
|
package/dist/extensions/wellinks/actions/createFlourishCustomer/createFlourishCustomer.test.js
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tests_1 = require("../../../../src/tests");
|
4
|
+
const wellinksFlourishClient_1 = require("../../api/clients/__mocks__/wellinksFlourishClient");
|
5
|
+
const settings_1 = require("../../__mocks__/config/settings");
|
6
|
+
const createFlourishCustomer_1 = require("./createFlourishCustomer");
|
7
|
+
const zod_1 = require("zod");
|
8
|
+
jest.mock('../../api/clients/wellinksFlourishClient', () => ({
|
9
|
+
WellinksFlourishClient: wellinksFlourishClient_1.WellinksFlourishClient,
|
10
|
+
}));
|
11
|
+
describe('Create Flourish User', () => {
|
12
|
+
const onComplete = jest.fn();
|
13
|
+
const onError = jest.fn();
|
14
|
+
beforeEach(() => {
|
15
|
+
jest.clearAllMocks();
|
16
|
+
});
|
17
|
+
test('should throw a ZodError when the payload is invalid', async () => {
|
18
|
+
const invalidPayload = (0, tests_1.generateTestPayload)({
|
19
|
+
fields: {
|
20
|
+
firstName: undefined,
|
21
|
+
lastName: undefined,
|
22
|
+
dateOfBirth: undefined,
|
23
|
+
subgroupId: undefined,
|
24
|
+
thirdPartyIdentifier: undefined,
|
25
|
+
},
|
26
|
+
settings: settings_1.mockSettings,
|
27
|
+
});
|
28
|
+
await expect(createFlourishCustomer_1.createFlourishCustomer.onActivityCreated(invalidPayload, onComplete, onError)).rejects.toThrowError(zod_1.ZodError);
|
29
|
+
});
|
30
|
+
test('should call onComplete with a dataPoint boolean value equal to the return from the client', async () => {
|
31
|
+
const validPayload = (0, tests_1.generateTestPayload)({
|
32
|
+
fields: {
|
33
|
+
firstName: 'firstName',
|
34
|
+
lastName: 'lastName',
|
35
|
+
dateOfBirth: '2020-01-01T00:00:00Z',
|
36
|
+
subgroupId: '1234',
|
37
|
+
thirdPartyIdentifier: '1234',
|
38
|
+
},
|
39
|
+
settings: settings_1.mockSettings,
|
40
|
+
});
|
41
|
+
wellinksFlourishClient_1.WellinksFlourishClientMockImplementation.user.create.mockImplementationOnce(() => {
|
42
|
+
return true;
|
43
|
+
});
|
44
|
+
await createFlourishCustomer_1.createFlourishCustomer.onActivityCreated(validPayload, onComplete, onError);
|
45
|
+
expect(onError).not.toBeCalled();
|
46
|
+
expect(onComplete).toHaveBeenNthCalledWith(1, {
|
47
|
+
data_points: {
|
48
|
+
createSuccessful: 'true',
|
49
|
+
},
|
50
|
+
});
|
51
|
+
});
|
52
|
+
});
|
53
|
+
//# sourceMappingURL=createFlourishCustomer.test.js.map
|
package/dist/extensions/wellinks/actions/createFlourishCustomer/createFlourishCustomer.test.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createFlourishCustomer.test.js","sourceRoot":"","sources":["../../../../../extensions/wellinks/actions/createFlourishCustomer/createFlourishCustomer.test.ts"],"names":[],"mappings":";;AAAA,iDAA2D;AAC3D,+FAG2D;AAC3D,8DAA8D;AAC9D,qEAAiE;AACjE,6BAA8B;AAE9B,IAAI,CAAC,IAAI,CAAC,0CAA0C,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3D,sBAAsB,EAAtB,+CAAsB;CACvB,CAAC,CAAC,CAAA;AAEH,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IACzB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,qDAAqD,EAAE,KAAK,IAAI,EAAE;QACrE,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC;YACzC,MAAM,EAAE;gBACN,SAAS,EAAE,SAAS;gBACpB,QAAQ,EAAE,SAAS;gBACnB,WAAW,EAAE,SAAS;gBACtB,UAAU,EAAE,SAAS;gBACrB,oBAAoB,EAAE,SAAS;aAChC;YACD,QAAQ,EAAE,uBAAY;SACvB,CAAC,CAAA;QAEF,MAAM,MAAM,CACV,+CAAsB,CAAC,iBAAiB,CACtC,cAAc,EACd,UAAU,EACV,OAAO,CACR,CACF,CAAC,OAAO,CAAC,YAAY,CAAC,cAAQ,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,2FAA2F,EAAE,KAAK,IAAI,EAAE;QAC3G,MAAM,YAAY,GAAG,IAAA,2BAAmB,EAAC;YACvC,MAAM,EAAE;gBACN,SAAS,EAAE,WAAW;gBACtB,QAAQ,EAAE,UAAU;gBACpB,WAAW,EAAE,sBAAsB;gBACnC,UAAU,EAAE,MAAM;gBAClB,oBAAoB,EAAE,MAAM;aAC7B;YACD,QAAQ,EAAE,uBAAY;SACvB,CAAC,CAAA;QACF,iEAAwC,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,CACzE,GAAG,EAAE;YACH,OAAO,IAAI,CAAA;QACb,CAAC,CACF,CAAA;QAED,MAAM,+CAAsB,CAAC,iBAAiB,CAC5C,YAAY,EACZ,UAAU,EACV,OAAO,CACR,CAAA;QACD,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;QAChC,MAAM,CAAC,UAAU,CAAC,CAAC,uBAAuB,CAAC,CAAC,EAAE;YAC5C,WAAW,EAAE;gBACX,gBAAgB,EAAE,MAAM;aACzB;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -748,4 +748,112 @@ export declare const actions: {
|
|
748
748
|
description: string;
|
749
749
|
};
|
750
750
|
}, "success" | "pamLevel" | "pamScore", never>;
|
751
|
+
createFlourishCustomer: import("@awell-health/extensions-core").Action<{
|
752
|
+
firstName: {
|
753
|
+
id: string;
|
754
|
+
label: string;
|
755
|
+
description: string;
|
756
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
757
|
+
required: true;
|
758
|
+
};
|
759
|
+
lastName: {
|
760
|
+
id: string;
|
761
|
+
label: string;
|
762
|
+
description: string;
|
763
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
764
|
+
required: true;
|
765
|
+
};
|
766
|
+
dateOfBirth: {
|
767
|
+
id: string;
|
768
|
+
label: string;
|
769
|
+
description: string;
|
770
|
+
type: import("@awell-health/extensions-core").FieldType.DATE;
|
771
|
+
required: true;
|
772
|
+
};
|
773
|
+
subgroupId: {
|
774
|
+
id: string;
|
775
|
+
label: string;
|
776
|
+
description: string;
|
777
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
778
|
+
required: true;
|
779
|
+
};
|
780
|
+
thirdPartyIdentifier: {
|
781
|
+
id: string;
|
782
|
+
label: string;
|
783
|
+
description: string;
|
784
|
+
type: import("@awell-health/extensions-core").FieldType.STRING;
|
785
|
+
required: true;
|
786
|
+
};
|
787
|
+
}, {
|
788
|
+
platformApiUrl: {
|
789
|
+
key: string;
|
790
|
+
label: string;
|
791
|
+
obfuscated: false;
|
792
|
+
required: false;
|
793
|
+
description: string;
|
794
|
+
};
|
795
|
+
platformApiKey: {
|
796
|
+
key: string;
|
797
|
+
label: string;
|
798
|
+
obfuscated: true;
|
799
|
+
required: false;
|
800
|
+
description: string;
|
801
|
+
};
|
802
|
+
apiUrl: {
|
803
|
+
key: string;
|
804
|
+
label: string;
|
805
|
+
obfuscated: false;
|
806
|
+
required: true;
|
807
|
+
description: string;
|
808
|
+
};
|
809
|
+
apiKey: {
|
810
|
+
key: string;
|
811
|
+
label: string;
|
812
|
+
obfuscated: true;
|
813
|
+
required: true;
|
814
|
+
description: string;
|
815
|
+
};
|
816
|
+
selectEventTypeQuestion: {
|
817
|
+
key: string;
|
818
|
+
label: string;
|
819
|
+
obfuscated: false;
|
820
|
+
required: false;
|
821
|
+
description: string;
|
822
|
+
};
|
823
|
+
startSendingRemindersQuestions: {
|
824
|
+
key: string;
|
825
|
+
label: string;
|
826
|
+
obfuscated: false;
|
827
|
+
required: false;
|
828
|
+
description: string;
|
829
|
+
};
|
830
|
+
memberEventFormId: {
|
831
|
+
key: string;
|
832
|
+
label: string;
|
833
|
+
obfuscated: false;
|
834
|
+
required: false;
|
835
|
+
description: string;
|
836
|
+
};
|
837
|
+
flourishApiUrl: {
|
838
|
+
key: string;
|
839
|
+
label: string;
|
840
|
+
obfuscated: false;
|
841
|
+
required: false;
|
842
|
+
description: string;
|
843
|
+
};
|
844
|
+
flourishApiKey: {
|
845
|
+
key: string;
|
846
|
+
label: string;
|
847
|
+
obfuscated: true;
|
848
|
+
required: false;
|
849
|
+
description: string;
|
850
|
+
};
|
851
|
+
flourishClientExtId: {
|
852
|
+
key: string;
|
853
|
+
label: string;
|
854
|
+
obfuscated: false;
|
855
|
+
required: false;
|
856
|
+
description: string;
|
857
|
+
};
|
858
|
+
}, "createSuccessful", never>;
|
751
859
|
};
|
@@ -8,6 +8,7 @@ const checkForCheckInOverride_1 = require("./checkForCheckInOverride/checkForChe
|
|
8
8
|
const insertMemberListEvent_1 = require("./insertMemberListEvent/insertMemberListEvent");
|
9
9
|
const checkFlourishCustomer_1 = require("./checkFlourishCustomer/checkFlourishCustomer");
|
10
10
|
const submitPamSurvey_1 = require("./submitPamSurvey/submitPamSurvey");
|
11
|
+
const createFlourishCustomer_1 = require("./createFlourishCustomer/createFlourishCustomer");
|
11
12
|
exports.actions = {
|
12
13
|
checkForOverride: checkForOverride_1.checkForOverride,
|
13
14
|
checkForScheduledAppointment: checkForScheduledAppointment_1.checkForScheduledAppointment,
|
@@ -15,6 +16,7 @@ exports.actions = {
|
|
15
16
|
checkForCheckInOverride: checkForCheckInOverride_1.checkForCheckInOverride,
|
16
17
|
insertMemberListEvent: insertMemberListEvent_1.insertMemberListEvent,
|
17
18
|
checkFlourishCustomer: checkFlourishCustomer_1.checkFlourishCustomer,
|
18
|
-
submitPamSurvey: submitPamSurvey_1.submitPamSurvey
|
19
|
+
submitPamSurvey: submitPamSurvey_1.submitPamSurvey,
|
20
|
+
createFlourishCustomer: createFlourishCustomer_1.createFlourishCustomer,
|
19
21
|
};
|
20
22
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/wellinks/actions/index.ts"],"names":[],"mappings":";;;AAAA,0EAAsE;AACtE,8GAA0G;AAC1G,8DAA0D;AAC1D,+FAA2F;AAC3F,yFAAqF;AACrF,yFAAqF;AACrF,uEAAmE;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/wellinks/actions/index.ts"],"names":[],"mappings":";;;AAAA,0EAAsE;AACtE,8GAA0G;AAC1G,8DAA0D;AAC1D,+FAA2F;AAC3F,yFAAqF;AACrF,yFAAqF;AACrF,uEAAmE;AACnE,4FAAwF;AAC3E,QAAA,OAAO,GAAG;IACrB,gBAAgB,EAAhB,mCAAgB;IAChB,4BAA4B,EAA5B,2DAA4B;IAC5B,YAAY,EAAZ,2BAAY;IACZ,uBAAuB,EAAvB,iDAAuB;IACvB,qBAAqB,EAArB,6CAAqB;IACrB,qBAAqB,EAArB,6CAAqB;IACrB,eAAe,EAAf,iCAAe;IACf,sBAAsB,EAAtB,+CAAsB;CACvB,CAAA"}
|
@@ -14,7 +14,7 @@ exports.fields = {
|
|
14
14
|
adminDate: {
|
15
15
|
id: 'adminDate',
|
16
16
|
label: 'Administration Date',
|
17
|
-
description: 'The date the survey was completed.',
|
17
|
+
description: 'The date the survey was completed in YYYY-MM-DD format.',
|
18
18
|
type: extensions_core_1.FieldType.DATE,
|
19
19
|
required: true,
|
20
20
|
},
|
@@ -139,7 +139,7 @@ exports.FieldsValidationSchema = zod_1.z.object({
|
|
139
139
|
message: 'Admin date is required and must be of format YYYY-MM-DD',
|
140
140
|
}),
|
141
141
|
})
|
142
|
-
.
|
142
|
+
.datetime(),
|
143
143
|
thirdPartyIdentifier: zod_1.z.string(),
|
144
144
|
gender: zod_1.z.string(),
|
145
145
|
age: zod_1.z.number(),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/wellinks/actions/submitPamSurvey/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAAqE;AAExD,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,2CAA2C;QACxD,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EAAE,
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/wellinks/actions/submitPamSurvey/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAAqE;AAExD,QAAA,MAAM,GAAG;IACpB,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,2CAA2C;QACxD,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EAAE,yDAAyD;QACtE,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,IAAI;KACf;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,sBAAsB;QAC1B,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,2EAA2E;QAC7E,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,QAAQ;QACf,WAAW,EAAE,2DAA2D;QACxE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAA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OAAC,CAAC,MAAM,EAAE;IAChC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;CACiC,CAAC,CAAA"}
|
@@ -44,7 +44,7 @@ describe('Submit PAM Survey', () => {
|
|
44
44
|
const validPayload = (0, tests_1.generateTestPayload)({
|
45
45
|
fields: {
|
46
46
|
language: 'en',
|
47
|
-
adminDate: '
|
47
|
+
adminDate: '2020-01-01T00:00:00Z',
|
48
48
|
thirdPartyIdentifier: 'identifier',
|
49
49
|
gender: 'male',
|
50
50
|
age: 25,
|
@@ -85,7 +85,7 @@ describe('Submit PAM Survey', () => {
|
|
85
85
|
const validPayload = (0, tests_1.generateTestPayload)({
|
86
86
|
fields: {
|
87
87
|
language: 'en',
|
88
|
-
adminDate: '
|
88
|
+
adminDate: '2020-01-01T00:00:00Z',
|
89
89
|
thirdPartyIdentifier: 'identifier',
|
90
90
|
gender: 'male',
|
91
91
|
age: 25,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"submitPamSurvey.test.js","sourceRoot":"","sources":["../../../../../extensions/wellinks/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CAAA;IAClC,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,+FAA+F,EAAE,KAAK,IAAI,EAAE;QAC/G,MAAM,YAAY,GAAG,IAAA,2BAAmB,EAAC;YACvC,MAAM,EAAE;gBACN,QAAQ,EAAE,IAAI;gBACd,SAAS,EAAE,
|
1
|
+
{"version":3,"file":"submitPamSurvey.test.js","sourceRoot":"","sources":["../../../../../extensions/wellinks/actions/submitPamSurvey/submitPamSurvey.test.ts"],"names":[],"mappings":";;AAAA,iDAA2D;AAC3D,+FAG2D;AAE3D,8DAA8D;AAC9D,uDAAmD;AACnD,6BAA8B;AAE9B,IAAI,CAAC,IAAI,CAAC,0CAA0C,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3D,sBAAsB,EAAtB,+CAAsB;CACvB,CAAC,CAAC,CAAA;AAEH,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAC5B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IACzB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;QACjF,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC;YACzC,MAAM,EAAE;gBACN,QAAQ,EAAE,SAAS;gBACnB,SAAS,EAAE,SAAS;gBACpB,oBAAoB,EAAE,SAAS;gBAC/B,MAAM,EAAE,SAAS;gBACjB,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,SAAS;gBACd,IAAI,EAAE,SAA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AE,YAAY;qBACtB;iBACF,CAAC;aACH,CAAC;SACH,CAAC,CAAA;QACF,MAAM,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -5,6 +5,7 @@ export declare class WellinksFlourishClient {
|
|
5
5
|
private readonly _clientextid;
|
6
6
|
constructor(apiUrl: string, apiKey: string, clientextid: string);
|
7
7
|
readonly user: {
|
8
|
+
create: (firstName: string, lastName: string, dateOfBirth: string, subgroupId: string, thirdPartyIdentifier: string) => Promise<boolean>;
|
8
9
|
exists: (identifier: string) => Promise<boolean>;
|
9
10
|
};
|
10
11
|
readonly survey: {
|
@@ -33,6 +33,33 @@ const lodash_1 = require("lodash");
|
|
33
33
|
class WellinksFlourishClient {
|
34
34
|
constructor(apiUrl, apiKey, clientextid) {
|
35
35
|
this.user = {
|
36
|
+
create: async (firstName, lastName, dateOfBirth, subgroupId, thirdPartyIdentifier) => {
|
37
|
+
try {
|
38
|
+
const response = await (0, node_fetch_1.default)(`${this._apiUrl}/enrolluser`, {
|
39
|
+
method: 'POST',
|
40
|
+
body: buildCreateUserRequest(this._clientextid, this._apiKey, firstName, lastName, dateOfBirth, subgroupId, thirdPartyIdentifier),
|
41
|
+
headers: {
|
42
|
+
contentType: 'text/xml',
|
43
|
+
accept: 'application/xml',
|
44
|
+
},
|
45
|
+
});
|
46
|
+
const xml = await response.text();
|
47
|
+
return await new Promise((resolve, reject) => {
|
48
|
+
xml2js.parseString(xml, (err, result) => {
|
49
|
+
if (!(0, lodash_1.isNil)(err)) {
|
50
|
+
reject(err);
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
resolve(result.RegisterResponseData.StatusCode[0] === 'Success_Register');
|
54
|
+
}
|
55
|
+
});
|
56
|
+
});
|
57
|
+
}
|
58
|
+
catch (err) {
|
59
|
+
const error = err;
|
60
|
+
throw Error(`Node Fetch failed: ${error.message}`);
|
61
|
+
}
|
62
|
+
},
|
36
63
|
exists: async (identifier) => {
|
37
64
|
try {
|
38
65
|
const response = await (0, node_fetch_1.default)(`${this._apiUrl}/checkifuserexists`, {
|
@@ -118,6 +145,23 @@ function buildCheckIfUserExistsRequest(identifier, clientextid, apiKey) {
|
|
118
145
|
</request>
|
119
146
|
`;
|
120
147
|
}
|
148
|
+
function buildCreateUserRequest(clientextid, apiKey, firstName, lastName, dateOfBirth, subgroupId, thirdPartyIdentifier) {
|
149
|
+
const date = new Date(dateOfBirth);
|
150
|
+
return `
|
151
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
152
|
+
<request>
|
153
|
+
<user>
|
154
|
+
<clientextid>${clientextid}</clientextid> <!--- required -->
|
155
|
+
<clientpasskey>${apiKey}</clientpasskey> <!--- required -->
|
156
|
+
<subgroupextid>${subgroupId}</subgroupextid > <!--- required -->
|
157
|
+
<thirdpartyidentifier>${thirdPartyIdentifier}</thirdpartyidentifier> <!--- required -->
|
158
|
+
<firstname>${firstName}</firstname>
|
159
|
+
<lastname>${lastName}</lastname>
|
160
|
+
<dob day=${date.getDate()} month=${date.getMonth()} year=${date.getFullYear()}/>
|
161
|
+
</user>
|
162
|
+
</request>
|
163
|
+
`;
|
164
|
+
}
|
121
165
|
function buildSubmitPamSurveyRequest(clientextid, apiKey, language, adminDate, thirdPartyIdentifier, gender, age, pa1, pa2, pa3, pa4, pa5, pa6, pa7, pa8, pa9, pa10, pa11, pa12, pa13) {
|
122
166
|
const adminDateValue = new Date(adminDate);
|
123
167
|
return `
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"wellinksFlourishClient.js","sourceRoot":"","sources":["../../../../../extensions/wellinks/api/clients/wellinksFlourishClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA8B;AAC9B,+CAAgC;AAChC,mCAA8B;AAE9B,MAAa,sBAAsB;IAKjC,YAAY,MAAc,EAAE,MAAc,EAAE,WAAmB;QAMtD,SAAI,GAAG;Y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CAAC,CAAC,IAAI,CAAC,IAAI,CACtE,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CACxC,CAAC,CAAC,CAAC,KAAK;oCACX,QAAQ,EACN,CAAC,MAAM,CAAC,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CACtE,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,UAAU,CACxC,CAAC,CAAC,CAAC,KAAK;iCACZ,CAAC,CAAA;6BACH;wBACH,CAAC,CAAC,CAAA;oBACJ,CAAC,CAAC,CAAA;iBACH;gBAAC,OAAO,GAAG,EAAE;oBACZ,MAAM,KAAK,GAAG,GAAY,CAAA;oBAC1B,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;iBACvD;YACH,CAAC;SACF,CAAA;
|
1
|
+
{"version":3,"file":"wellinksFlourishClient.js","sourceRoot":"","sources":["../../../../../extensions/wellinks/api/clients/wellinksFlourishClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA8B;AAC9B,+CAAgC;AAChC,mCAA8B;AAE9B,MAAa,sBAAsB;IAKjC,YAAY,MAAc,EAAE,MAAc,EAAE,WAAmB;QAMtD,SAAI,GAAG;YACd,MAAM,EAAE,KAAK,EACX,SAAiB,EACjB,QAAgB,EAChB,WAAmB,EACnB,UAAkB,EAClB,oBAA4B,EACV,EAAE;gBACpB,IAAI;oBACF,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,GAAG,IAAI,CAAC,OAAO,aAAa,EAAE;wBACzD,MAAM,EAAE,MAAM;wBACd,IAAI,EAAE,sBAAsB,CAC1B,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,OAAO,EACZ,SAAS,EACT,QAAQ,EACR,WAAW,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,cAAc,CAAC,OAAO,EAAE,UAAU,cAAc,CAAC,QAAQ,EAAE,SAAS,cAAc,CAAC,WAAW,EAAE;8BAC5F,GAAG,WAAW,MAAM;2BACvB,GAAG;2BACH,GAAG;2BACH,GAAG;2BACH,GAAG;2BACH,GAAG;2BACH,GAAG;2BACH,GAAG;2BACH,GAAG;2BACH,GAAG;4BACF,IAAI;4BACJ,IAAI;4BACJ,IAAI;4BACJ,IAAI;;;;GAI7B,CAAA;AACH,CAAC"}
|
@@ -15,121 +15,177 @@ describe('WellinksFlourishClient', () => {
|
|
15
15
|
beforeEach(() => {
|
16
16
|
jest.clearAllMocks();
|
17
17
|
});
|
18
|
-
describe('user
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
describe('user', () => {
|
19
|
+
describe('exists', () => {
|
20
|
+
test('should return true when the StatusMessage is affirmative.', async () => {
|
21
|
+
const properResponse = `
|
22
|
+
<UserExistsResponseData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
23
|
+
<StatusCode>Success_ExternalIdentifier</StatusCode>
|
24
|
+
<StatusMessage>User with external identifier exists.</StatusMessage>
|
25
|
+
<ExternalUserID>230905-OV92CZDC</ExternalUserID>
|
26
|
+
<NationalPatientIdentifier i:nil="true"/>
|
27
|
+
<ThirdPartyIdentifier>18071982001</ThirdPartyIdentifier>
|
28
|
+
<UserName i:nil="true"/>
|
29
|
+
</UserExistsResponseData>`;
|
30
|
+
node_fetch_1.default.mockResolvedValue(new Response(properResponse, {
|
31
|
+
url: 'url',
|
32
|
+
status: 200,
|
33
|
+
statusText: 'OK',
|
34
|
+
headers: {
|
35
|
+
'Content-Type': 'application/xml', // Specify the content type as XML
|
36
|
+
},
|
37
|
+
}));
|
38
|
+
const result = await wellinksFlourishClient.user.exists('identifier');
|
39
|
+
expect(result).toBe(true);
|
40
|
+
});
|
41
|
+
test('should return false when the StatusMessage is negative.', async () => {
|
42
|
+
const properResponse = `
|
43
|
+
<UserExistsResponseData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
44
|
+
<StatusCode>Success_ExternalIdentifier</StatusCode>
|
45
|
+
<StatusMessage>User with external identifier doesn't exist or invalid.</StatusMessage>
|
46
|
+
<ExternalUserID>230905-OV92CZDC</ExternalUserID>
|
47
|
+
<NationalPatientIdentifier i:nil="true"/>
|
48
|
+
<ThirdPartyIdentifier>18071982001</ThirdPartyIdentifier>
|
49
|
+
<UserName i:nil="true"/>
|
50
|
+
</UserExistsResponseData>`;
|
51
|
+
node_fetch_1.default.mockResolvedValue(new Response(properResponse, {
|
52
|
+
url: 'url',
|
53
|
+
status: 200,
|
54
|
+
statusText: 'OK',
|
55
|
+
headers: {
|
56
|
+
'Content-Type': 'application/xml', // Specify the content type as XML
|
57
|
+
},
|
58
|
+
}));
|
59
|
+
const result = await wellinksFlourishClient.user.exists('identifier');
|
60
|
+
expect(result).toBe(false);
|
61
|
+
});
|
62
|
+
test('should throw an error when node-fetch fails', async () => {
|
63
|
+
;
|
64
|
+
node_fetch_1.default.mockImplementation(() => {
|
65
|
+
throw new Error('something went wrong');
|
66
|
+
});
|
67
|
+
await expect(wellinksFlourishClient.user.exists('identifier')).rejects.toThrowError(Error('Node Fetch failed: something went wrong'));
|
68
|
+
});
|
69
|
+
});
|
70
|
+
describe('create', () => {
|
71
|
+
test('should return true when the StatusCode is affirmative', async () => {
|
72
|
+
const positiveResponse = `
|
73
|
+
<RegisterResponseData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
74
|
+
<StatusCode>Success_Register</StatusCode>
|
75
|
+
<StatusMessage>User successfully registered.</StatusMessage>
|
76
|
+
<ExternalUserID>230919-HQXTAR2E</ExternalUserID>
|
25
77
|
<NationalPatientIdentifier i:nil="true"/>
|
26
|
-
<ThirdPartyIdentifier>
|
78
|
+
<ThirdPartyIdentifier>180719827444001</ThirdPartyIdentifier>
|
27
79
|
<UserName i:nil="true"/>
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
<
|
45
|
-
<
|
80
|
+
</RegisterResponseData>
|
81
|
+
`;
|
82
|
+
node_fetch_1.default.mockResolvedValue(new Response(positiveResponse, {
|
83
|
+
url: 'url',
|
84
|
+
status: 200,
|
85
|
+
statusText: 'OK',
|
86
|
+
headers: {
|
87
|
+
'Content-Type': 'application/xml', // Specify the content type as XML
|
88
|
+
},
|
89
|
+
}));
|
90
|
+
const result = await wellinksFlourishClient.user.create('firstName', 'lastName', 'September 8th, 2000', '1234', '1234');
|
91
|
+
expect(result).toEqual(true);
|
92
|
+
});
|
93
|
+
test('should return false when the statusCode is not affirmative', async () => {
|
94
|
+
const negativeResponse = `
|
95
|
+
<RegisterResponseData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
96
|
+
<StatusCode>Error_DuplicatePrimaryEmail</StatusCode>
|
97
|
+
<StatusMessage>Email is either duplicate or invalid.</StatusMessage>
|
98
|
+
<ExternalUserID i:nil="true"/>
|
46
99
|
<NationalPatientIdentifier i:nil="true"/>
|
47
|
-
<ThirdPartyIdentifier
|
100
|
+
<ThirdPartyIdentifier i:nil="true"/>
|
48
101
|
<UserName i:nil="true"/>
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
102
|
+
</RegisterResponseData>`;
|
103
|
+
node_fetch_1.default.mockResolvedValue(new Response(negativeResponse, {
|
104
|
+
url: 'url',
|
105
|
+
status: 200,
|
106
|
+
statusText: 'OK',
|
107
|
+
headers: {
|
108
|
+
'Content-Type': 'application/xml', // Specify the content type as XML
|
109
|
+
},
|
110
|
+
}));
|
111
|
+
const result = await wellinksFlourishClient.user.create('firstName', 'lastName', 'September 8th, 2000', '1234', '1234');
|
112
|
+
expect(result).toEqual(false);
|
113
|
+
});
|
114
|
+
test('should throw an error when node-fetch fails', async () => {
|
115
|
+
;
|
116
|
+
node_fetch_1.default.mockImplementation(() => {
|
117
|
+
throw new Error('something went wrong');
|
118
|
+
});
|
119
|
+
await expect(wellinksFlourishClient.user.create('firstName', 'lastName', 'September 8th, 2000', '1234', '1234')).rejects.toThrowError(Error('Node Fetch failed: something went wrong'));
|
65
120
|
});
|
66
|
-
await expect(wellinksFlourishClient.user.exists('identifier')).rejects.toThrowError(Error('Node Fetch failed: something went wrong'));
|
67
121
|
});
|
68
122
|
});
|
69
123
|
describe('survey submit', () => {
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
124
|
+
describe('submit', () => {
|
125
|
+
test('should return a FlourishSubmitPamSurveyResponse object on success', async () => {
|
126
|
+
const properResponse = `
|
127
|
+
<UserSurveyResponseData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
128
|
+
<StatusCode>Success_SurveySubmit</StatusCode>
|
129
|
+
<StatusMessage>Submit User Survey success.</StatusMessage>
|
130
|
+
<ExternalUserID>230905-OV92CZDC</ExternalUserID>
|
131
|
+
<NationalPatientIdentifier i:nil="true"/>
|
132
|
+
<SurveyEnteredDateTime>2023-09-05T00:00:00</SurveyEnteredDateTime>
|
133
|
+
<SurveyName>PAM13_S</SurveyName>
|
134
|
+
<SurveyResult>
|
135
|
+
<ResponseData>
|
136
|
+
<Type id="PAMLevel" value="1"/>
|
137
|
+
<Type id="PAMScore" value="38.10"/>
|
138
|
+
</ResponseData>
|
139
|
+
</SurveyResult>
|
140
|
+
<ThirdPartyIdentifier i:nil="true"/>
|
141
|
+
<UserName i:nil="true"/>
|
142
|
+
</UserSurveyResponseData>
|
143
|
+
`;
|
144
|
+
node_fetch_1.default.mockResolvedValue(new Response(properResponse, {
|
145
|
+
url: 'url',
|
146
|
+
status: 200,
|
147
|
+
statusText: 'OK',
|
148
|
+
headers: {
|
149
|
+
'Content-Type': 'application/xml', // Specify the content type as XML
|
150
|
+
},
|
151
|
+
}));
|
152
|
+
const result = await wellinksFlourishClient.survey.submit('en', '2023-09-18', 'thirdpartyIdentifier', 'male', 22, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13);
|
153
|
+
expect(result).toEqual({
|
154
|
+
success: true,
|
155
|
+
pamLevel: 1,
|
156
|
+
pamScore: 38.1,
|
157
|
+
});
|
102
158
|
});
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
159
|
+
test('should throw an error if node-fetch fails', async () => {
|
160
|
+
;
|
161
|
+
node_fetch_1.default.mockImplementation(() => {
|
162
|
+
throw new Error('something went wrong');
|
163
|
+
});
|
164
|
+
await expect(wellinksFlourishClient.survey.submit('en', Date().toString(), 'thirdpartyIdentifier', 'male', 22, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)).rejects.toThrowError(Error('Node Fetch failed: something went wrong'));
|
165
|
+
});
|
166
|
+
test('should throw an error if the StatusCode is not affirmative', async () => {
|
167
|
+
const wrongResponse = `
|
168
|
+
<UserSurveyResponseData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
169
|
+
<StatusCode>Error_InvalidUserCredential</StatusCode>
|
170
|
+
<StatusMessage>Sorry. We could not find user with the specified credentials.</StatusMessage>
|
171
|
+
<ExternalUserID i:nil="true"/>
|
172
|
+
<NationalPatientIdentifier i:nil="true"/>
|
173
|
+
<SurveyEnteredDateTime>2023-09-05T00:00:00</SurveyEnteredDateTime>
|
174
|
+
<SurveyName>PAM13_S</SurveyName>
|
175
|
+
<SurveyResult i:nil="true"/>
|
176
|
+
<ThirdPartyIdentifier i:nil="true"/>
|
177
|
+
<UserName i:nil="true"/>
|
178
|
+
</UserSurveyResponseData>`;
|
179
|
+
node_fetch_1.default.mockResolvedValue(new Response(wrongResponse, {
|
180
|
+
url: 'url',
|
181
|
+
status: 200,
|
182
|
+
statusText: 'OK',
|
183
|
+
headers: {
|
184
|
+
'Content-Type': 'application/xml', // Specify the content type as XML
|
185
|
+
},
|
186
|
+
}));
|
187
|
+
await expect(wellinksFlourishClient.survey.submit('en', Date().toString(), 'thirdpartyIdentifier', 'male', 22, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)).rejects.toThrowError(Error('Node Fetch failed: Survey was not correctly submitted'));
|
108
188
|
});
|
109
|
-
await expect(wellinksFlourishClient.survey.submit('en', '2023-09-18', 'thirdpartyIdentifier', 'male', 22, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)).rejects.toThrowError(Error('Node Fetch failed: something went wrong'));
|
110
|
-
});
|
111
|
-
test('should throw an error if the StatusCode is not affirmative', async () => {
|
112
|
-
const wrongResponse = `
|
113
|
-
<UserSurveyResponseData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
|
114
|
-
<StatusCode>Error_InvalidUserCredential</StatusCode>
|
115
|
-
<StatusMessage>Sorry. We could not find user with the specified credentials.</StatusMessage>
|
116
|
-
<ExternalUserID i:nil="true"/>
|
117
|
-
<NationalPatientIdentifier i:nil="true"/>
|
118
|
-
<SurveyEnteredDateTime>2023-09-05T00:00:00</SurveyEnteredDateTime>
|
119
|
-
<SurveyName>PAM13_S</SurveyName>
|
120
|
-
<SurveyResult i:nil="true"/>
|
121
|
-
<ThirdPartyIdentifier i:nil="true"/>
|
122
|
-
<UserName i:nil="true"/>
|
123
|
-
</UserSurveyResponseData>`;
|
124
|
-
node_fetch_1.default.mockResolvedValue(new Response(wrongResponse, {
|
125
|
-
url: 'url',
|
126
|
-
status: 200,
|
127
|
-
statusText: 'OK',
|
128
|
-
headers: {
|
129
|
-
'Content-Type': 'application/xml', // Specify the content type as XML
|
130
|
-
},
|
131
|
-
}));
|
132
|
-
await expect(wellinksFlourishClient.survey.submit('en', '2023-09-18', 'thirdpartyIdentifier', 'male', 22, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)).rejects.toThrowError(Error('Node Fetch failed: Survey was not correctly submitted'));
|
133
189
|
});
|
134
190
|
});
|
135
191
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"wellinksFlourishClient.test.js","sourceRoot":"","sources":["../../../../../extensions/wellinks/api/test/wellinksFlourishClient.test.ts"],"names":[],"mappings":";;;;;AAAA,8EAA0E;AAC1E,4DAA8B;AAC9B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;AAEvB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;AAErD,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,MAAM,MAAM,GAAG,QAAQ,CAAA;IACvB,MAAM,MAAM,GAAG,QAAQ,CAAA;IACvB,MAAM,WAAW,GAAG,aAAa,CAAA;IACjC,MAAM,sBAAsB,GAAG,IAAI,+CAAsB,CACvD,MAAM,EACN,MAAM,EACN,WAAW,CACZ,CAAA;IACD,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,
|
1
|
+
{"version":3,"file":"wellinksFlourishClient.test.js","sourceRoot":"","sources":["../../../../../extensions/wellinks/api/test/wellinksFlourishClient.test.ts"],"names":[],"mappings":";;;;;AAAA,8EAA0E;AAC1E,4DAA8B;AAC9B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;AAEvB,MAAM,EAAE,QAAQ,EAAE,GAAG,IA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