fluent-cerner-js 0.3.4-alpha.0 → 0.6.0-alpha.0

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 (30) hide show
  1. package/dist/fluent-cerner-js.cjs.development.js +79 -39
  2. package/dist/fluent-cerner-js.cjs.development.js.map +1 -1
  3. package/dist/fluent-cerner-js.cjs.production.min.js +1 -1
  4. package/dist/fluent-cerner-js.cjs.production.min.js.map +1 -1
  5. package/dist/fluent-cerner-js.esm.js +79 -39
  6. package/dist/fluent-cerner-js.esm.js.map +1 -1
  7. package/dist/functional/launchClinicalNote.d.ts +41 -17
  8. package/dist/functional/launchPowerForm.d.ts +18 -16
  9. package/dist/functional/launchPowerNote.d.ts +17 -6
  10. package/dist/functional/makeCclRequest.d.ts +2 -0
  11. package/dist/functional/openOrganizerTab.d.ts +4 -1
  12. package/dist/functional/openPatientTab.d.ts +10 -5
  13. package/dist/functional/orderString.d.ts +14 -5
  14. package/dist/functional/submitOrders.d.ts +16 -7
  15. package/package.json +1 -1
  16. package/src/functional/launchClinicalNote.spec.ts +70 -10
  17. package/src/functional/launchClinicalNote.ts +55 -28
  18. package/src/functional/launchPowerForm.spec.ts +25 -1
  19. package/src/functional/launchPowerForm.ts +18 -17
  20. package/src/functional/launchPowerNote.spec.ts +22 -12
  21. package/src/functional/launchPowerNote.ts +28 -11
  22. package/src/functional/makeCclRequest.ts +2 -0
  23. package/src/functional/openOrganizerTab.spec.ts +13 -2
  24. package/src/functional/openOrganizerTab.ts +9 -5
  25. package/src/functional/openPatientTab.spec.ts +17 -2
  26. package/src/functional/openPatientTab.ts +17 -10
  27. package/src/functional/orderString.ts +14 -5
  28. package/src/functional/submitOrders.spec.ts +16 -16
  29. package/src/functional/submitOrders.ts +24 -11
  30. package/src/utils/outsideOfPowerChartError.ts +2 -0
@@ -9,7 +9,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
9
9
  * from being outside of Cerner PowerChart.
10
10
  */
11
11
  function outsideOfPowerChartError(e) {
12
- return e instanceof TypeError && e.message === 'window.MPAGES_EVENT is not a function' || e instanceof TypeError && e.message === 'window.XMLCclRequest is not a function' || e instanceof ReferenceError && e.message === 'window is not defined';
12
+ return e instanceof TypeError && e.message === 'window.MPAGES_EVENT is not a function' || e instanceof TypeError && e.message === 'window.XMLCclRequest is not a function' || e instanceof TypeError && e.message === 'window.APPLINK is not a function' || e instanceof ReferenceError && e.message === 'window is not defined';
13
13
  }
14
14
 
15
15
  var warnAttemptedOrdersOutsideOfPowerChart = function warnAttemptedOrdersOutsideOfPowerChart(eventString) {
@@ -17,29 +17,33 @@ var warnAttemptedOrdersOutsideOfPowerChart = function warnAttemptedOrdersOutside
17
17
  };
18
18
 
19
19
  /**
20
- * A function to launch a clinical note, which returns an object of `MPageEventReturn`
20
+ * Launch a ClinicalNote in Cerner's PowerChart.
21
21
  * @param {ClinicalNoteOpts} opts - The parameters passed, as specified in `ClinicalNoteOpts`
22
22
  * @returns {MPageEventReturn} - An object containing the `eventString` and `inPowerChart` values.
23
+ *
24
+ * @documentation [MPAGES_EVENT - CLINICAL NOTE](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+CLINICALNOTE)
23
25
  **/
24
26
  var launchClinicalNote = function launchClinicalNote(opts) {
25
27
  var personId = opts.personId,
26
28
  encounterId = opts.encounterId,
27
29
  eventIds = opts.eventIds,
28
30
  windowTitle = opts.windowTitle,
29
- viewOptionFlags = opts.viewOptionFlags,
30
- viewName = opts.viewName,
31
- viewSeq = opts.viewSeq,
32
- compName = opts.compName,
33
- compSeq = opts.compSeq;
31
+ viewOptionFlags = opts.viewOptionFlags;
32
+ var _ref = opts.inheritanceProps || {},
33
+ viewName = _ref.viewName,
34
+ viewSeq = _ref.viewSeq,
35
+ compName = _ref.compName,
36
+ compSeq = _ref.compSeq;
34
37
  var inPowerChart = true;
35
38
  var params = ["" + personId, "" + encounterId];
39
+ var _viewOptsFlags = !viewOptionFlags || viewOptionFlags.length === 0 ? ['view-only'] : viewOptionFlags;
36
40
  params.push("[" + eventIds.join('|') + "]");
37
41
  params.push("" + windowTitle);
38
- params.push("" + calculateViewOptionFlag(viewOptionFlags));
39
- params.push("" + viewName);
40
- params.push("" + viewSeq);
41
- params.push("" + compName);
42
- params.push("" + compSeq);
42
+ params.push("" + calculateViewOptionFlag(_viewOptsFlags));
43
+ params.push("" + (viewName || ''));
44
+ params.push("" + (viewSeq || ''));
45
+ params.push("" + (compName || ''));
46
+ params.push("" + (compSeq || ''));
43
47
  var eventString = "" + params.join('|');
44
48
  try {
45
49
  window.MPAGES_EVENT('CLINICALNOTE', eventString);
@@ -69,9 +73,11 @@ function calculateViewOptionFlag(viewOptionFlags) {
69
73
  }
70
74
 
71
75
  /**
72
- * A function to launch a power form, which returns an object of `MPageEventReturn`
76
+ * Launch a PowerForm in Cerner's PowerChart.
73
77
  * @param {PowerFormOpts} opts - The parameters passed, as specified in `PowerFormOpts`
74
78
  * @returns {MPageEventReturn} - An object containing the `eventString` and `inPowerChart` values.
79
+ *
80
+ * @documentation [MPAGES_EVENT - POWERFORM](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+POWERFORM)
75
81
  **/
76
82
  var launchPowerForm = function launchPowerForm(opts) {
77
83
  var personId = opts.personId,
@@ -115,17 +121,25 @@ var launchPowerForm = function launchPowerForm(opts) {
115
121
  };
116
122
 
117
123
  /**
118
- * A function to launch a power note, which returns an object of `MPageEventReturn`
124
+ * Launch a PowerNote in Cerner's PowerChart.
119
125
  * @param {PowerNoteOpts} opts - The parameters passed, as specified in `PowerNoteOpts`
120
126
  * @returns {MPageEventReturn} - An object containing the `eventString` and `inPowerChart` values.
127
+ * @throws {Error} - if there is a type mismatch between the provided option for `target` and `targetId`.
128
+ *
129
+ * @documentation [MPAGES_EVENT - POWERNOTE](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+POWERNOTE)
121
130
  **/
122
131
  var launchPowerNote = function launchPowerNote(opts) {
123
132
  var personId = opts.personId,
124
133
  encounterId = opts.encounterId,
125
- CKI = opts.CKI,
126
- eventId = opts.eventId;
127
- if (!CKI && !eventId) throw new Error("Either 'CKI' or 'eventId' is required.");
128
- var params = ["" + personId, "" + encounterId, "" + (!eventId && CKI || ''), "" + (eventId || 0)];
134
+ target = opts.target,
135
+ targetId = opts.targetId;
136
+ if (target === 'new' && typeof targetId !== 'string') {
137
+ throw new Error('CKI must be a string when launching a new PowerNote.');
138
+ }
139
+ if (target === 'existing' && typeof targetId !== 'number') {
140
+ throw new Error('eventId must be a number when loading an existing PowerNote.');
141
+ }
142
+ var params = ["" + personId, "" + encounterId, "" + (target === 'new' ? targetId : ''), "" + (target === 'existing' ? targetId : 0)];
129
143
  var eventString = "" + params.join('|');
130
144
  var inPowerChart = true;
131
145
  try {
@@ -168,6 +182,8 @@ statusCodeMap.set(500, 'internal server exception');
168
182
  * the `data` field will be set to `undefined`. The objects `meta` field
169
183
  * includes `responseText`, `status`, and `statusTest` fields.
170
184
  * @rejects with an error message if the CCL request fails.
185
+ *
186
+ * @documentation - [XMLCclRequest](https://wiki.cerner.com/display/MPAGES/MPages+JavaScript+Reference#MPagesJavaScriptReference-XMLCclRequest)
171
187
  */
172
188
  function makeCclRequest(opts) {
173
189
  var prg = opts.prg,
@@ -228,30 +244,39 @@ function processCclRequestParams(params, excludeMine) {
228
244
  /**
229
245
  * Attempts to open a tab with the name given to the `tab` variable in a
230
246
  * patients chart given in the context of a given encounter.
231
- * @param pid The patients person id.
232
- * @param eid The patients encounter id.
247
+ * @param {number} personId - The identifier for the patient to whom the note belongs.
248
+ * Cerner context variable: PAT_PersonId.
249
+ * @param {number} encounterId - The identifier for the encounter belonging to the patient where
250
+ * this note will be launched. Cerner context variable: VIS_EncntrId.
233
251
  * @param tab The string which represents the tab to open
234
252
  * (case insensitive). Navigation will be made to the first
235
253
  * upper-level tab in the chart that that matches the `tab` string
236
254
  * If no match is found, then sub-tab names will be searched and
237
255
  * navigation made to the first sub-tab that matches
238
256
  * the `tab` string. If no matches are found, no navigation will occur.
239
- * @param quickAdd {boolean} - If true, will attempt to open the window
257
+ * @param quickAdd {boolean} - (optional) If true, will attempt to open the window
240
258
  * in a quick add mode. E.g. if the Orders tab is connected to it will
241
259
  * attempt to launch the Add Order window so long as Enhanced Navigation is
242
- * supported by your installation.
260
+ * supported by your installation. Defaults to false.
261
+ *
262
+ * @documentation [APPLINK](https://wiki.cerner.com/display/public/MPDEVWIKI/APPLINK)
243
263
  */
244
- function openPatientTab(pid, eid, tab, quickAdd) {
245
- var args = "/PERSONID=" + pid + " /ENCNTRID=" + eid + " /FIRSTTAB=^" + tab.toUpperCase() + (quickAdd || false ? '+' : '') + "^";
264
+ function openPatientTab(personId, encounterId, tab, quickAdd) {
265
+ var inPowerChart = true;
266
+ var eventString = "/PERSONID=" + personId + " /ENCNTRID=" + encounterId + " /FIRSTTAB=^" + tab.toUpperCase() + (quickAdd || false ? '+' : '') + "^";
246
267
  try {
247
- window.APPLINK(1, '$APP_APPNAME$', args);
268
+ window.APPLINK(1, '$APP_APPNAME$', eventString);
248
269
  } catch (e) {
249
270
  if (outsideOfPowerChartError(e)) {
250
- console.warn("window.APPLINK(1, \"$APP_NAME$\", '" + args + "')");
271
+ inPowerChart = false;
251
272
  } else {
252
273
  throw e;
253
274
  }
254
275
  }
276
+ return {
277
+ eventString: eventString,
278
+ inPowerChart: inPowerChart
279
+ };
255
280
  }
256
281
 
257
282
  /**
@@ -263,25 +288,36 @@ function openPatientTab(pid, eid, tab, quickAdd) {
263
288
  * If no match is found, then sub-tab names will be searched and
264
289
  * navigation made to the first sub-tab that matches
265
290
  * the `tab` string. If no matches are found, no navigation will occur.
291
+ *
292
+ * @documentation [APPLINK](https://wiki.cerner.com/display/public/MPDEVWIKI/APPLINK)
266
293
  */
267
294
  function openOrganizerTab(tab) {
295
+ var inPowerChart = true;
296
+ var eventString = "/ORGANIZERTAB=^" + tab + "^";
268
297
  try {
269
- window.APPLINK(0, 'Powerchart.exe', "/ORGANIZERTAB=^" + tab + "^");
298
+ window.APPLINK(0, 'Powerchart.exe', eventString);
270
299
  } catch (e) {
271
300
  if (outsideOfPowerChartError(e)) {
272
- console.warn("window.APPLINK(\"Powerchart.exe\", \"/ORGANIZERTAB=^" + tab + "^\")");
301
+ inPowerChart = false;
273
302
  } else {
274
303
  throw e;
275
304
  }
276
305
  }
306
+ return {
307
+ eventString: eventString,
308
+ inPowerChart: inPowerChart
309
+ };
277
310
  }
278
311
 
279
312
  /**
280
313
  * Creates a new pipe-delimited MPage Order string.
281
314
  * @since 0.4.0
282
- * @param action - The action to be performed on the order.
283
- * @param opts - (optional) The options for the order.
284
- * @returns `string` - A pipe-delimited string which can be integrated into an MPage Event for one or more orders.
315
+ * @param {OrderAction} action - The action to be performed on the order.
316
+ * @param {OrderStrOpts} opts - (optional) The options for the order.
317
+ * @returns {string} - A pipe-delimited string which can be integrated into an MPage Event for one or more orders.
318
+ * @throws {Error} - If the action is not a valid order action.
319
+ *
320
+ * @documentation [MPAGES_EVENT - ORDER](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+ORDERS)
285
321
  */
286
322
  var orderString = function orderString(action, opts) {
287
323
  var _ref = opts || {},
@@ -329,27 +365,31 @@ var tabsMap = /*#__PURE__*/new Map().set('orders', {
329
365
  });
330
366
  /**
331
367
  * Submit orders for a patient in a given encounter through the Cerner PowerChart MPage Event interface.
332
- * By default, power plans are enabled, the target tab is set to order with power orders enabled, and
333
- * will launch to the signature view.
334
- * @param pid - The patient id.
335
- * @param eid - The encounter id for the patient.
368
+ * By default, power plans are disabled (potential bug in PowerChart), the target tab is set to order
369
+ * with power orders enabled, and will launch to the signature view.
370
+ * @param {number} personId - The identifier for the patient to whom the note belongs.
371
+ * Cerner context variable: PAT_PersonId.
372
+ * @param {number} encounterId - The identifier for the encounter belonging to the patient where
373
+ * this note will be launched. Cerner context variable: VIS_EncntrId.
336
374
  * @param orders - The orders to be submitted. Orders are given in the form of an
337
375
  * Cerner MPage Order string of pipe-delimited parameters.
338
376
  * @param opts - (optional) User defined options for the order submission event.
339
377
  * @returns an object with the order `eventString` and a boolean flag set to notify the user if
340
378
  * the attempt was made outside of PowerChart, `inPowerChart`.
379
+ *
380
+ * @documentation [MPAGES_EVENT - ORDER](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+ORDERS)
341
381
  */
342
- var submitOrders = function submitOrders(pid, eid, orders, opts) {
382
+ var submitOrders = function submitOrders(personId, encounterId, orders, opts) {
343
383
  var _ref = opts || {},
344
384
  targetTab = _ref.targetTab,
345
385
  launchView = _ref.launchView,
346
- disablePowerPlans = _ref.disablePowerPlans,
386
+ enablePowerPlans = _ref.enablePowerPlans,
347
387
  signSilently = _ref.signSilently;
348
388
  if (!targetTab) targetTab = 'power orders';
349
389
  if (!launchView) launchView = 'signature';
350
390
  var inPowerChart = true;
351
- var params = ["" + pid, "" + eid, orders.join('')];
352
- params.push(disablePowerPlans ? '0' : '24');
391
+ var params = ["" + personId, "" + encounterId, orders.join('')];
392
+ params.push(enablePowerPlans ? '24' : '0');
353
393
  var _ref2 = tabsMap.get(targetTab) || {
354
394
  tab: 2,
355
395
  display: 127
@@ -1 +1 @@
1
- {"version":3,"file":"fluent-cerner-js.cjs.development.js","sources":["../src/utils/outsideOfPowerChartError.ts","../src/utils/warnOutsideOfPowerChart.ts","../src/functional/launchClinicalNote.ts","../src/functional/launchPowerForm.ts","../src/functional/launchPowerNote.ts","../src/functional/makeCclRequest.ts","../src/functional/openPatientTab.ts","../src/functional/openOrganizerTab.ts","../src/functional/orderString.ts","../src/functional/submitOrders.ts","../src/MPageOrderEvent.ts","../src/MPageOrder.ts"],"sourcesContent":["/**\n * Check to see if the error reflects likely being outside of PowerChart.\n * @param e {Error} - The error to be checked.\n * @returns {boolean} - Returns `true` if the error is one of two cases that result\n * from being outside of Cerner PowerChart.\n */\nexport function outsideOfPowerChartError(e: unknown) {\n return (\n (e instanceof TypeError &&\n e.message === 'window.MPAGES_EVENT is not a function') ||\n (e instanceof TypeError &&\n e.message === 'window.XMLCclRequest is not a function') ||\n (e instanceof ReferenceError && e.message === 'window is not defined')\n );\n}\n","export const warnAttemptedOrdersOutsideOfPowerChart = (\n eventString: string\n): void => {\n console.warn(`window.MPAGES_EVENT('ORDERS', '${eventString}')`);\n};\n","import { MPageEventReturn } from '.';\nimport { outsideOfPowerChartError } from '../utils';\n\n/**\n * A type alias with the purpose of limiting the set of view flags available.\n */\nexport type ViewFlag =\n | 'menu'\n | 'buttons'\n | 'toolbar'\n | 'calculator'\n | 'view-only';\n\n// TODO: Determine which of these fields are required and which are optional. Understand what each is.\n/**\n * A type which represents the parameters to be be passed into the launchClinicalNote() function\n * @param {number} personId - The personId of the patient to whom the note is regarding.\n * @param {number} encounterId - The encounterId of the encounter for the patient to which the note is regarding.\n * @param {Array<number>} eventIds - An array of event_ids of the clinical note(s) to be displayed.\n * @param {string} windowTitle - The text to be displayed in the first section of the title for the Clinical Notes window.\n * @param {Array<ViewFlag>} viewOptionFlags - A set of flags that can be used to define the style of the Clinical Notes window. Example: [\"menu\", \"buttons\", \"toolbar\", calculator\", \"view-only\"]\n * @param {string} viewName - The view name for the view-level preference of the tab to model the preferences after.\n * @param {number} viewSeq - The view sequence for the view-level preference of the tab to model the preferences after. An invalid viewSeq loads the clinical note with the default preferences.\n * @param {string} compName - The component name for the component-level preference of the tab to model the preferences after. An invalid compName loads the clinical note with the default preferences.\n * @param {number} compSeq - \tThe component sequence for the component-level preference of the tab to model the preferences after. An invalid compSeq loads the clinical note with the default preferences.\n **/\nexport type ClinicalNoteOpts = {\n personId: number;\n encounterId: number;\n eventIds: Array<number>;\n windowTitle: string;\n viewOptionFlags: Array<ViewFlag>;\n viewName: string;\n viewSeq: number;\n compName: string;\n compSeq: number;\n};\n\n/**\n * A function to launch a clinical note, which returns an object of `MPageEventReturn`\n * @param {ClinicalNoteOpts} opts - The parameters passed, as specified in `ClinicalNoteOpts`\n * @returns {MPageEventReturn} - An object containing the `eventString` and `inPowerChart` values.\n **/\nexport const launchClinicalNote = (\n opts: ClinicalNoteOpts\n): MPageEventReturn => {\n const {\n personId,\n encounterId,\n eventIds,\n windowTitle,\n viewOptionFlags,\n viewName,\n viewSeq,\n compName,\n compSeq,\n } = opts;\n let inPowerChart = true;\n const params: Array<string> = [`${personId}`, `${encounterId}`];\n\n params.push(`[${eventIds.join('|')}]`);\n params.push(`${windowTitle}`);\n params.push(`${calculateViewOptionFlag(viewOptionFlags)}`);\n params.push(`${viewName}`);\n params.push(`${viewSeq}`);\n params.push(`${compName}`);\n params.push(`${compSeq}`);\n\n const eventString = `${params.join('|')}`;\n try {\n window.MPAGES_EVENT('CLINICALNOTE', eventString);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n inPowerChart = false;\n console.warn(`window.MPAGES_EVENT('CLINICALNOTE', '${eventString}')`);\n } else {\n throw e;\n }\n }\n\n return { inPowerChart, eventString };\n};\n\nfunction calculateViewOptionFlag(viewOptionFlags: Array<ViewFlag>): number {\n let total = 0;\n viewOptionFlags.forEach(flag => {\n if (flag === 'menu') total += 1;\n if (flag === 'buttons') total += 2;\n if (flag === 'toolbar') total += 4;\n if (flag === 'calculator') total += 8;\n if (flag === 'view-only') total += 16;\n });\n return total;\n}\n","import { outsideOfPowerChartError } from '../utils';\n\n/**\n * A type which represents the parameters to be be passed into the launchPowerForm() function.\n * @param {number} personId - The person_id of the patient whose power form is to be displayed.\n * @param {number} encounterId - The encntr_id of the patient whose power form is to be displayed.\n * @param {string} target - Determines whether to target (open) a \"new form\" of a specified type, a \"completed form\", or a \"new form search\" box.\n * @param {number} targetId - The form_id (pulled from DCP_FORMS_REF_ID) for the target document -- required only for `new form` or `completed form` targets.\n * @param {string} permissions - The permissions to open the document with. Choices are: \"modify\" or \"read-only\".\n **/\nexport type PowerFormOpts = {\n personId: number;\n encounterId: number;\n target: 'new form' | 'completed form' | 'new form search';\n targetId?: number;\n permissions: 'modify' | 'read only';\n};\n\n/**\n * A type which represents the object to be returned from the launchClinicalNote() function.\n * @param {string} eventString - The string version of the MPageEvent\n * @param {boolean} inPowerChart - Returns `true` if being run from inside of PowerChart and returns `false` otherwise.\n **/\nexport type MPageEventReturn = {\n eventString: string;\n inPowerChart: boolean;\n};\n\n/**\n * A function to launch a power form, which returns an object of `MPageEventReturn`\n * @param {PowerFormOpts} opts - The parameters passed, as specified in `PowerFormOpts`\n * @returns {MPageEventReturn} - An object containing the `eventString` and `inPowerChart` values.\n **/\nexport const launchPowerForm = (opts: PowerFormOpts): MPageEventReturn => {\n const { personId, encounterId, target, targetId, permissions } = opts;\n\n if ((target === 'new form' || target === 'completed form') && !targetId) {\n throw new Error(\n \"'targetId' is required for 'new form' and 'completed form' targets.\"\n );\n }\n\n const params: Array<string> = [`${personId}`, `${encounterId}`];\n if (target === 'new form') {\n params.push(`${targetId}`);\n params.push('0');\n }\n if (target === 'completed form') {\n params.push('0');\n params.push(`${targetId}`);\n }\n if (target === 'new form search') {\n params.push('0');\n params.push('0');\n }\n params.push(permissions === 'modify' ? '0' : '1');\n\n let inPowerChart = true;\n const eventString = `${params.join('|')}`;\n\n try {\n window.MPAGES_EVENT('POWERFORM', eventString);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n inPowerChart = false;\n console.warn(`window.MPAGES_EVENT('POWERFORM', '${eventString}')`);\n } else {\n throw e;\n }\n }\n\n return { inPowerChart, eventString };\n};\n","import { MPageEventReturn } from '.';\nimport { outsideOfPowerChartError } from '../utils';\n\n/**\n * A type which represents the parameters to be be passed into the launchPowerNote() function.\n * @param {number} personId - The person_id of the patient whose power note is to be displayed.\n * @param {number} encounterId - The encntr_id of the patient whose power note is to be displayed.\n * @param {string} CKI - (exclusive option to eventID) A CKI value for a new PowerNote that corresponds to an encounter pathway.\n * @param {number} eventId - (exclusive option to CKI) An event_id for an existing PowerNote to load.\n **/\nexport type PowerNoteOpts = {\n personId: number;\n encounterId: number;\n CKI?: string;\n eventId?: number;\n};\n\n/**\n * A function to launch a power note, which returns an object of `MPageEventReturn`\n * @param {PowerNoteOpts} opts - The parameters passed, as specified in `PowerNoteOpts`\n * @returns {MPageEventReturn} - An object containing the `eventString` and `inPowerChart` values.\n **/\nexport const launchPowerNote = (opts: PowerNoteOpts): MPageEventReturn => {\n const { personId, encounterId, CKI, eventId } = opts;\n\n if (!CKI && !eventId)\n throw new Error(\"Either 'CKI' or 'eventId' is required.\");\n\n const params: Array<string> = [\n `${personId}`,\n `${encounterId}`,\n `${(!eventId && CKI) || ''}`,\n `${eventId || 0}`,\n ];\n\n const eventString = `${params.join('|')}`;\n let inPowerChart = true;\n try {\n window.MPAGES_EVENT('POWERNOTE', eventString);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n inPowerChart = false;\n console.warn(`window.MPAGES_EVENT('POWERNOTE', '${eventString}')`);\n } else {\n throw e;\n }\n }\n\n return { eventString, inPowerChart };\n};\n","import { outsideOfPowerChartError } from '../utils';\n\n/**\n * A type which represents the input parameter for an `XmlCclRequest`, which is wrapped by `makeCclRequest`.\n * The parameters are passed in a string, and numbers and strings are interpreted within this string by\n * the presence of quotes within quotes (e.g. single within double or vice versa). By strongly typing\n * the CclCallParam we can ensure that the parameters are always passed in a way that properly represents\n * their type.\n * @param {'string'|'number'} type - The type of the parameter.\n * @param {string} param - The string representing the parameters value.\n */\nexport type CclCallParam = {\n type: 'string' | 'number';\n param: string | number;\n};\n\n/**\n * A type which represents the full set of data required to make an XmlCclRequest, which is wrapped\n * by `makeCclRequest`.\n * @param {string} prg - The name of the CCL program to run, e.g. 12_USER_DETAILS.\n * @param {boolean?} excludeMine - Determines whether or not to include the \"MINE\" parameter as the\n * first parameter in the CCL call. This defaults to `false`, and almost all cases will require\n * the \"MINE\" parameter to be included.\n * @param {CclCallParam[]} params - An array of CclCallParam objects, each of which represents\n * a strongly typed parameter.\n */\nexport type CclOpts = {\n prg: string;\n excludeMine?: boolean;\n params: Array<CclCallParam>;\n};\n\n/**\n * A type functioning as a convience wrapper for several status\n * codes, respresented as strings, that are returned by XMLCclRequest.\n */\nexport type XmlCclStatus =\n | 'success'\n | 'method not allowed'\n | 'invalid state'\n | 'non-fatal error'\n | 'memory error'\n | 'internal server exception'\n | 'status refers to unknown error';\n\n/**\n * A type which represents the full set of data returned from an XmlCclRequest and important, formatted\n * metadata to help with debugging and error management. This is a generic type and data will represent\n * the type `T` which is the type or interface which represents the resolved data from the CCL request.\n */\nexport type CclRequestResponse<T> = {\n meta: {\n responseText: string;\n status: number;\n statusText: XmlCclStatus;\n };\n data: T | undefined;\n};\n\nconst statusCodeMap: Map<number, XmlCclStatus> = new Map();\nstatusCodeMap.set(200, 'success');\nstatusCodeMap.set(405, 'method not allowed');\nstatusCodeMap.set(409, 'invalid state');\nstatusCodeMap.set(492, 'non-fatal error');\nstatusCodeMap.set(493, 'memory error');\nstatusCodeMap.set(500, 'internal server exception');\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use. Of note,\n * use of this requires the `head` of the HTML document contain the following\n * `meta` tag: `<META content='XMLCCLREQUEST' name='discern'>` so that it might\n * interface with the appropriate COM object.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @resolves the `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(\n opts: CclOpts\n): Promise<CclRequestResponse<T>> {\n const { prg, excludeMine, params } = opts;\n const paramsList = processCclRequestParams(params, excludeMine || false);\n\n return new Promise((resolve, reject) => {\n try {\n // @ts-ignore - From Powerchart context\n const request: XMLCclRequest = window.XMLCclRequest();\n\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n const data: CclRequestResponse<T> = {\n meta: {\n responseText: request.responseText,\n status: request.status,\n statusText:\n statusCodeMap.get(request.status) ||\n 'status refers to unknown error',\n },\n data:\n request.responseText === ''\n ? undefined\n : JSON.parse(request.responseText),\n };\n if (request.readyState === 4) {\n resolve(data);\n } else {\n reject(\n `error with status ${request.status} and readyState ${\n request.readyState\n } on ${prg} with params ${paramsList} returning response text: ${request.responseText ||\n 'no response text'}`\n );\n }\n };\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n reject((e as Error).message);\n } else {\n throw e;\n }\n }\n });\n}\n\n/**\n * A function which processes the CCL request parameters, converting them to a string compatible with an XmlCclRequest.\n * @param params {Array<CclCallParam>} An array of CclCallParam objects, each of which represents\n * @param excludeMine {boolean} Determines whether or not to include the \"MINE\" parameter as the\n * @returns {string} the XmlCclRequest compatible string.\n */\nexport function processCclRequestParams(\n params?: Array<CclCallParam>,\n excludeMine?: boolean\n) {\n params = params || [];\n excludeMine = excludeMine || false;\n\n const updatedParams: Array<CclCallParam> = excludeMine\n ? [...params]\n : [{ type: 'string', param: 'MINE' }, ...params];\n\n const paramString = updatedParams\n .map(({ type, param }) => (type === 'string' ? `'${param}'` : param))\n .join(',');\n\n return paramString;\n}\n","import { outsideOfPowerChartError } from '../utils';\n\n/**\n * Attempts to open a tab with the name given to the `tab` variable in a\n * patients chart given in the context of a given encounter.\n * @param pid The patients person id.\n * @param eid The patients encounter id.\n * @param tab The string which represents the tab to open\n * (case insensitive). Navigation will be made to the first\n * upper-level tab in the chart that that matches the `tab` string\n * If no match is found, then sub-tab names will be searched and\n * navigation made to the first sub-tab that matches\n * the `tab` string. If no matches are found, no navigation will occur.\n * @param quickAdd {boolean} - If true, will attempt to open the window\n * in a quick add mode. E.g. if the Orders tab is connected to it will\n * attempt to launch the Add Order window so long as Enhanced Navigation is\n * supported by your installation.\n */\nexport function openPatientTab(\n pid: number,\n eid: number,\n tab: string,\n quickAdd?: boolean\n): void {\n const args = `/PERSONID=${pid} /ENCNTRID=${eid} /FIRSTTAB=^${tab.toUpperCase()}${\n quickAdd || false ? '+' : ''\n }^`;\n\n try {\n window.APPLINK(1, '$APP_APPNAME$', args);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n console.warn(`window.APPLINK(1, \"$APP_NAME$\", '${args}')`);\n } else {\n throw e;\n }\n }\n}\n","import { outsideOfPowerChartError } from '../utils';\n\n/**\n * Attempts to open a tab with the name given to the `tab` variable in at the chart organizer\n * level.\n * @param tab The string which represents the tab to open\n * (case insensitive). Navigation will be made to the first\n * upper-level tab in the chart that that matches the `tab` string\n * If no match is found, then sub-tab names will be searched and\n * navigation made to the first sub-tab that matches\n * the `tab` string. If no matches are found, no navigation will occur.\n */\nexport function openOrganizerTab(tab: string): void {\n try {\n window.APPLINK(0, 'Powerchart.exe', `/ORGANIZERTAB=^${tab}^`);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n console.warn(\n `window.APPLINK(\"Powerchart.exe\", \"/ORGANIZERTAB=^${tab}^\")`\n );\n } else {\n throw e;\n }\n }\n}\n","/**\n * A type for the options that can be passed to the makeMpageOrder function.\n * @action `launch moew` - Launches the MOEW.\n * @action `activate existing` - Activates an existing order.\n * @action `cancel-discontinue` - Cancels and discontinues an existing order.\\n\n * @action `cancel-reorder` - Cancels and reorders an existing order.\n * @action `clear actions` - Clear actions of a future existing order.\n * @action `convert inpatient` - Converts a prescription order into an inpatient order.\n * @action `convert prescription` - Converts an inpatient order into a prescription.\n * @action `modify` - Modifies an existing future order.\n * @action `new order` - Creates a new order.\n * @action `renew` - Renews an existing non-prescription order.\n * @action `renew prescription` - Renews an existing prescription order.\n * @action `copy existing` - Copy an existing order.\n * @action `resume` - Resumes an existing order.\n * @action `suspend` - Suspends an existing order.\n */\nexport type OrderAction =\n | 'launch moew'\n | 'activate existing'\n | 'cancel-discontinue'\n | 'cancel-reorder'\n | 'clear actions'\n | 'convert inpatient'\n | 'convert prescription'\n | 'modify'\n | 'new order'\n | 'renew'\n | 'renew prescription'\n | 'copy existing'\n | 'resume'\n | 'suspend';\n\n/**\n * @param `synonymId` - The Cerner synonym_id for the order to be generated.\n * @param `orderSentenceId` - (optional) The order sentence id to be associated with the new order.\n * This is an accompanied value to the synonymId and provides specificity to the order type.\n * @param `nomenclatureId` - (optional) The nomenclature id, or associated problem/diagnosis, to be associated with the new order.\n * @param `interaction` - (optional) Defines when an interaction between the provider and PowerChart takes place only at sign time, or impromptu.\n * @param `origination` - (optional) Defines the origination of the order as `satellite`, `prescription`, or `normal`.\n */\nexport type NewOrderStrOpts = {\n synonymId: number;\n orderSentenceId?: number;\n nomenclatureId?: number;\n interactionCheck?: 'on sign' | 'default';\n origination?: 'satellite' | 'prescription' | 'normal';\n};\n\n/**\n * @param `orderId` - (optional) The order id value for the order to activate.\n * @param `newOrderOpts` - (optional) The options for the new order.\n */\nexport type OrderStrOpts = {\n orderId?: number;\n newOrderOpts?: NewOrderStrOpts;\n};\n\n/**\n * Creates a new pipe-delimited MPage Order string.\n * @since 0.4.0\n * @param action - The action to be performed on the order.\n * @param opts - (optional) The options for the order.\n * @returns `string` - A pipe-delimited string which can be integrated into an MPage Event for one or more orders.\n */\nexport const orderString = (\n action: OrderAction,\n opts?: OrderStrOpts\n): string => {\n const { orderId, newOrderOpts } = opts || {};\n const {\n synonymId,\n orderSentenceId,\n nomenclatureId,\n interactionCheck: interaction,\n origination,\n } = newOrderOpts || {};\n\n let params: Array<string> = [orderActionMap.get(action)];\n\n switch (action) {\n case 'launch moew':\n params = params.concat(['0', '0', '0', '0', '0']);\n break;\n case 'new order':\n if (!synonymId)\n throw new Error(`synonymId is required for the '${action}' action`);\n params = params.concat([\n `${synonymId}`,\n `${originationMap.get(origination) || 0}`,\n `${orderSentenceId || 0}`,\n `${nomenclatureId || 0}`,\n `${interactionMap.get(interaction) || 0}`,\n ]);\n break;\n default:\n if (!orderId)\n throw new Error(`orderId is required for the '${action}' action`);\n params = params.concat([`${orderId}`]);\n break;\n }\n\n return `{${params.join('|')}}`;\n};\n\nconst orderActionMap = new Map()\n .set('launch moew', 'ORDER')\n .set('activate existing', 'ACTIVATE')\n .set('cancel-discontinue', 'CANCEL DC')\n .set('cancel-reorder', 'CANCEL REORD')\n .set('clear actions', 'CLEAR')\n .set('convert inpatient', 'CONVERT_INPAT')\n .set('convert prescription', 'CONVERT_RX')\n .set('modify', 'MODIFY')\n .set('new order', 'ORDER')\n .set('renew', 'RENEW')\n .set('renew prescription', 'RENEW_RX')\n .set('copy existing', 'REPEAT')\n .set('resume', 'RESUME')\n .set('suspend', 'SUSPEND');\n\nconst originationMap = new Map()\n .set('satellite', '5')\n .set('prescription', '1')\n .set('normal', '0');\n\nconst interactionMap = new Map().set('on sign', '1').set('default', '0');\n","import { warnOutsideOfPowerChart } from '../utils';\nimport { outsideOfPowerChartError } from '../utils/outsideOfPowerChartError';\n\nconst launchViewMap = new Map()\n .set('search', 8)\n .set('profile', 16)\n .set('signature', 32);\n\nconst tabsMap = new Map<string, { tab: number; display: number }>()\n .set('orders', { tab: 2, display: 0 })\n .set('power orders', { tab: 2, display: 127 })\n .set('medications', { tab: 3, display: 0 })\n .set('power medications', { tab: 3, display: 127 });\n\n/**\n * @action `targetTab` - (optional) Sets the tab to be displayed, with and without power orders.\n * If not provided, will default to `power orders`, that is the orders tab with power orders enabled.\n * @action `launchView` - (optional) Sets the view to be displayed.If not provided,\n * will default to `search` view.\n * @action `disablePowerPlans` - (optional) Disables power plans. Power plans are enabled by default.\n * @action `silentSign` - (optional) Signs the orders silently. Orders are not signed silently by default.\n */\nexport type SubmitOrderOpts = {\n targetTab?: 'orders' | 'power orders' | 'medications' | 'power medications';\n launchView?: 'search' | 'profile' | 'signature';\n disablePowerPlans?: boolean;\n signSilently?: boolean;\n};\n\n/**\n * Submit orders for a patient in a given encounter through the Cerner PowerChart MPage Event interface.\n * By default, power plans are enabled, the target tab is set to order with power orders enabled, and\n * will launch to the signature view.\n * @param pid - The patient id.\n * @param eid - The encounter id for the patient.\n * @param orders - The orders to be submitted. Orders are given in the form of an\n * Cerner MPage Order string of pipe-delimited parameters.\n * @param opts - (optional) User defined options for the order submission event.\n * @returns an object with the order `eventString` and a boolean flag set to notify the user if\n * the attempt was made outside of PowerChart, `inPowerChart`.\n */\nexport const submitOrders = (\n pid: number,\n eid: number,\n orders: Array<string>,\n opts?: SubmitOrderOpts\n): { eventString: string; inPowerChart: boolean } => {\n let { targetTab, launchView, disablePowerPlans, signSilently } = opts || {};\n if (!targetTab) targetTab = 'power orders';\n if (!launchView) launchView = 'signature';\n\n let inPowerChart = true;\n\n let params: Array<string> = [`${pid}`, `${eid}`, orders.join('')];\n\n params.push(disablePowerPlans ? '0' : '24');\n\n const { tab, display } = tabsMap.get(targetTab) || { tab: 2, display: 127 };\n params.push(`{${tab}|${display}}`);\n\n params.push(`${launchViewMap.get(launchView) || 32}`);\n\n params.push(`${signSilently ? '1' : '0'}`);\n\n const eventString = params.join('|');\n try {\n window.MPAGES_EVENT('ORDERS', eventString);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n inPowerChart = false;\n warnOutsideOfPowerChart(eventString);\n } else {\n throw e;\n }\n }\n return { eventString, inPowerChart };\n};\n","import { MPageOrder } from '.';\nimport { outsideOfPowerChartError, warnOutsideOfPowerChart } from './utils';\n\nclass MPageOrderEvent {\n private _orders: Array<MPageOrder>;\n getOrders = () => this._orders;\n\n private _tabList: { tab: number; tabDisplayFlag: number } = {\n tab: 0,\n tabDisplayFlag: 0,\n };\n getTabList = () => this._tabList;\n\n private _personId: number = 0;\n getPersonId = () => this._personId;\n\n private _encounterId: number = 0;\n getEncounterId = () => this._encounterId;\n\n private _powerPlanFlag: number = 0;\n getPowerPlanFlag = () => this._powerPlanFlag;\n\n private _defaultDisplay: number = 0;\n getDefaultDisplay = () => this._defaultDisplay;\n\n private _silentSignFlag: number = 0;\n getSilentSignFlag = () => this._silentSignFlag;\n\n constructor() {\n this._orders = [];\n this._tabList = { tab: 0, tabDisplayFlag: 0 };\n // Disable PowerPlans by default\n this._powerPlanFlag = 0;\n // Disable PowerOrders by default\n this._tabList.tabDisplayFlag = 0;\n this.customizeOrderListProfile();\n this.launchOrderProfile();\n // Do NOT sign silently by default\n this._silentSignFlag = 0;\n }\n\n forPerson(id: number) {\n this._personId = id;\n return this;\n }\n\n forEncounter(id: number) {\n this._encounterId = id;\n return this;\n }\n\n addOrders(orders: Array<MPageOrder> | MPageOrder) {\n if (!Array.isArray(orders)) {\n orders = [orders];\n }\n this._orders = this._orders.concat(orders);\n return this;\n }\n\n enablePowerPlans() {\n this._powerPlanFlag = 24;\n return this;\n }\n\n customizeOrderListProfile() {\n this._tabList.tab = 2;\n return this;\n }\n\n customizeMedicationListProfile() {\n this._tabList.tab = 3;\n return this;\n }\n\n enablePowerOrders() {\n this._tabList.tabDisplayFlag = 127;\n return this;\n }\n\n launchOrderSearch() {\n this._defaultDisplay = 8;\n return this;\n }\n\n launchOrderProfile() {\n this._defaultDisplay = 16;\n return this;\n }\n\n launchOrdersForSignature() {\n this._defaultDisplay = 32;\n return this;\n }\n\n signSilently() {\n this._silentSignFlag = 1;\n return this;\n }\n\n send() {\n try {\n window.MPAGES_EVENT('ORDERS', this.toString());\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n warnOutsideOfPowerChart(this.toString());\n } else {\n throw e;\n }\n }\n }\n\n toString(): string {\n const head = `${this._personId}|${this._encounterId}|`;\n let body: string = '';\n this._orders.forEach(order => {\n body += order.toString();\n });\n const tail = `|${this._powerPlanFlag}|{${this._tabList.tab}|${this._tabList.tabDisplayFlag}}|${this._defaultDisplay}|${this._silentSignFlag}`;\n\n return `${head}${body}${tail}`;\n }\n}\n\nexport { MPageOrderEvent };\n","/**\n * Options for a new order\n * @param {boolean} isRxOrder Marks the order order as a prescription. Is mutually exclusive from\n * isSatelliteOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {boolean} isSatelliteOrder Moarks the order origination as satellite. Is mutually\n * exclusive from isRxOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {number} orderSentenceId The optional Cerner order_sentence_id to be associated with\n * the new order. Field will be set to 0 if undefined.\n * @param {number} nomenclatureId The optional Cerner nomenclature_id to be associated with the\n * new order. Field will be set to 0 if undefined.\n * @param {boolean} skipInteractionCheckUntilSign Determines cerner sign-time interaction\n * checking. A value of true skips checking for interactions until orders are signed, false\n * will not. Field will be set to false if left undefined; this resolves to 0 when built.\n */\nexport type NewOrderOpts = {\n isRxOrder?: boolean;\n isSatelliteOrder?: boolean;\n orderSentenceId?: number;\n nomenclatureId?: number;\n skipInteractionCheckUntilSign?: boolean;\n};\n\nexport class MPageOrder {\n private _orderAction: string = '';\n getOrderAction = () => this._orderAction;\n\n private _orderId: number = 0;\n getOrderId = () => this._orderId;\n\n private _synonymId: number = 0;\n getSynonymId = () => this._synonymId;\n\n private _orderOrigination: number = 0;\n getOrderOrigination = () => this._orderOrigination;\n\n private _orderSentenceId: number = 0;\n getOrderSentenceId = () => this._orderSentenceId;\n\n private _nomenclatureId: number = 0;\n getNomenclatureId = () => this._nomenclatureId;\n\n private _signTimeInteraction: number = 0;\n getSignTimeInteraction = () => this._signTimeInteraction;\n\n /**\n * Creates a new MPageOrder with the order action 'ACTIVATE', which is the prototype for activating an existing future order.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willActivate(orderId: number) {\n this._orderAction = 'ACTIVATE';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL DC', which is the prototype for canceling and discontinuing an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelDiscontinue(orderId: number) {\n this._orderAction = 'CANCEL DC';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL REORD', which is the prototype for cancelling and reordering an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelReorder(orderId: number) {\n this._orderAction = 'CANCEL REORD';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CLEAR', which is the prototype for clearing actions of an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willClear(orderId: number) {\n this._orderAction = 'CLEAR';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_INPAT', which is the prototype for converting a prescription order into an inpatient order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertInpatient(orderId: number) {\n this._orderAction = 'CONVERT_INPAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_RX', which is the prototype for converting an inpatient order into a prescription.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertToPrescriptionOrder(orderId: number) {\n this._orderAction = 'CONVERT_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'MODIFY', which is the prototype for modifying an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willModify(orderId: number) {\n this._orderAction = 'MODIFY';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPage Order with order action 'ORDER'.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} synonymId The Cerner synonym_id to be associated with the new order. Must be set.\n * @param {NewOrderOpts} options required when making a new order\n * @returns {this} Returns itself to continue chaining method calls.\n * default to a normal order type.\n * @throws Error if `isRxOrder` and `isSatelliteOrder` are both set to true. These two are mutually exclusive and setting\n * both creates underfined behavior with respect the order origination field.\n * @example\n * m.willMakeNewOrder(34, true, 13, 42, true).toString() => \"{'ORDER'|34|5|1342|1}\"\n */\n willMakeNewOrder(synonymId: number, opts?: NewOrderOpts) {\n const {\n isRxOrder,\n isSatelliteOrder,\n orderSentenceId,\n nomenclatureId,\n skipInteractionCheckUntilSign,\n } = opts || {};\n\n if (isRxOrder && isSatelliteOrder)\n throw new Error('must select either isRxOrder or isSatelliteOrder');\n this._orderAction = 'ORDER';\n this._synonymId = synonymId;\n this._orderSentenceId = orderSentenceId || 0;\n this._nomenclatureId = nomenclatureId || 0;\n this._signTimeInteraction = skipInteractionCheckUntilSign ? 1 : 0;\n this._orderOrigination = isSatelliteOrder ? 5 : isRxOrder ? 1 : 0;\n\n return this;\n }\n\n /**\n * Creates a new MPageOrder with the order action 'RENEW', which is the prototype for reviewing an existing non-prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewNonPrescription(orderId: number) {\n this._orderAction = 'RENEW';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RENEW_RX', which is the prototype for renewing an existing prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewPrescription(orderId: number) {\n this._orderAction = 'RENEW_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'REPEAT', which is the prototype for copying an order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCopyExistingOrder(orderId: number) {\n this._orderAction = 'REPEAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RESUME', which is the prototype for resuming a suspended order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willResumeSuspendedOrder(orderId: number) {\n this._orderAction = 'RESUME';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'SUSPEND', which is the prototype for suspending an existing order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willSuspend(orderId: number) {\n this._orderAction = 'SUSPEND';\n this._orderId = orderId;\n return this;\n }\n\n /**\n * Overrides the toString() method for representing the objects internal state as a string.\n *\n * @since 0.1.0\n * @returns {string} string representation of MPageOrder's internal state\n */\n toString(): string {\n return this._orderAction === 'ORDER'\n ? `{${this._orderAction}|${this._synonymId}|${this._orderOrigination}|${this._orderSentenceId}|${this._nomenclatureId}|${this._signTimeInteraction}}`\n : `{${this._orderAction}|${this._orderId}}`;\n }\n}\n"],"names":["outsideOfPowerChartError","e","TypeError","message","ReferenceError","warnAttemptedOrdersOutsideOfPowerChart","eventString","console","warn","launchClinicalNote","opts","personId","encounterId","eventIds","windowTitle","viewOptionFlags","viewName","viewSeq","compName","compSeq","inPowerChart","params","push","join","calculateViewOptionFlag","window","MPAGES_EVENT","total","forEach","flag","launchPowerForm","target","targetId","permissions","Error","launchPowerNote","CKI","eventId","statusCodeMap","Map","set","makeCclRequest","prg","excludeMine","paramsList","processCclRequestParams","Promise","resolve","reject","request","XMLCclRequest","open","send","onreadystatechange","data","meta","responseText","status","statusText","get","undefined","JSON","parse","readyState","updatedParams","type","param","paramString","map","openPatientTab","pid","eid","tab","quickAdd","args","toUpperCase","APPLINK","openOrganizerTab","orderString","action","orderId","newOrderOpts","synonymId","orderSentenceId","nomenclatureId","interaction","interactionCheck","origination","orderActionMap","concat","originationMap","interactionMap","launchViewMap","tabsMap","display","submitOrders","orders","targetTab","launchView","disablePowerPlans","signSilently","warnOutsideOfPowerChart","MPageOrderEvent","_orders","tabDisplayFlag","_tabList","_personId","_encounterId","_powerPlanFlag","_defaultDisplay","_silentSignFlag","customizeOrderListProfile","launchOrderProfile","forPerson","id","forEncounter","addOrders","Array","isArray","enablePowerPlans","customizeMedicationListProfile","enablePowerOrders","launchOrderSearch","launchOrdersForSignature","toString","head","body","order","tail","MPageOrder","_orderAction","_orderId","_synonymId","_orderOrigination","_orderSentenceId","_nomenclatureId","_signTimeInteraction","willActivate","willCancelDiscontinue","willCancelReorder","willClear","willConvertInpatient","willConvertToPrescriptionOrder","willModify","willMakeNewOrder","isRxOrder","isSatelliteOrder","skipInteractionCheckUntilSign","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend"],"mappings":";;;;AAAA;;;;;;SAMgBA,wBAAwB,CAACC,CAAU;EACjD,OACGA,CAAC,YAAYC,SAAS,IACrBD,CAAC,CAACE,OAAO,KAAK,uCAAuC,IACtDF,CAAC,YAAYC,SAAS,IACrBD,CAAC,CAACE,OAAO,KAAK,wCAAyC,IACxDF,CAAC,YAAYG,cAAc,IAAIH,CAAC,CAACE,OAAO,KAAK,uBAAwB;AAE1E;;ACdO,IAAME,sCAAsC,GAAG,SAAzCA,sCAAsC,CACjDC,WAAmB;EAEnBC,OAAO,CAACC,IAAI,qCAAmCF,WAAW,QAAK;AACjE,CAAC;;ACkCD;;;;;AAKA,IAAaG,kBAAkB,GAAG,SAArBA,kBAAkB,CAC7BC,IAAsB;EAEtB,IACEC,QAAQ,GASND,IAAI,CATNC,QAAQ;IACRC,WAAW,GAQTF,IAAI,CARNE,WAAW;IACXC,QAAQ,GAONH,IAAI,CAPNG,QAAQ;IACRC,WAAW,GAMTJ,IAAI,CANNI,WAAW;IACXC,eAAe,GAKbL,IAAI,CALNK,eAAe;IACfC,QAAQ,GAINN,IAAI,CAJNM,QAAQ;IACRC,OAAO,GAGLP,IAAI,CAHNO,OAAO;IACPC,QAAQ,GAENR,IAAI,CAFNQ,QAAQ;IACRC,OAAO,GACLT,IAAI,CADNS,OAAO;EAET,IAAIC,YAAY,GAAG,IAAI;EACvB,IAAMC,MAAM,GAAkB,MAAIV,QAAQ,OAAOC,WAAW,CAAG;EAE/DS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AAI,CAACC,QAAQ,GAAGnD,OAAO;IACvB,OAAO,IAAI;;;;;;;;;EAEb,OAOAsE,qBAAqB,GAArB,+BAAsBtE,OAAe;IACnC,IAAI,CAACkD,YAAY,GAAG,QAAQ;IAC5B,IAAI,CAACC,QAAQ,GAAGnD,OAAO;IACvB,OAAO,IAAI;;;;;;;;;EAEb,OAOAuE,wBAAwB,GAAxB,kCAAyBvE,OAAe;IACtC,IAAI,CAACkD,YAAY,GAAG,QAAQ;IAC5B,IAAI,CAACC,QAAQ,GAAGnD,OAAO;IACvB,OAAO,IAAI;;;;;;;;;EAEb,OAOAwE,WAAW,GAAX,qBAAYxE,OAAe;IACzB,IAAI,CAACkD,YAAY,GAAG,SAAS;IAC7B,IAAI,CAACC,QAAQ,GAAGnD,OAAO;IACvB,OAAO,IAAI;;;;;;;;EAGb,OAMA4C,QAAQ,GAAR;IACE,OAAO,IAAI,CAACM,YAAY,KAAK,OAAO,SAC5B,IAAI,CAACA,YAAY,SAAI,IAAI,CAACE,UAAU,SAAI,IAAI,CAACC,iBAAiB,SAAI,IAAI,CAACC,gBAAgB,SAAI,IAAI,CAACC,eAAe,SAAI,IAAI,CAACC,oBAAoB,eAC5I,IAAI,CAACN,YAAY,SAAI,IAAI,CAACC,QAAQ,MAAG;GAC9C;EAAA;AAAA;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"fluent-cerner-js.cjs.development.js","sources":["../src/utils/outsideOfPowerChartError.ts","../src/utils/warnOutsideOfPowerChart.ts","../src/functional/launchClinicalNote.ts","../src/functional/launchPowerForm.ts","../src/functional/launchPowerNote.ts","../src/functional/makeCclRequest.ts","../src/functional/openPatientTab.ts","../src/functional/openOrganizerTab.ts","../src/functional/orderString.ts","../src/functional/submitOrders.ts","../src/MPageOrderEvent.ts","../src/MPageOrder.ts"],"sourcesContent":["/**\n * Check to see if the error reflects likely being outside of PowerChart.\n * @param e {Error} - The error to be checked.\n * @returns {boolean} - Returns `true` if the error is one of two cases that result\n * from being outside of Cerner PowerChart.\n */\nexport function outsideOfPowerChartError(e: unknown) {\n return (\n (e instanceof TypeError &&\n e.message === 'window.MPAGES_EVENT is not a function') ||\n (e instanceof TypeError &&\n e.message === 'window.XMLCclRequest is not a function') ||\n (e instanceof TypeError &&\n e.message === 'window.APPLINK is not a function') ||\n (e instanceof ReferenceError && e.message === 'window is not defined')\n );\n}\n","export const warnAttemptedOrdersOutsideOfPowerChart = (\n eventString: string\n): void => {\n console.warn(`window.MPAGES_EVENT('ORDERS', '${eventString}')`);\n};\n","import { MPageEventReturn } from '.';\nimport { outsideOfPowerChartError } from '../utils';\n\n/**\n * Available options for the Clinical Note view.\n *\n * @documentation [MPAGES_EVENT - CLINICAL NOTE](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+CLINICALNOTE)\n */\nexport type ViewOption =\n | 'menu'\n | 'buttons'\n | 'toolbar'\n | 'calculator'\n | 'view-only';\n\n/**\n * Launches a clinical note in PowerChart inhereting the preferences of the component and view described below.\n * If any of the values is invalid, it will use the default values.\n * @param {string} viewName - The view name for the view-level preference of the tab to model the preferences after.\n * @param {number} viewSeq - The view sequence for the view-level preference of the tab to model the\n * preferences after. An invalid viewSeq loads the clinical note with the default preferences.\n * @param {string} compName - The component name for the component-level preference of the tab to model the\n * preferences after. An invalid compName loads the clinical note with the default preferences.\n * @param {number} compSeq - \tThe component sequence for the component-level preference of the tab to model\n * the preferences after. An invalid compSeq loads the clinical note with the default preferences.\n *\n * @documentation [MPAGES_EVENT - CLINICAL NOTE](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+CLINICALNOTE)\n */\nexport type InheretanceProps = {\n viewName: string;\n viewSeq: number;\n compName: string;\n compSeq: number;\n};\n\n/**\n * A type which represents the parameters to be be passed into the launchClinicalNote() function.\n * @param {number} personId - The identifier for the patient to whom the note belongs.\n * Cerner context variable: PAT_PersonId.\n * @param {number} encounterId - The identifier for the encounter belonging to the patient where\n * this note will be launched. Cerner context variable: VIS_EncntrId.\n * @param {Array<number>} eventIds - An array of `event_id`'s of the clinical note(s) to be displayed.\n * @param {string} windowTitle - The text to be displayed in the first section of the title for the\n * Clinical Notes window.\n * @param {Array<ViewOption>} viewOptionFlags - (optional) View options for the Clinical Notes window.\n * If not provided, defaults to `view-only` with no other options.\n * @param {InheretanceProps} inheritanceProps - (optional) The view and component names and sequences\n * to be used for the Clinical Notes window. If not provided, uses default preferences.\n *\n * @documentation [MPAGES_EVENT - CLINICAL NOTE](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+CLINICALNOTE)\n **/\nexport type ClinicalNoteOpts = {\n personId: number;\n encounterId: number;\n eventIds: Array<number>;\n windowTitle: string;\n viewOptionFlags?: Array<ViewOption>;\n inheritanceProps?: InheretanceProps;\n};\n\n/**\n * Launch a ClinicalNote in Cerner's PowerChart.\n * @param {ClinicalNoteOpts} opts - The parameters passed, as specified in `ClinicalNoteOpts`\n * @returns {MPageEventReturn} - An object containing the `eventString` and `inPowerChart` values.\n *\n * @documentation [MPAGES_EVENT - CLINICAL NOTE](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+CLINICALNOTE)\n **/\nexport const launchClinicalNote = (\n opts: ClinicalNoteOpts\n): MPageEventReturn => {\n const {\n personId,\n encounterId,\n eventIds,\n windowTitle,\n viewOptionFlags,\n } = opts;\n const { viewName, viewSeq, compName, compSeq } = opts.inheritanceProps || {};\n\n let inPowerChart = true;\n const params: Array<string> = [`${personId}`, `${encounterId}`];\n\n const _viewOptsFlags: Array<ViewOption> =\n !viewOptionFlags || viewOptionFlags.length === 0\n ? ['view-only']\n : viewOptionFlags;\n\n params.push(`[${eventIds.join('|')}]`);\n params.push(`${windowTitle}`);\n params.push(`${calculateViewOptionFlag(_viewOptsFlags)}`);\n params.push(`${viewName || ''}`);\n params.push(`${viewSeq || ''}`);\n params.push(`${compName || ''}`);\n params.push(`${compSeq || ''}`);\n\n const eventString = `${params.join('|')}`;\n try {\n window.MPAGES_EVENT('CLINICALNOTE', eventString);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n inPowerChart = false;\n console.warn(`window.MPAGES_EVENT('CLINICALNOTE', '${eventString}')`);\n } else {\n throw e;\n }\n }\n\n return { inPowerChart, eventString };\n};\n\nfunction calculateViewOptionFlag(viewOptionFlags: Array<ViewOption>): number {\n let total = 0;\n viewOptionFlags.forEach(flag => {\n if (flag === 'menu') total += 1;\n if (flag === 'buttons') total += 2;\n if (flag === 'toolbar') total += 4;\n if (flag === 'calculator') total += 8;\n if (flag === 'view-only') total += 16;\n });\n return total;\n}\n","import { MPageEventReturn } from '.';\nimport { outsideOfPowerChartError } from '../utils';\n\n/**\n * A type which represents the parameters to be be passed into the launchPowerForm() function.\n * @param {number} personId - The identifier for the patient to whom the note belongs.\n * Cerner context variable: PAT_PersonId.\n * @param {number} encounterId - The identifier for the encounter belonging to the patient where\n * this note will be launched. Cerner context variable: VIS_EncntrId.\n * @param {string} target - Determines whether to target (open) a \"new form\" of a specified\n * type, a \"completed form\", or a \"new form search\" box.\n * @param {number} targetId - (optional) For a new form, this is the formId (pulled from DCP_FORMS_REF_ID).\n * For a completed form, this is the activityId (pulled from DCP_FORMS_ACTIVITY_ID). This parameter is\n * required only for `new form` or `completed form` targets.\n * @param {string} permissions - (optional) The permissions to open the document with. Choices\n * are: \"modify\" or \"read-only\". When not provided, defaults to \"read-only\".\n *\n * @documentation [MPAGES_EVENT - POWERFORM](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+POWERFORM)\n **/\nexport type PowerFormOpts = {\n personId: number;\n encounterId: number;\n target: 'new form' | 'completed form' | 'new form search';\n targetId?: number;\n permissions?: 'modify' | 'read only';\n};\n\n/**\n * Launch a PowerForm in Cerner's PowerChart.\n * @param {PowerFormOpts} opts - The parameters passed, as specified in `PowerFormOpts`\n * @returns {MPageEventReturn} - An object containing the `eventString` and `inPowerChart` values.\n *\n * @documentation [MPAGES_EVENT - POWERFORM](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+POWERFORM)\n **/\nexport const launchPowerForm = (opts: PowerFormOpts): MPageEventReturn => {\n const { personId, encounterId, target, targetId, permissions } = opts;\n\n if ((target === 'new form' || target === 'completed form') && !targetId) {\n throw new Error(\n \"'targetId' is required for 'new form' and 'completed form' targets.\"\n );\n }\n\n const params: Array<string> = [`${personId}`, `${encounterId}`];\n if (target === 'new form') {\n params.push(`${targetId}`);\n params.push('0');\n }\n if (target === 'completed form') {\n params.push('0');\n params.push(`${targetId}`);\n }\n if (target === 'new form search') {\n params.push('0');\n params.push('0');\n }\n params.push(permissions === 'modify' ? '0' : '1');\n\n let inPowerChart = true;\n const eventString = `${params.join('|')}`;\n\n try {\n window.MPAGES_EVENT('POWERFORM', eventString);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n inPowerChart = false;\n console.warn(`window.MPAGES_EVENT('POWERFORM', '${eventString}')`);\n } else {\n throw e;\n }\n }\n\n return { inPowerChart, eventString };\n};\n","import { MPageEventReturn } from '.';\nimport { outsideOfPowerChartError } from '../utils';\n\n/**\n * A type which represents the parameters to be be passed into the launchPowerNote() function.\n * @param {number} personId - The identifier for the patient to whom the note belongs.\n * Cerner context variable: PAT_PersonId.\n * @param {number} encounterId - The identifier for the encounter belonging to the patient where\n * this note will be launched. Cerner context variable: VIS_EncntrId.\n * @param {string} target - Determines whether to target (open) a \"new\" PowerNote or an \"existing\" PowerNote.\n * @param {number | string} targetId - For a `new` note, this value should be a `string` representing the\n * CKI value for an encounter pathway. For an `existing` note, this value should be a `number` representing\n * the eventId of the note to be opened.\n * corresponds to an encounter pathway.\n * @param {number} eventId - (exclusive option to CKI) An event_id for an existing PowerNote to load.\n *\n * @documentation [MPAGES_EVENT - POWERNOTE](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+POWERNOTE)\n **/\nexport type PowerNoteOpts = {\n personId: number;\n encounterId: number;\n target: 'new' | 'existing';\n targetId: string | number;\n};\n\n/**\n * Launch a PowerNote in Cerner's PowerChart.\n * @param {PowerNoteOpts} opts - The parameters passed, as specified in `PowerNoteOpts`\n * @returns {MPageEventReturn} - An object containing the `eventString` and `inPowerChart` values.\n * @throws {Error} - if there is a type mismatch between the provided option for `target` and `targetId`.\n *\n * @documentation [MPAGES_EVENT - POWERNOTE](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+POWERNOTE)\n **/\nexport const launchPowerNote = (opts: PowerNoteOpts): MPageEventReturn => {\n const { personId, encounterId, target, targetId } = opts;\n\n if (target === 'new' && typeof targetId !== 'string') {\n throw new Error('CKI must be a string when launching a new PowerNote.');\n }\n\n if (target === 'existing' && typeof targetId !== 'number') {\n throw new Error(\n 'eventId must be a number when loading an existing PowerNote.'\n );\n }\n const params: Array<string> = [\n `${personId}`,\n `${encounterId}`,\n `${target === 'new' ? targetId : ''}`,\n `${target === 'existing' ? targetId : 0}`,\n ];\n\n const eventString = `${params.join('|')}`;\n let inPowerChart = true;\n try {\n window.MPAGES_EVENT('POWERNOTE', eventString);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n inPowerChart = false;\n console.warn(`window.MPAGES_EVENT('POWERNOTE', '${eventString}')`);\n } else {\n throw e;\n }\n }\n\n return { eventString, inPowerChart };\n};\n","import { outsideOfPowerChartError } from '../utils';\n\n/**\n * A type which represents the input parameter for an `XmlCclRequest`, which is wrapped by `makeCclRequest`.\n * The parameters are passed in a string, and numbers and strings are interpreted within this string by\n * the presence of quotes within quotes (e.g. single within double or vice versa). By strongly typing\n * the CclCallParam we can ensure that the parameters are always passed in a way that properly represents\n * their type.\n * @param {'string'|'number'} type - The type of the parameter.\n * @param {string} param - The string representing the parameters value.\n */\nexport type CclCallParam = {\n type: 'string' | 'number';\n param: string | number;\n};\n\n/**\n * A type which represents the full set of data required to make an XmlCclRequest, which is wrapped\n * by `makeCclRequest`.\n * @param {string} prg - The name of the CCL program to run, e.g. 12_USER_DETAILS.\n * @param {boolean?} excludeMine - Determines whether or not to include the \"MINE\" parameter as the\n * first parameter in the CCL call. This defaults to `false`, and almost all cases will require\n * the \"MINE\" parameter to be included.\n * @param {CclCallParam[]} params - An array of CclCallParam objects, each of which represents\n * a strongly typed parameter.\n */\nexport type CclOpts = {\n prg: string;\n excludeMine?: boolean;\n params: Array<CclCallParam>;\n};\n\n/**\n * A type functioning as a convience wrapper for several status\n * codes, respresented as strings, that are returned by XMLCclRequest.\n */\nexport type XmlCclStatus =\n | 'success'\n | 'method not allowed'\n | 'invalid state'\n | 'non-fatal error'\n | 'memory error'\n | 'internal server exception'\n | 'status refers to unknown error';\n\n/**\n * A type which represents the full set of data returned from an XmlCclRequest and important, formatted\n * metadata to help with debugging and error management. This is a generic type and data will represent\n * the type `T` which is the type or interface which represents the resolved data from the CCL request.\n */\nexport type CclRequestResponse<T> = {\n meta: {\n responseText: string;\n status: number;\n statusText: XmlCclStatus;\n };\n data: T | undefined;\n};\n\nconst statusCodeMap: Map<number, XmlCclStatus> = new Map();\nstatusCodeMap.set(200, 'success');\nstatusCodeMap.set(405, 'method not allowed');\nstatusCodeMap.set(409, 'invalid state');\nstatusCodeMap.set(492, 'non-fatal error');\nstatusCodeMap.set(493, 'memory error');\nstatusCodeMap.set(500, 'internal server exception');\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use. Of note,\n * use of this requires the `head` of the HTML document contain the following\n * `meta` tag: `<META content='XMLCCLREQUEST' name='discern'>` so that it might\n * interface with the appropriate COM object.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @resolves the `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @rejects with an error message if the CCL request fails.\n *\n * @documentation - [XMLCclRequest](https://wiki.cerner.com/display/MPAGES/MPages+JavaScript+Reference#MPagesJavaScriptReference-XMLCclRequest)\n */\nexport function makeCclRequest<T>(\n opts: CclOpts\n): Promise<CclRequestResponse<T>> {\n const { prg, excludeMine, params } = opts;\n const paramsList = processCclRequestParams(params, excludeMine || false);\n\n return new Promise((resolve, reject) => {\n try {\n // @ts-ignore - From Powerchart context\n const request: XMLCclRequest = window.XMLCclRequest();\n\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n const data: CclRequestResponse<T> = {\n meta: {\n responseText: request.responseText,\n status: request.status,\n statusText:\n statusCodeMap.get(request.status) ||\n 'status refers to unknown error',\n },\n data:\n request.responseText === ''\n ? undefined\n : JSON.parse(request.responseText),\n };\n if (request.readyState === 4) {\n resolve(data);\n } else {\n reject(\n `error with status ${request.status} and readyState ${\n request.readyState\n } on ${prg} with params ${paramsList} returning response text: ${request.responseText ||\n 'no response text'}`\n );\n }\n };\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n reject((e as Error).message);\n } else {\n throw e;\n }\n }\n });\n}\n\n/**\n * A function which processes the CCL request parameters, converting them to a string compatible with an XmlCclRequest.\n * @param params {Array<CclCallParam>} An array of CclCallParam objects, each of which represents\n * @param excludeMine {boolean} Determines whether or not to include the \"MINE\" parameter as the\n * @returns {string} the XmlCclRequest compatible string.\n */\nexport function processCclRequestParams(\n params?: Array<CclCallParam>,\n excludeMine?: boolean\n) {\n params = params || [];\n excludeMine = excludeMine || false;\n\n const updatedParams: Array<CclCallParam> = excludeMine\n ? [...params]\n : [{ type: 'string', param: 'MINE' }, ...params];\n\n const paramString = updatedParams\n .map(({ type, param }) => (type === 'string' ? `'${param}'` : param))\n .join(',');\n\n return paramString;\n}\n","import { MPageEventReturn } from '.';\nimport { outsideOfPowerChartError } from '../utils';\n\n/**\n * Attempts to open a tab with the name given to the `tab` variable in a\n * patients chart given in the context of a given encounter.\n * @param {number} personId - The identifier for the patient to whom the note belongs.\n * Cerner context variable: PAT_PersonId.\n * @param {number} encounterId - The identifier for the encounter belonging to the patient where\n * this note will be launched. Cerner context variable: VIS_EncntrId.\n * @param tab The string which represents the tab to open\n * (case insensitive). Navigation will be made to the first\n * upper-level tab in the chart that that matches the `tab` string\n * If no match is found, then sub-tab names will be searched and\n * navigation made to the first sub-tab that matches\n * the `tab` string. If no matches are found, no navigation will occur.\n * @param quickAdd {boolean} - (optional) If true, will attempt to open the window\n * in a quick add mode. E.g. if the Orders tab is connected to it will\n * attempt to launch the Add Order window so long as Enhanced Navigation is\n * supported by your installation. Defaults to false.\n *\n * @documentation [APPLINK](https://wiki.cerner.com/display/public/MPDEVWIKI/APPLINK)\n */\nexport function openPatientTab(\n personId: number,\n encounterId: number,\n tab: string,\n quickAdd?: boolean\n): MPageEventReturn {\n let inPowerChart = true;\n const eventString = `/PERSONID=${personId} /ENCNTRID=${encounterId} /FIRSTTAB=^${tab.toUpperCase()}${\n quickAdd || false ? '+' : ''\n }^`;\n\n try {\n window.APPLINK(1, '$APP_APPNAME$', eventString);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n inPowerChart = false;\n } else {\n throw e;\n }\n }\n return { eventString, inPowerChart };\n}\n","import { MPageEventReturn } from '.';\nimport { outsideOfPowerChartError } from '../utils';\n\n/**\n * Attempts to open a tab with the name given to the `tab` variable in at the chart organizer\n * level.\n * @param tab The string which represents the tab to open\n * (case insensitive). Navigation will be made to the first\n * upper-level tab in the chart that that matches the `tab` string\n * If no match is found, then sub-tab names will be searched and\n * navigation made to the first sub-tab that matches\n * the `tab` string. If no matches are found, no navigation will occur.\n *\n * @documentation [APPLINK](https://wiki.cerner.com/display/public/MPDEVWIKI/APPLINK)\n */\nexport function openOrganizerTab(tab: string): MPageEventReturn {\n let inPowerChart = true;\n const eventString = `/ORGANIZERTAB=^${tab}^`;\n try {\n window.APPLINK(0, 'Powerchart.exe', eventString);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n inPowerChart = false;\n } else {\n throw e;\n }\n }\n return { eventString, inPowerChart };\n}\n","/**\n * A type for the options that can be passed to the makeMpageOrder function.\n * @action `launch moew` - Launches the MOEW.\n * @action `activate existing` - Activates an existing order.\n * @action `cancel-discontinue` - Cancels and discontinues an existing order.\\n\n * @action `cancel-reorder` - Cancels and reorders an existing order.\n * @action `clear actions` - Clear actions of a future existing order.\n * @action `convert inpatient` - Converts a prescription order into an inpatient order.\n * @action `convert prescription` - Converts an inpatient order into a prescription.\n * @action `modify` - Modifies an existing future order.\n * @action `new order` - Creates a new order.\n * @action `renew` - Renews an existing non-prescription order.\n * @action `renew prescription` - Renews an existing prescription order.\n * @action `copy existing` - Copy an existing order.\n * @action `resume` - Resumes an existing order.\n * @action `suspend` - Suspends an existing order.\n *\n * @documentation [MPAGES_EVENT - ORDER](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+ORDERS)\n */\nexport type OrderAction =\n | 'launch moew'\n | 'activate existing'\n | 'cancel-discontinue'\n | 'cancel-reorder'\n | 'clear actions'\n | 'convert inpatient'\n | 'convert prescription'\n | 'modify'\n | 'new order'\n | 'renew'\n | 'renew prescription'\n | 'copy existing'\n | 'resume'\n | 'suspend';\n\n/**\n * @param `synonymId` - The Cerner synonym_id for the order to be generated.\n * @param `orderSentenceId` - (optional) The order sentence id to be associated with the new order.\n * This is an accompanied value to the synonymId and provides specificity to the order type.\n * @param `nomenclatureId` - (optional) The nomenclature id, or associated problem/diagnosis, to be associated with the new order.\n * @param `interaction` - (optional) Defines when an interaction between the provider and PowerChart takes place only at sign time, or impromptu.\n * @param `origination` - (optional) Defines the origination of the order as `satellite`, `prescription`, or `normal`.\n *\n * @documentation [MPAGES_EVENT - ORDER](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+ORDERS)\n */\nexport type NewOrderStrOpts = {\n synonymId: number;\n orderSentenceId?: number;\n nomenclatureId?: number;\n interactionCheck?: 'on sign' | 'default';\n origination?: 'satellite' | 'prescription' | 'normal';\n};\n\n/**\n * @param {number} orderId - (optional) The order id value for the order to activate.\n * @param {NewOrderOpts}newOrderOpts - (optional) The options for the new order.\n *\n * @documentation [MPAGES_EVENT - ORDER](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+ORDERS)\n */\nexport type OrderStrOpts = {\n orderId?: number;\n newOrderOpts?: NewOrderStrOpts;\n};\n\n/**\n * Creates a new pipe-delimited MPage Order string.\n * @since 0.4.0\n * @param {OrderAction} action - The action to be performed on the order.\n * @param {OrderStrOpts} opts - (optional) The options for the order.\n * @returns {string} - A pipe-delimited string which can be integrated into an MPage Event for one or more orders.\n * @throws {Error} - If the action is not a valid order action.\n *\n * @documentation [MPAGES_EVENT - ORDER](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+ORDERS)\n */\nexport const orderString = (\n action: OrderAction,\n opts?: OrderStrOpts\n): string => {\n const { orderId, newOrderOpts } = opts || {};\n const {\n synonymId,\n orderSentenceId,\n nomenclatureId,\n interactionCheck: interaction,\n origination,\n } = newOrderOpts || {};\n\n let params: Array<string> = [orderActionMap.get(action)];\n\n switch (action) {\n case 'launch moew':\n params = params.concat(['0', '0', '0', '0', '0']);\n break;\n case 'new order':\n if (!synonymId)\n throw new Error(`synonymId is required for the '${action}' action`);\n params = params.concat([\n `${synonymId}`,\n `${originationMap.get(origination) || 0}`,\n `${orderSentenceId || 0}`,\n `${nomenclatureId || 0}`,\n `${interactionMap.get(interaction) || 0}`,\n ]);\n break;\n default:\n if (!orderId)\n throw new Error(`orderId is required for the '${action}' action`);\n params = params.concat([`${orderId}`]);\n break;\n }\n\n return `{${params.join('|')}}`;\n};\n\nconst orderActionMap = new Map()\n .set('launch moew', 'ORDER')\n .set('activate existing', 'ACTIVATE')\n .set('cancel-discontinue', 'CANCEL DC')\n .set('cancel-reorder', 'CANCEL REORD')\n .set('clear actions', 'CLEAR')\n .set('convert inpatient', 'CONVERT_INPAT')\n .set('convert prescription', 'CONVERT_RX')\n .set('modify', 'MODIFY')\n .set('new order', 'ORDER')\n .set('renew', 'RENEW')\n .set('renew prescription', 'RENEW_RX')\n .set('copy existing', 'REPEAT')\n .set('resume', 'RESUME')\n .set('suspend', 'SUSPEND');\n\nconst originationMap = new Map()\n .set('satellite', '5')\n .set('prescription', '1')\n .set('normal', '0');\n\nconst interactionMap = new Map().set('on sign', '1').set('default', '0');\n","import { warnOutsideOfPowerChart } from '../utils';\nimport { outsideOfPowerChartError } from '../utils/outsideOfPowerChartError';\n\nconst launchViewMap = new Map()\n .set('search', 8)\n .set('profile', 16)\n .set('signature', 32);\n\nconst tabsMap = new Map<string, { tab: number; display: number }>()\n .set('orders', { tab: 2, display: 0 })\n .set('power orders', { tab: 2, display: 127 })\n .set('medications', { tab: 3, display: 0 })\n .set('power medications', { tab: 3, display: 127 });\n\n/**\n * @action `targetTab` - (optional) Sets the tab to be displayed, with and without power orders.\n * If not provided, will default to `power orders`, that is the orders tab with power orders enabled.\n * @action `launchView` - (optional) Sets the view to be displayed.If not provided,\n * will default to `search` view.\n * @action `enablePowerPlans` - (optional) Enables power plans in the MOEW. Power plans are disabled by default.\n * **NOTE**: Our internal testing suggests there is a _PowerChart_ bug relating to enabling this option\n * where making MPAGES_EVENT calls, through `submitOrders`, in series with this option enabled will lead\n * to some MPAGES_EVENT calls failing to be invoked. Please keep this in mind when enabling this option.\n * @action `silentSign` - (optional) Signs the orders silently. Orders are not signed silently by default.\n *\n * @documentation [MPAGES_EVENT - ORDER](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+ORDERS)\n */\nexport type SubmitOrderOpts = {\n targetTab?: 'orders' | 'power orders' | 'medications' | 'power medications';\n launchView?: 'search' | 'profile' | 'signature';\n enablePowerPlans?: boolean;\n signSilently?: boolean;\n};\n\n/**\n * Submit orders for a patient in a given encounter through the Cerner PowerChart MPage Event interface.\n * By default, power plans are disabled (potential bug in PowerChart), the target tab is set to order\n * with power orders enabled, and will launch to the signature view.\n * @param {number} personId - The identifier for the patient to whom the note belongs.\n * Cerner context variable: PAT_PersonId.\n * @param {number} encounterId - The identifier for the encounter belonging to the patient where\n * this note will be launched. Cerner context variable: VIS_EncntrId.\n * @param orders - The orders to be submitted. Orders are given in the form of an\n * Cerner MPage Order string of pipe-delimited parameters.\n * @param opts - (optional) User defined options for the order submission event.\n * @returns an object with the order `eventString` and a boolean flag set to notify the user if\n * the attempt was made outside of PowerChart, `inPowerChart`.\n *\n * @documentation [MPAGES_EVENT - ORDER](https://wiki.cerner.com/display/public/MPDEVWIKI/MPAGES_EVENT+-+ORDERS)\n */\nexport const submitOrders = (\n personId: number,\n encounterId: number,\n orders: Array<string>,\n opts?: SubmitOrderOpts\n): { eventString: string; inPowerChart: boolean } => {\n let { targetTab, launchView, enablePowerPlans, signSilently } = opts || {};\n if (!targetTab) targetTab = 'power orders';\n if (!launchView) launchView = 'signature';\n\n let inPowerChart = true;\n\n let params: Array<string> = [\n `${personId}`,\n `${encounterId}`,\n orders.join(''),\n ];\n\n params.push(enablePowerPlans ? '24' : '0');\n\n const { tab, display } = tabsMap.get(targetTab) || { tab: 2, display: 127 };\n params.push(`{${tab}|${display}}`);\n\n params.push(`${launchViewMap.get(launchView) || 32}`);\n\n params.push(`${signSilently ? '1' : '0'}`);\n\n const eventString = params.join('|');\n try {\n window.MPAGES_EVENT('ORDERS', eventString);\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n inPowerChart = false;\n warnOutsideOfPowerChart(eventString);\n } else {\n throw e;\n }\n }\n return { eventString, inPowerChart };\n};\n","import { MPageOrder } from '.';\nimport { outsideOfPowerChartError, warnOutsideOfPowerChart } from './utils';\n\nclass MPageOrderEvent {\n private _orders: Array<MPageOrder>;\n getOrders = () => this._orders;\n\n private _tabList: { tab: number; tabDisplayFlag: number } = {\n tab: 0,\n tabDisplayFlag: 0,\n };\n getTabList = () => this._tabList;\n\n private _personId: number = 0;\n getPersonId = () => this._personId;\n\n private _encounterId: number = 0;\n getEncounterId = () => this._encounterId;\n\n private _powerPlanFlag: number = 0;\n getPowerPlanFlag = () => this._powerPlanFlag;\n\n private _defaultDisplay: number = 0;\n getDefaultDisplay = () => this._defaultDisplay;\n\n private _silentSignFlag: number = 0;\n getSilentSignFlag = () => this._silentSignFlag;\n\n constructor() {\n this._orders = [];\n this._tabList = { tab: 0, tabDisplayFlag: 0 };\n // Disable PowerPlans by default\n this._powerPlanFlag = 0;\n // Disable PowerOrders by default\n this._tabList.tabDisplayFlag = 0;\n this.customizeOrderListProfile();\n this.launchOrderProfile();\n // Do NOT sign silently by default\n this._silentSignFlag = 0;\n }\n\n forPerson(id: number) {\n this._personId = id;\n return this;\n }\n\n forEncounter(id: number) {\n this._encounterId = id;\n return this;\n }\n\n addOrders(orders: Array<MPageOrder> | MPageOrder) {\n if (!Array.isArray(orders)) {\n orders = [orders];\n }\n this._orders = this._orders.concat(orders);\n return this;\n }\n\n enablePowerPlans() {\n this._powerPlanFlag = 24;\n return this;\n }\n\n customizeOrderListProfile() {\n this._tabList.tab = 2;\n return this;\n }\n\n customizeMedicationListProfile() {\n this._tabList.tab = 3;\n return this;\n }\n\n enablePowerOrders() {\n this._tabList.tabDisplayFlag = 127;\n return this;\n }\n\n launchOrderSearch() {\n this._defaultDisplay = 8;\n return this;\n }\n\n launchOrderProfile() {\n this._defaultDisplay = 16;\n return this;\n }\n\n launchOrdersForSignature() {\n this._defaultDisplay = 32;\n return this;\n }\n\n signSilently() {\n this._silentSignFlag = 1;\n return this;\n }\n\n send() {\n try {\n window.MPAGES_EVENT('ORDERS', this.toString());\n } catch (e) {\n if (outsideOfPowerChartError(e)) {\n warnOutsideOfPowerChart(this.toString());\n } else {\n throw e;\n }\n }\n }\n\n toString(): string {\n const head = `${this._personId}|${this._encounterId}|`;\n let body: string = '';\n this._orders.forEach(order => {\n body += order.toString();\n });\n const tail = `|${this._powerPlanFlag}|{${this._tabList.tab}|${this._tabList.tabDisplayFlag}}|${this._defaultDisplay}|${this._silentSignFlag}`;\n\n return `${head}${body}${tail}`;\n }\n}\n\nexport { MPageOrderEvent };\n","/**\n * Options for a new order\n * @param {boolean} isRxOrder Marks the order order as a prescription. Is mutually exclusive from\n * isSatelliteOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {boolean} isSatelliteOrder Moarks the order origination as satellite. Is mutually\n * exclusive from isRxOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {number} orderSentenceId The optional Cerner order_sentence_id to be associated with\n * the new order. Field will be set to 0 if undefined.\n * @param {number} nomenclatureId The optional Cerner nomenclature_id to be associated with the\n * new order. Field will be set to 0 if undefined.\n * @param {boolean} skipInteractionCheckUntilSign Determines cerner sign-time interaction\n * checking. A value of true skips checking for interactions until orders are signed, false\n * will not. Field will be set to false if left undefined; this resolves to 0 when built.\n */\nexport type NewOrderOpts = {\n isRxOrder?: boolean;\n isSatelliteOrder?: boolean;\n orderSentenceId?: number;\n nomenclatureId?: number;\n skipInteractionCheckUntilSign?: boolean;\n};\n\nexport class MPageOrder {\n private _orderAction: string = '';\n getOrderAction = () => this._orderAction;\n\n private _orderId: number = 0;\n getOrderId = () => this._orderId;\n\n private _synonymId: number = 0;\n getSynonymId = () => this._synonymId;\n\n private _orderOrigination: number = 0;\n getOrderOrigination = () => this._orderOrigination;\n\n private _orderSentenceId: number = 0;\n getOrderSentenceId = () => this._orderSentenceId;\n\n private _nomenclatureId: number = 0;\n getNomenclatureId = () => this._nomenclatureId;\n\n private _signTimeInteraction: number = 0;\n getSignTimeInteraction = () => this._signTimeInteraction;\n\n /**\n * Creates a new MPageOrder with the order action 'ACTIVATE', which is the prototype for activating an existing future order.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willActivate(orderId: number) {\n this._orderAction = 'ACTIVATE';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL DC', which is the prototype for canceling and discontinuing an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelDiscontinue(orderId: number) {\n this._orderAction = 'CANCEL DC';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL REORD', which is the prototype for cancelling and reordering an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelReorder(orderId: number) {\n this._orderAction = 'CANCEL REORD';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CLEAR', which is the prototype for clearing actions of an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willClear(orderId: number) {\n this._orderAction = 'CLEAR';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_INPAT', which is the prototype for converting a prescription order into an inpatient order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertInpatient(orderId: number) {\n this._orderAction = 'CONVERT_INPAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_RX', which is the prototype for converting an inpatient order into a prescription.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertToPrescriptionOrder(orderId: number) {\n this._orderAction = 'CONVERT_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'MODIFY', which is the prototype for modifying an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willModify(orderId: number) {\n this._orderAction = 'MODIFY';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPage Order with order action 'ORDER'.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} synonymId The Cerner synonym_id to be associated with the new order. Must be set.\n * @param {NewOrderOpts} options required when making a new order\n * @returns {this} Returns itself to continue chaining method calls.\n * default to a normal order type.\n * @throws Error if `isRxOrder` and `isSatelliteOrder` are both set to true. These two are mutually exclusive and setting\n * both creates underfined behavior with respect the order origination field.\n * @example\n * m.willMakeNewOrder(34, true, 13, 42, true).toString() => \"{'ORDER'|34|5|1342|1}\"\n */\n willMakeNewOrder(synonymId: number, opts?: NewOrderOpts) {\n const {\n isRxOrder,\n isSatelliteOrder,\n orderSentenceId,\n nomenclatureId,\n skipInteractionCheckUntilSign,\n } = opts || {};\n\n if (isRxOrder && isSatelliteOrder)\n throw new Error('must select either isRxOrder or isSatelliteOrder');\n this._orderAction = 'ORDER';\n this._synonymId = synonymId;\n this._orderSentenceId = orderSentenceId || 0;\n this._nomenclatureId = nomenclatureId || 0;\n this._signTimeInteraction = skipInteractionCheckUntilSign ? 1 : 0;\n this._orderOrigination = isSatelliteOrder ? 5 : isRxOrder ? 1 : 0;\n\n return this;\n }\n\n /**\n * Creates a new MPageOrder with the order action 'RENEW', which is the prototype for reviewing an existing non-prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewNonPrescription(orderId: number) {\n this._orderAction = 'RENEW';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RENEW_RX', which is the prototype for renewing an existing prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewPrescription(orderId: number) {\n this._orderAction = 'RENEW_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'REPEAT', which is the prototype for copying an order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCopyExistingOrder(orderId: number) {\n this._orderAction = 'REPEAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RESUME', which is the prototype for resuming a suspended order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willResumeSuspendedOrder(orderId: number) {\n this._orderAction = 'RESUME';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'SUSPEND', which is the prototype for suspending an existing order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willSuspend(orderId: number) {\n this._orderAction = 'SUSPEND';\n this._orderId = orderId;\n return this;\n }\n\n /**\n * Overrides the toString() method for representing the objects internal state as a string.\n *\n * @since 0.1.0\n * @returns {string} string representation of MPageOrder's internal state\n */\n toString(): string {\n return this._orderAction === 'ORDER'\n ? `{${this._orderAction}|${this._synonymId}|${this._orderOrigination}|${this._orderSentenceId}|${this._nomenclatureId}|${this._signTimeInteraction}}`\n : `{${this._orderAction}|${this._orderId}}`;\n }\n}\n"],"names":["outsideOfPowerChartError","e","TypeError","message","ReferenceError","warnAttemptedOrdersOutsideOfPowerChart","eventString","console","warn","launchClinicalNote","opts","personId","encounterId","eventIds","windowTitle","viewOptionFlags","_ref","inheritanceProps","viewName","viewSeq","compName","compSeq","inPowerChart","params","_viewOptsFlags","length","push","join","calculateViewOptionFlag","window","MPAGES_EVENT","total","forEach","flag","launchPowerForm","target","targetId","permissions","Error","launchPowerNote","statusCodeMap","Map","set","makeCclRequest","prg","excludeMine","paramsList","processCclRequestParams","Promise","resolve","reject","request","XMLCclRequest","open","send","onreadystatechange","data","meta","responseText","status","statusText","get","undefined","JSON","parse","readyState","updatedParams","concat","type","param","paramString","map","openPatientTab","tab","quickAdd","toUpperCase","APPLINK","openOrganizerTab","orderString","action","orderId","newOrderOpts","_ref2","synonymId","orderSentenceId","nomenclatureId","interaction","interactionCheck","origination","orderActionMap","originationMap","interactionMap","launchViewMap","tabsMap","display","submitOrders","orders","targetTab","launchView","enablePowerPlans","signSilently","warnOutsideOfPowerChart","MPageOrderEvent","_this","_orders","tabDisplayFlag","_tabList","_personId","_encounterId","_powerPlanFlag","_defaultDisplay","_silentSignFlag","customizeOrderListProfile","launchOrderProfile","_proto","prototype","forPerson","id","forEncounter","addOrders","Array","isArray","customizeMedicationListProfile","enablePowerOrders","launchOrderSearch","launchOrdersForSignature","toString","head","body","order","tail","MPageOrder","_orderAction","_orderId","_synonymId","_orderOrigination","_orderSentenceId","_nomenclatureId","_signTimeInteraction","willActivate","willCancelDiscontinue","willCancelReorder","willClear","willConvertInpatient","willConvertToPrescriptionOrder","willModify","willMakeNewOrder","isRxOrder","isSatelliteOrder","skipInteractionCheckUntilSign","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend"],"mappings":";;;;AAAA;;;;;;SAMgBA,wBAAwBA,CAACC,CAAU;EACjD,OACGA,CAAC,YAAYC,SAAS,IACrBD,CAAC,CAACE,OAAO,KAAK,uCAAuC,IACtDF,CAAC,YAAYC,SAAS,IACrBD,CAAC,CAACE,OAAO,KAAK,wCAAyC,IACxDF,CAAC,YAAYC,SAAS,IACrBD,CAAC,CAACE,OAAO,KAAK,kCAAmC,IAClDF,CAAC,YAAYG,cAAc,IAAIH,CAAC,CAACE,OAAO,KAAK,uBAAwB;AAE1E;;AChBO,IAAME,sCAAsC,GAAG,SAAzCA,sCAAsCA,CACjDC,WAAmB;EAEnBC,OAAO,CAACC,IAAI,qCAAmCF,WAAW,QAAK;AACjE,CAAC;;ACwDD;;;;;;;AAOA,IAAaG,kBAAkB,GAAG,SAArBA,kBAAkBA,CAC7BC,IAAsB;EAEtB,IACEC,QAAQ,GAKND,IAAI,CALNC,QAAQ;IACRC,WAAW,GAITF,IAAI,CAJNE,WAAW;IACXC,QAAQ,GAGNH,IAAI,CAHNG,QAAQ;IACRC,W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C,MAAA,CAMAY,QAAQ,GAAR,SAAAA;IACE,OAAO,IAAI,CAACM,YAAY,KAAK,OAAO,SAC5B,IAAI,CAACA,YAAY,SAAI,IAAI,CAACE,UAAU,SAAI,IAAI,CAACC,iBAAiB,SAAI,IAAI,CAACC,gBAAgB,SAAI,IAAI,CAACC,eAAe,SAAI,IAAI,CAACC,oBAAoB,eAC5I,IAAI,CAACN,YAAY,SAAI,IAAI,CAACC,QAAQ,MAAG;GAC9C;EAAA,OAAAF,UAAA;AAAA;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";function t(t){return t instanceof TypeError&&"window.MPAGES_EVENT is not a function"===t.message||t instanceof TypeError&&"window.XMLCclRequest is not a function"===t.message||t instanceof ReferenceError&&"window is not defined"===t.message}Object.defineProperty(exports,"__esModule",{value:!0});var e=function(t){console.warn("window.MPAGES_EVENT('ORDERS', '"+t+"')")},r=new Map;r.set(200,"success"),r.set(405,"method not allowed"),r.set(409,"invalid state"),r.set(492,"non-fatal error"),r.set(493,"memory error"),r.set(500,"internal server exception");var n=(new Map).set("launch moew","ORDER").set("activate existing","ACTIVATE").set("cancel-discontinue","CANCEL DC").set("cancel-reorder","CANCEL REORD").set("clear actions","CLEAR").set("convert inpatient","CONVERT_INPAT").set("convert prescription","CONVERT_RX").set("modify","MODIFY").set("new order","ORDER").set("renew","RENEW").set("renew prescription","RENEW_RX").set("copy existing","REPEAT").set("resume","RESUME").set("suspend","SUSPEND"),i=(new Map).set("satellite","5").set("prescription","1").set("normal","0"),o=(new Map).set("on sign","1").set("default","0"),s=(new Map).set("search",8).set("profile",16).set("signature",32),a=(new Map).set("orders",{tab:2,display:0}).set("power orders",{tab:2,display:127}).set("medications",{tab:3,display:0}).set("power medications",{tab:3,display:127}),c=function(){function r(){var t=this;this.getOrders=function(){return t._orders},this._tabList={tab:0,tabDisplayFlag:0},this.getTabList=function(){return t._tabList},this._personId=0,this.getPersonId=function(){return t._personId},this._encounterId=0,this.getEncounterId=function(){return t._encounterId},this._powerPlanFlag=0,this.getPowerPlanFlag=function(){return t._powerPlanFlag},this._defaultDisplay=0,this.getDefaultDisplay=function(){return t._defaultDisplay},this._silentSignFlag=0,this.getSilentSignFlag=function(){return t._silentSignFlag},this._orders=[],this._tabList={tab:0,tabDisplayFlag:0},this._powerPlanFlag=0,this._tabList.tabDisplayFlag=0,this.customizeOrderListProfile(),this.launchOrderProfile(),this._silentSignFlag=0}var n=r.prototype;return n.forPerson=function(t){return this._personId=t,this},n.forEncounter=function(t){return this._encounterId=t,this},n.addOrders=function(t){return Array.isArray(t)||(t=[t]),this._orders=this._orders.concat(t),this},n.enablePowerPlans=function(){return this._powerPlanFlag=24,this},n.customizeOrderListProfile=function(){return this._tabList.tab=2,this},n.customizeMedicationListProfile=function(){return this._tabList.tab=3,this},n.enablePowerOrders=function(){return this._tabList.tabDisplayFlag=127,this},n.launchOrderSearch=function(){return this._defaultDisplay=8,this},n.launchOrderProfile=function(){return this._defaultDisplay=16,this},n.launchOrdersForSignature=function(){return this._defaultDisplay=32,this},n.signSilently=function(){return this._silentSignFlag=1,this},n.send=function(){try{window.MPAGES_EVENT("ORDERS",this.toString())}catch(r){if(!t(r))throw r;e(this.toString())}},n.toString=function(){var t=this._personId+"|"+this._encounterId+"|",e="";return this._orders.forEach((function(t){e+=t.toString()})),""+t+e+"|"+this._powerPlanFlag+"|{"+this._tabList.tab+"|"+this._tabList.tabDisplayFlag+"}|"+this._defaultDisplay+"|"+this._silentSignFlag},r}();exports.MPageOrder=function(){function t(){var t=this;this._orderAction="",this.getOrderAction=function(){return t._orderAction},this._orderId=0,this.getOrderId=function(){return t._orderId},this._synonymId=0,this.getSynonymId=function(){return t._synonymId},this._orderOrigination=0,this.getOrderOrigination=function(){return t._orderOrigination},this._orderSentenceId=0,this.getOrderSentenceId=function(){return t._orderSentenceId},this._nomenclatureId=0,this.getNomenclatureId=function(){return t._nomenclatureId},this._signTimeInteraction=0,this.getSignTimeInteraction=function(){return t._signTimeInteraction}}var e=t.prototype;return e.willActivate=function(t){return this._orderAction="ACTIVATE",this._orderId=t,this},e.willCancelDiscontinue=function(t){return this._orderAction="CANCEL DC",this._orderId=t,this},e.willCancelReorder=function(t){return this._orderAction="CANCEL REORD",this._orderId=t,this},e.willClear=function(t){return this._orderAction="CLEAR",this._orderId=t,this},e.willConvertInpatient=function(t){return this._orderAction="CONVERT_INPAT",this._orderId=t,this},e.willConvertToPrescriptionOrder=function(t){return this._orderAction="CONVERT_RX",this._orderId=t,this},e.willModify=function(t){return this._orderAction="MODIFY",this._orderId=t,this},e.willMakeNewOrder=function(t,e){var r=e||{},n=r.isRxOrder,i=r.isSatelliteOrder,o=r.orderSentenceId,s=r.nomenclatureId,a=r.skipInteractionCheckUntilSign;if(n&&i)throw new Error("must select either isRxOrder or isSatelliteOrder");return this._orderAction="ORDER",this._synonymId=t,this._orderSentenceId=o||0,this._nomenclatureId=s||0,this._signTimeInteraction=a?1:0,this._orderOrigination=i?5:n?1:0,this},e.willRenewNonPrescription=function(t){return this._orderAction="RENEW",this._orderId=t,this},e.willRenewPrescription=function(t){return this._orderAction="RENEW_RX",this._orderId=t,this},e.willCopyExistingOrder=function(t){return this._orderAction="REPEAT",this._orderId=t,this},e.willResumeSuspendedOrder=function(t){return this._orderAction="RESUME",this._orderId=t,this},e.willSuspend=function(t){return this._orderAction="SUSPEND",this._orderId=t,this},e.toString=function(){return"ORDER"===this._orderAction?"{"+this._orderAction+"|"+this._synonymId+"|"+this._orderOrigination+"|"+this._orderSentenceId+"|"+this._nomenclatureId+"|"+this._signTimeInteraction+"}":"{"+this._orderAction+"|"+this._orderId+"}"},t}(),exports.MPageOrderEvent=c,exports.launchClinicalNote=function(e){var r=e.windowTitle,n=e.viewOptionFlags,i=e.viewName,o=e.viewSeq,s=e.compName,a=e.compSeq,c=!0,d=[""+e.personId,""+e.encounterId];d.push("["+e.eventIds.join("|")+"]"),d.push(""+r),d.push(""+function(t){var e=0;return t.forEach((function(t){"menu"===t&&(e+=1),"buttons"===t&&(e+=2),"toolbar"===t&&(e+=4),"calculator"===t&&(e+=8),"view-only"===t&&(e+=16)})),e}(n)),d.push(""+i),d.push(""+o),d.push(""+s),d.push(""+a);var u=""+d.join("|");try{window.MPAGES_EVENT("CLINICALNOTE",u)}catch(e){if(!t(e))throw e;c=!1,console.warn("window.MPAGES_EVENT('CLINICALNOTE', '"+u+"')")}return{inPowerChart:c,eventString:u}},exports.launchPowerForm=function(e){var r=e.personId,n=e.encounterId,i=e.target,o=e.targetId,s=e.permissions;if(("new form"===i||"completed form"===i)&&!o)throw new Error("'targetId' is required for 'new form' and 'completed form' targets.");var a=[""+r,""+n];"new form"===i&&(a.push(""+o),a.push("0")),"completed form"===i&&(a.push("0"),a.push(""+o)),"new form search"===i&&(a.push("0"),a.push("0")),a.push("modify"===s?"0":"1");var c=!0,d=""+a.join("|");try{window.MPAGES_EVENT("POWERFORM",d)}catch(e){if(!t(e))throw e;c=!1,console.warn("window.MPAGES_EVENT('POWERFORM', '"+d+"')")}return{inPowerChart:c,eventString:d}},exports.launchPowerNote=function(e){var r=e.personId,n=e.encounterId,i=e.CKI,o=e.eventId;if(!i&&!o)throw new Error("Either 'CKI' or 'eventId' is required.");var s=""+[""+r,""+n,""+(!o&&i||""),""+(o||0)].join("|"),a=!0;try{window.MPAGES_EVENT("POWERNOTE",s)}catch(e){if(!t(e))throw e;a=!1,console.warn("window.MPAGES_EVENT('POWERNOTE', '"+s+"')")}return{eventString:s,inPowerChart:a}},exports.makeCclRequest=function(e){var n,i=e.prg,o=(n=(n=e.params)||[],(e.excludeMine?[].concat(n):[{type:"string",param:"MINE"}].concat(n)).map((function(t){var e=t.param;return"string"===t.type?"'"+e+"'":e})).join(","));return new Promise((function(e,n){try{var s=window.XMLCclRequest();s.open("GET",""+i),s.send(o),s.onreadystatechange=function(){var t={meta:{responseText:s.responseText,status:s.status,statusText:r.get(s.status)||"status refers to unknown error"},data:""===s.responseText?void 0:JSON.parse(s.responseText)};4===s.readyState?e(t):n("error with status "+s.status+" and readyState "+s.readyState+" on "+i+" with params "+o+" returning response text: "+(s.responseText||"no response text"))}}catch(e){if(!t(e))throw e;n(e.message)}}))},exports.openOrganizerTab=function(e){try{window.APPLINK(0,"Powerchart.exe","/ORGANIZERTAB=^"+e+"^")}catch(r){if(!t(r))throw r;console.warn('window.APPLINK("Powerchart.exe", "/ORGANIZERTAB=^'+e+'^")')}},exports.openPatientTab=function(e,r,n,i){var o="/PERSONID="+e+" /ENCNTRID="+r+" /FIRSTTAB=^"+n.toUpperCase()+(i?"+":"")+"^";try{window.APPLINK(1,"$APP_APPNAME$",o)}catch(e){if(!t(e))throw e;console.warn('window.APPLINK(1, "$APP_NAME$", \''+o+"')")}},exports.orderString=function(t,e){var r=e||{},s=r.orderId,a=r.newOrderOpts||{},c=a.synonymId,d=a.orderSentenceId,u=a.nomenclatureId,h=a.interactionCheck,l=a.origination,w=[n.get(t)];switch(t){case"launch moew":w=w.concat(["0","0","0","0","0"]);break;case"new order":if(!c)throw new Error("synonymId is required for the '"+t+"' action");w=w.concat([""+c,""+(i.get(l)||0),""+(d||0),""+(u||0),""+(o.get(h)||0)]);break;default:if(!s)throw new Error("orderId is required for the '"+t+"' action");w=w.concat([""+s])}return"{"+w.join("|")+"}"},exports.submitOrders=function(r,n,i,o){var c=o||{},d=c.targetTab,u=c.launchView,h=c.disablePowerPlans,l=c.signSilently;d||(d="power orders"),u||(u="signature");var w=!0,p=[""+r,""+n,i.join("")];p.push(h?"0":"24");var f=a.get(d)||{tab:2,display:127};p.push("{"+f.tab+"|"+f.display+"}"),p.push(""+(s.get(u)||32)),p.push(l?"1":"0");var _=p.join("|");try{window.MPAGES_EVENT("ORDERS",_)}catch(r){if(!t(r))throw r;w=!1,e(_)}return{eventString:_,inPowerChart:w}};
1
+ "use strict";function t(t){return t instanceof TypeError&&"window.MPAGES_EVENT is not a function"===t.message||t instanceof TypeError&&"window.XMLCclRequest is not a function"===t.message||t instanceof TypeError&&"window.APPLINK is not a function"===t.message||t instanceof ReferenceError&&"window is not defined"===t.message}Object.defineProperty(exports,"__esModule",{value:!0});var e=function(t){console.warn("window.MPAGES_EVENT('ORDERS', '"+t+"')")},r=new Map;r.set(200,"success"),r.set(405,"method not allowed"),r.set(409,"invalid state"),r.set(492,"non-fatal error"),r.set(493,"memory error"),r.set(500,"internal server exception");var n=(new Map).set("launch moew","ORDER").set("activate existing","ACTIVATE").set("cancel-discontinue","CANCEL DC").set("cancel-reorder","CANCEL REORD").set("clear actions","CLEAR").set("convert inpatient","CONVERT_INPAT").set("convert prescription","CONVERT_RX").set("modify","MODIFY").set("new order","ORDER").set("renew","RENEW").set("renew prescription","RENEW_RX").set("copy existing","REPEAT").set("resume","RESUME").set("suspend","SUSPEND"),i=(new Map).set("satellite","5").set("prescription","1").set("normal","0"),o=(new Map).set("on sign","1").set("default","0"),s=(new Map).set("search",8).set("profile",16).set("signature",32),a=(new Map).set("orders",{tab:2,display:0}).set("power orders",{tab:2,display:127}).set("medications",{tab:3,display:0}).set("power medications",{tab:3,display:127}),c=function(){function r(){var t=this;this.getOrders=function(){return t._orders},this._tabList={tab:0,tabDisplayFlag:0},this.getTabList=function(){return t._tabList},this._personId=0,this.getPersonId=function(){return t._personId},this._encounterId=0,this.getEncounterId=function(){return t._encounterId},this._powerPlanFlag=0,this.getPowerPlanFlag=function(){return t._powerPlanFlag},this._defaultDisplay=0,this.getDefaultDisplay=function(){return t._defaultDisplay},this._silentSignFlag=0,this.getSilentSignFlag=function(){return t._silentSignFlag},this._orders=[],this._tabList={tab:0,tabDisplayFlag:0},this._powerPlanFlag=0,this._tabList.tabDisplayFlag=0,this.customizeOrderListProfile(),this.launchOrderProfile(),this._silentSignFlag=0}var n=r.prototype;return n.forPerson=function(t){return this._personId=t,this},n.forEncounter=function(t){return this._encounterId=t,this},n.addOrders=function(t){return Array.isArray(t)||(t=[t]),this._orders=this._orders.concat(t),this},n.enablePowerPlans=function(){return this._powerPlanFlag=24,this},n.customizeOrderListProfile=function(){return this._tabList.tab=2,this},n.customizeMedicationListProfile=function(){return this._tabList.tab=3,this},n.enablePowerOrders=function(){return this._tabList.tabDisplayFlag=127,this},n.launchOrderSearch=function(){return this._defaultDisplay=8,this},n.launchOrderProfile=function(){return this._defaultDisplay=16,this},n.launchOrdersForSignature=function(){return this._defaultDisplay=32,this},n.signSilently=function(){return this._silentSignFlag=1,this},n.send=function(){try{window.MPAGES_EVENT("ORDERS",this.toString())}catch(r){if(!t(r))throw r;e(this.toString())}},n.toString=function(){var t=this._personId+"|"+this._encounterId+"|",e="";return this._orders.forEach((function(t){e+=t.toString()})),""+t+e+"|"+this._powerPlanFlag+"|{"+this._tabList.tab+"|"+this._tabList.tabDisplayFlag+"}|"+this._defaultDisplay+"|"+this._silentSignFlag},r}();exports.MPageOrder=function(){function t(){var t=this;this._orderAction="",this.getOrderAction=function(){return t._orderAction},this._orderId=0,this.getOrderId=function(){return t._orderId},this._synonymId=0,this.getSynonymId=function(){return t._synonymId},this._orderOrigination=0,this.getOrderOrigination=function(){return t._orderOrigination},this._orderSentenceId=0,this.getOrderSentenceId=function(){return t._orderSentenceId},this._nomenclatureId=0,this.getNomenclatureId=function(){return t._nomenclatureId},this._signTimeInteraction=0,this.getSignTimeInteraction=function(){return t._signTimeInteraction}}var e=t.prototype;return e.willActivate=function(t){return this._orderAction="ACTIVATE",this._orderId=t,this},e.willCancelDiscontinue=function(t){return this._orderAction="CANCEL DC",this._orderId=t,this},e.willCancelReorder=function(t){return this._orderAction="CANCEL REORD",this._orderId=t,this},e.willClear=function(t){return this._orderAction="CLEAR",this._orderId=t,this},e.willConvertInpatient=function(t){return this._orderAction="CONVERT_INPAT",this._orderId=t,this},e.willConvertToPrescriptionOrder=function(t){return this._orderAction="CONVERT_RX",this._orderId=t,this},e.willModify=function(t){return this._orderAction="MODIFY",this._orderId=t,this},e.willMakeNewOrder=function(t,e){var r=e||{},n=r.isRxOrder,i=r.isSatelliteOrder,o=r.orderSentenceId,s=r.nomenclatureId,a=r.skipInteractionCheckUntilSign;if(n&&i)throw new Error("must select either isRxOrder or isSatelliteOrder");return this._orderAction="ORDER",this._synonymId=t,this._orderSentenceId=o||0,this._nomenclatureId=s||0,this._signTimeInteraction=a?1:0,this._orderOrigination=i?5:n?1:0,this},e.willRenewNonPrescription=function(t){return this._orderAction="RENEW",this._orderId=t,this},e.willRenewPrescription=function(t){return this._orderAction="RENEW_RX",this._orderId=t,this},e.willCopyExistingOrder=function(t){return this._orderAction="REPEAT",this._orderId=t,this},e.willResumeSuspendedOrder=function(t){return this._orderAction="RESUME",this._orderId=t,this},e.willSuspend=function(t){return this._orderAction="SUSPEND",this._orderId=t,this},e.toString=function(){return"ORDER"===this._orderAction?"{"+this._orderAction+"|"+this._synonymId+"|"+this._orderOrigination+"|"+this._orderSentenceId+"|"+this._nomenclatureId+"|"+this._signTimeInteraction+"}":"{"+this._orderAction+"|"+this._orderId+"}"},t}(),exports.MPageOrderEvent=c,exports.launchClinicalNote=function(e){var r=e.windowTitle,n=e.viewOptionFlags,i=e.inheritanceProps||{},o=i.viewName,s=i.viewSeq,a=i.compName,c=i.compSeq,u=!0,d=[""+e.personId,""+e.encounterId],h=n&&0!==n.length?n:["view-only"];d.push("["+e.eventIds.join("|")+"]"),d.push(""+r),d.push(""+function(t){var e=0;return t.forEach((function(t){"menu"===t&&(e+=1),"buttons"===t&&(e+=2),"toolbar"===t&&(e+=4),"calculator"===t&&(e+=8),"view-only"===t&&(e+=16)})),e}(h)),d.push(""+(o||"")),d.push(""+(s||"")),d.push(""+(a||"")),d.push(""+(c||""));var l=""+d.join("|");try{window.MPAGES_EVENT("CLINICALNOTE",l)}catch(e){if(!t(e))throw e;u=!1,console.warn("window.MPAGES_EVENT('CLINICALNOTE', '"+l+"')")}return{inPowerChart:u,eventString:l}},exports.launchPowerForm=function(e){var r=e.personId,n=e.encounterId,i=e.target,o=e.targetId,s=e.permissions;if(("new form"===i||"completed form"===i)&&!o)throw new Error("'targetId' is required for 'new form' and 'completed form' targets.");var a=[""+r,""+n];"new form"===i&&(a.push(""+o),a.push("0")),"completed form"===i&&(a.push("0"),a.push(""+o)),"new form search"===i&&(a.push("0"),a.push("0")),a.push("modify"===s?"0":"1");var c=!0,u=""+a.join("|");try{window.MPAGES_EVENT("POWERFORM",u)}catch(e){if(!t(e))throw e;c=!1,console.warn("window.MPAGES_EVENT('POWERFORM', '"+u+"')")}return{inPowerChart:c,eventString:u}},exports.launchPowerNote=function(e){var r=e.personId,n=e.encounterId,i=e.target,o=e.targetId;if("new"===i&&"string"!=typeof o)throw new Error("CKI must be a string when launching a new PowerNote.");if("existing"===i&&"number"!=typeof o)throw new Error("eventId must be a number when loading an existing PowerNote.");var s=""+[""+r,""+n,""+("new"===i?o:""),""+("existing"===i?o:0)].join("|"),a=!0;try{window.MPAGES_EVENT("POWERNOTE",s)}catch(e){if(!t(e))throw e;a=!1,console.warn("window.MPAGES_EVENT('POWERNOTE', '"+s+"')")}return{eventString:s,inPowerChart:a}},exports.makeCclRequest=function(e){var n,i=e.prg,o=(n=(n=e.params)||[],(e.excludeMine?[].concat(n):[{type:"string",param:"MINE"}].concat(n)).map((function(t){var e=t.param;return"string"===t.type?"'"+e+"'":e})).join(","));return new Promise((function(e,n){try{var s=window.XMLCclRequest();s.open("GET",""+i),s.send(o),s.onreadystatechange=function(){var t={meta:{responseText:s.responseText,status:s.status,statusText:r.get(s.status)||"status refers to unknown error"},data:""===s.responseText?void 0:JSON.parse(s.responseText)};4===s.readyState?e(t):n("error with status "+s.status+" and readyState "+s.readyState+" on "+i+" with params "+o+" returning response text: "+(s.responseText||"no response text"))}}catch(e){if(!t(e))throw e;n(e.message)}}))},exports.openOrganizerTab=function(e){var r=!0,n="/ORGANIZERTAB=^"+e+"^";try{window.APPLINK(0,"Powerchart.exe",n)}catch(e){if(!t(e))throw e;r=!1}return{eventString:n,inPowerChart:r}},exports.openPatientTab=function(e,r,n,i){var o=!0,s="/PERSONID="+e+" /ENCNTRID="+r+" /FIRSTTAB=^"+n.toUpperCase()+(i?"+":"")+"^";try{window.APPLINK(1,"$APP_APPNAME$",s)}catch(e){if(!t(e))throw e;o=!1}return{eventString:s,inPowerChart:o}},exports.orderString=function(t,e){var r=e||{},s=r.orderId,a=r.newOrderOpts||{},c=a.synonymId,u=a.orderSentenceId,d=a.nomenclatureId,h=a.interactionCheck,l=a.origination,w=[n.get(t)];switch(t){case"launch moew":w=w.concat(["0","0","0","0","0"]);break;case"new order":if(!c)throw new Error("synonymId is required for the '"+t+"' action");w=w.concat([""+c,""+(i.get(l)||0),""+(u||0),""+(d||0),""+(o.get(h)||0)]);break;default:if(!s)throw new Error("orderId is required for the '"+t+"' action");w=w.concat([""+s])}return"{"+w.join("|")+"}"},exports.submitOrders=function(r,n,i,o){var c=o||{},u=c.targetTab,d=c.launchView,h=c.enablePowerPlans,l=c.signSilently;u||(u="power orders"),d||(d="signature");var w=!0,p=[""+r,""+n,i.join("")];p.push(h?"24":"0");var f=a.get(u)||{tab:2,display:127};p.push("{"+f.tab+"|"+f.display+"}"),p.push(""+(s.get(d)||32)),p.push(l?"1":"0");var _=p.join("|");try{window.MPAGES_EVENT("ORDERS",_)}catch(r){if(!t(r))throw r;w=!1,e(_)}return{eventString:_,inPowerChart:w}};
2
2
  //# sourceMappingURL=fluent-cerner-js.cjs.production.min.js.map