@awell-health/awell-extensions 2.0.112 → 2.0.114
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/collectData/v1/actions/remoteSingleSelect/config/dataPoint.d.ts +4 -0
- package/dist/extensions/collectData/v1/actions/remoteSingleSelect/config/dataPoint.js +4 -0
- package/dist/extensions/collectData/v1/actions/remoteSingleSelect/config/dataPoint.js.map +1 -1
- package/dist/extensions/collectData/v1/actions/remoteSingleSelect/config/fields.js +1 -1
- package/dist/extensions/collectData/v1/actions/remoteSingleSelect/config/fields.js.map +1 -1
- package/dist/extensions/collectData/v1/actions/remoteSingleSelect/remoteSingleSelect.js +4 -39
- package/dist/extensions/collectData/v1/actions/remoteSingleSelect/remoteSingleSelect.js.map +1 -1
- package/dist/extensions/markdown.json +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dataPoint.js","sourceRoot":"","sources":["../../../../../../../extensions/collectData/v1/actions/remoteSingleSelect/config/dataPoint.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,KAAK,EAAE;QACL,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,QAAQ;KACpB;IACD,KAAK,EAAE;QACL,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA"}
|
1
|
+
{"version":3,"file":"dataPoint.js","sourceRoot":"","sources":["../../../../../../../extensions/collectData/v1/actions/remoteSingleSelect/config/dataPoint.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,KAAK,EAAE;QACL,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,QAAQ;KACpB;IACD,KAAK,EAAE;QACL,GAAG,EAAE,OAAO;QACZ,SAAS,EAAE,QAAQ;KACpB;IACD,cAAc,EAAE;QACd,GAAG,EAAE,gBAAgB;QACrB,SAAS,EAAE,MAAM;KAClB;CAC4C,CAAA"}
|
@@ -42,7 +42,7 @@ exports.fields = {
|
|
42
42
|
},
|
43
43
|
};
|
44
44
|
exports.FieldsValidationSchema = zod_1.z.object({
|
45
|
-
label: zod_1.z.string().
|
45
|
+
label: zod_1.z.string().min(1),
|
46
46
|
url: zod_1.z.string().url(),
|
47
47
|
headers: (0, extensions_core_1.makeStringOptional)(validation_1.JsonStringValidationSchema),
|
48
48
|
queryParam: (0, extensions_core_1.makeStringOptional)(zod_1.z.string()),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../../extensions/collectData/v1/actions/remoteSingleSelect/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAIsC;AACtC,sEAAkF;AAErE,QAAA,MAAM,GAAG;IACpB,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,kEAAkE;QACpE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,6BAA6B;QACpC,WAAW,EAAE,mDAAmD;QAChE,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,IAAI;KACf;IACD,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,8LAA8L;QAChM,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EACT,0FAA0F;QAC5F,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,KAAK;KAChB;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,8BAA8B;QACrC,WAAW,EACT,6IAA6I;QAC/I,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../../extensions/collectData/v1/actions/remoteSingleSelect/config/fields.ts"],"names":[],"mappings":";;;AAAA,6BAAwC;AACxC,mEAIsC;AACtC,sEAAkF;AAErE,QAAA,MAAM,GAAG;IACpB,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,kEAAkE;QACpE,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,6BAA6B;QACpC,WAAW,EAAE,mDAAmD;QAChE,IAAI,EAAE,2BAAS,CAAC,OAAO;QACvB,QAAQ,EAAE,IAAI;KACf;IACD,GAAG,EAAE;QACH,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,8LAA8L;QAChM,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,IAAI;KACf;IACD,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EACT,0FAA0F;QAC5F,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,KAAK;KAChB;IACD,UAAU,EAAE;QACV,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,8BAA8B;QACrC,WAAW,EACT,6IAA6I;QAC/I,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACrB,OAAO,EAAE,IAAA,oCAAkB,EAAC,uCAA0B,CAAC;IACvD,UAAU,EAAE,IAAA,oCAAkB,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC;IAC1C,SAAS,EAAE,OAAC,CAAC,OAAO,EAAE;CAC2B,CAAC,CAAA;AAE7C,MAAM,oBAAoB,GAAG,CAClC,MAAe,EACyB,EAAE;IAC1C,MAAM,UAAU,GAAG,8BAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAEvD,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AANY,QAAA,oBAAoB,wBAMhC"}
|
@@ -4,8 +4,6 @@ exports.remoteSingleSelect = void 0;
|
|
4
4
|
const config_1 = require("./config");
|
5
5
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
6
6
|
const fields_1 = require("./config/fields");
|
7
|
-
const zod_validation_error_1 = require("zod-validation-error");
|
8
|
-
const zod_1 = require("zod");
|
9
7
|
exports.remoteSingleSelect = {
|
10
8
|
key: 'remoteSingleSelect',
|
11
9
|
title: 'Dynamic choice selector',
|
@@ -21,43 +19,10 @@ exports.remoteSingleSelect = {
|
|
21
19
|
},
|
22
20
|
previewable: false,
|
23
21
|
onActivityCreated: async (payload, onComplete, onError) => {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
*/
|
29
|
-
}
|
30
|
-
catch (err) {
|
31
|
-
if (err instanceof zod_1.ZodError) {
|
32
|
-
const error = (0, zod_validation_error_1.fromZodError)(err);
|
33
|
-
await onError({
|
34
|
-
events: [
|
35
|
-
{
|
36
|
-
date: new Date().toISOString(),
|
37
|
-
text: { en: error.name },
|
38
|
-
error: {
|
39
|
-
category: 'WRONG_INPUT',
|
40
|
-
message: `${error.message}`,
|
41
|
-
},
|
42
|
-
},
|
43
|
-
],
|
44
|
-
});
|
45
|
-
return;
|
46
|
-
}
|
47
|
-
const error = err;
|
48
|
-
await onError({
|
49
|
-
events: [
|
50
|
-
{
|
51
|
-
date: new Date().toISOString(),
|
52
|
-
text: { en: 'Something went wrong while orchestrating the action' },
|
53
|
-
error: {
|
54
|
-
category: 'SERVER_ERROR',
|
55
|
-
message: error.message,
|
56
|
-
},
|
57
|
-
},
|
58
|
-
],
|
59
|
-
});
|
60
|
-
}
|
22
|
+
(0, fields_1.validateActionFields)(payload.fields);
|
23
|
+
/**
|
24
|
+
* Completion happens in Awell Hosted Pages
|
25
|
+
*/
|
61
26
|
},
|
62
27
|
};
|
63
28
|
//# sourceMappingURL=remoteSingleSelect.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"remoteSingleSelect.js","sourceRoot":"","sources":["../../../../../../extensions/collectData/v1/actions/remoteSingleSelect/remoteSingleSelect.ts"],"names":[],"mappings":";;;AACA,qCAA6C;AAC7C,mEAAwD;AAExD,4CAAsD;
|
1
|
+
{"version":3,"file":"remoteSingleSelect.js","sourceRoot":"","sources":["../../../../../../extensions/collectData/v1/actions/remoteSingleSelect/remoteSingleSelect.ts"],"names":[],"mappings":";;;AACA,qCAA6C;AAC7C,mEAAwD;AAExD,4CAAsD;AAEzC,QAAA,kBAAkB,GAA2C;IACxE,GAAG,EAAE,oBAAoB;IACzB,KAAK,EAAE,yBAAyB;IAChC,WAAW,EACT,+IAA+I;IACjJ,QAAQ,EAAE,0BAAQ,CAAC,KAAK;IACxB,MAAM,EAAN,eAAM;IACN,UAAU,EAAV,mBAAU;IACV,OAAO,EAAE;QACP,YAAY,EAAE;YACZ,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,QAAQ;SACf;KACF;IACD,WAAW,EAAE,KAAK;IAClB,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;QACxD,IAAA,6BAAoB,EAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAEpC;;WAEG;IACL,CAAC;CACF,CAAA"}
|
@@ -32,7 +32,7 @@
|
|
32
32
|
"changelog": "# CM.com changelog\n"
|
33
33
|
},
|
34
34
|
"collectData": {
|
35
|
-
"readme": "---\ntitle: Advanced data collection\ndescription: Collect data from your users using a variety of input types and data sources\n---\n\nThis extension allows you to collect data from your users using a variety of more advanced input types and data sources.\n\n## Extension settings\n\nIn order to set up this extension, no settings are required.\n\n## Custom Actions\n\n### Dynamic choice selector\n\nStandard select questions in Awell forms have a discrete set of choices to select from that are defined at the time that the form is created. If the list of choices to present to your responders isn't known at the time the form is being built, or changes often, this action allows you to load choices dynamically from a remote data source.\n\nDynamically-loaded choices must adhere to the following format in a list form (i.e. an array):\n\n```json\n
|
35
|
+
"readme": "---\ntitle: Advanced data collection\ndescription: Collect data from your users using a variety of input types and data sources\n---\n\nThis extension allows you to collect data from your users using a variety of more advanced input types and data sources.\n\n## Extension settings\n\nIn order to set up this extension, no settings are required.\n\n## Custom Actions\n\n### Dynamic choice selector\n\nStandard select questions in Awell forms have a discrete set of choices to select from that are defined at the time that the form is created. If the list of choices to present to your responders isn't known at the time the form is being built, or changes often, this action allows you to load choices dynamically from a remote data source.\n\nDynamically-loaded choices must minimally adhere to the following format in a list form (i.e. an array):\n\n```json\n[\n {\n \"id\": \"unique-id-1\",\n \"label\": \"Choice label 1\",\n \"value\": \"Choice value 1\"\n },\n {\n \"id\": \"unique-id-2\",\n \"label\": \"Choice label 2\",\n \"value\": \"Choice value 2\"\n }\n]\n```\n\nThe `id`, `label`, and `value` fields are required. However, additional fields can be added to the object. Besides the `label` and `value`, which are available as distinct data points, the additional data of the selected choice will also be returned as a data point.\n\nExample:\n\n```json\n[\n {\n \"id\": \"unique-id-1\",\n \"label\": \"Choice label 1\",\n \"value\": \"Choice value 1\",\n \"additionalData\": \"Additional data\",\n \"nestedData\": {\n \"nested\": \"value\"\n }\n }\n]\n```\n\nAdditionally, you can specify a free text search field (`Options - Search query param` field) to allow users to search through the choices. This is optional but highly recommended. If not specified, the choices will be fetched on question load and presented in a static list that cannot be filtered.\n\nAs an example, using the endpoint `https://example.com/choices` with a query parameter `search` (e.g. `https://example.com/choices?search=QUERY` where `QUERY` is whatever the user typed into the input), then the API is expected to return the choices based on that match the search term.\n\nWe recommend that your search logic returns an _alphabetically-sorted_ list of all options where the _lowercase_ label names _contain_ the _lowercase_ search term.\n\n```js\n// Example search logic\nconst searchTerm = req.query.search\nconst results = []\n\noptions.forEach((option) => {\n if (option.label.toLowerCase().includes(searchTerm.toLowerCase())) {\n results.push({\n label: option.label,\n value: option.value,\n id: option.id,\n })\n }\n})\n\nconst sortedResults = results.sort((a, b) => a.label.localeCompare(b.label))\nres.json(results)\n```\n\n### Collect medication\n\nThis action enables patients to list their medications. They can add multiple medications, providing the name, dosage, and any specific instructions for each one.\n",
|
36
36
|
"changelog": "# Collect Data changelog\n"
|
37
37
|
},
|
38
38
|
"dockHealth": {
|