@tidepool/viz 1.58.0 → 1.59.0-rc.1

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.
@@ -0,0 +1,2 @@
1
+ (()=>{var e={76875:(e,r,t)=>{"use strict";var o=t(44906).default;Object.defineProperty(r,"__esModule",{value:!0}),r.MMOLL_UNITS=r.MGDL_UNITS=r.GLYCEMIC_RANGES_TYPE=r.GLYCEMIC_RANGES_PRESET=r.DEFAULT_BG_BOUNDS=r.ADA_STANDARD_BG_BOUNDS=r.ADA_PREGNANCY_T1_BG_BOUNDS=r.ADA_OLDER_HIGH_RISK_BG_BOUNDS=r.ADA_GESTATIONAL_T2_BG_BOUNDS=void 0;var _,n,u,A=o(t(271)),l=r.MGDL_UNITS="mg/dL",a=r.MMOLL_UNITS="mmol/L",d=(r.GLYCEMIC_RANGES_PRESET={ADA_STANDARD:"adaStandard",ADA_OLDER_HIGH_RISK:"adaHighRisk",ADA_PREGNANCY_T1:"adaPregnancyType1",ADA_GESTATIONAL_T2:"adaPregnancyType2"},r.GLYCEMIC_RANGES_TYPE={PRESET:"preset",CUSTOM:"custom"},r.DEFAULT_BG_BOUNDS=(_={},(0,A.default)(_,l,{veryLowThreshold:54,targetLowerBound:70,targetUpperBound:180,veryHighThreshold:250,extremeHighThreshold:350,clampThreshold:600}),(0,A.default)(_,a,{veryLowThreshold:3,targetLowerBound:3.9,targetUpperBound:10,veryHighThreshold:13.9,extremeHighThreshold:19.4,clampThreshold:33.3}),_)),S=(r.ADA_STANDARD_BG_BOUNDS=d,r.ADA_OLDER_HIGH_RISK_BG_BOUNDS=(n={},(0,A.default)(n,l,{veryLowThreshold:null,targetLowerBound:70,targetUpperBound:180,veryHighThreshold:250,extremeHighThreshold:null,clampThreshold:600}),(0,A.default)(n,a,{veryLowThreshold:null,targetLowerBound:3.9,targetUpperBound:10,veryHighThreshold:13.9,extremeHighThreshold:null,clampThreshold:33.3}),n),r.ADA_PREGNANCY_T1_BG_BOUNDS=(u={},(0,A.default)(u,l,{veryLowThreshold:54,targetLowerBound:63,targetUpperBound:140,veryHighThreshold:null,extremeHighThreshold:null,clampThreshold:600}),(0,A.default)(u,a,{veryLowThreshold:3,targetLowerBound:3.5,targetUpperBound:7.8,veryHighThreshold:null,extremeHighThreshold:null,clampThreshold:33.3}),u));r.ADA_GESTATIONAL_T2_BG_BOUNDS=S},44906:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},271:(e,r,t)=>{"use strict";t.r(r),t.d(r,{default:()=>_});var o=t(61676);function _(e,r,t){return(r=(0,o.A)(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}},61676:(e,r,t)=>{"use strict";t.d(r,{A:()=>_});var o=t(24664);function _(e){var r=function(e){if("object"!==(0,o.default)(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,"string");if("object"!==(0,o.default)(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===(0,o.default)(r)?r:String(r)}},24664:(e,r,t)=>{"use strict";function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}t.d(r,{default:()=>o})}},r={};function t(o){var _=r[o];if(void 0!==_)return _.exports;var n=r[o]={exports:{}};return e[o](n,n.exports,t),n.exports}t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};(()=>{"use strict";var e=o,r=t(44906).default;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ADA_GESTATIONAL_T2_BG_BOUNDS",{enumerable:!0,get:function(){return u.ADA_GESTATIONAL_T2_BG_BOUNDS}}),Object.defineProperty(e,"ADA_OLDER_HIGH_RISK_BG_BOUNDS",{enumerable:!0,get:function(){return u.ADA_OLDER_HIGH_RISK_BG_BOUNDS}}),Object.defineProperty(e,"ADA_PREGNANCY_T1_BG_BOUNDS",{enumerable:!0,get:function(){return u.ADA_PREGNANCY_T1_BG_BOUNDS}}),Object.defineProperty(e,"ADA_STANDARD_BG_BOUNDS",{enumerable:!0,get:function(){return u.ADA_STANDARD_BG_BOUNDS}}),Object.defineProperty(e,"DEFAULT_BG_BOUNDS",{enumerable:!0,get:function(){return u.DEFAULT_BG_BOUNDS}}),Object.defineProperty(e,"GLYCEMIC_RANGES_PRESET",{enumerable:!0,get:function(){return u.GLYCEMIC_RANGES_PRESET}}),Object.defineProperty(e,"GLYCEMIC_RANGES_TYPE",{enumerable:!0,get:function(){return u.GLYCEMIC_RANGES_TYPE}}),Object.defineProperty(e,"MGDL_UNITS",{enumerable:!0,get:function(){return u.MGDL_UNITS}}),Object.defineProperty(e,"MMOLL_UNITS",{enumerable:!0,get:function(){return u.MMOLL_UNITS}}),e.getGlycemicRangesPreset=e.getBgBoundsForGlycemicRanges=void 0;var _,n=r(t(271)),u=t(76875),A=(_={},(0,n.default)(_,u.GLYCEMIC_RANGES_PRESET.ADA_STANDARD,u.ADA_STANDARD_BG_BOUNDS),(0,n.default)(_,u.GLYCEMIC_RANGES_PRESET.ADA_OLDER_HIGH_RISK,u.ADA_OLDER_HIGH_RISK_BG_BOUNDS),(0,n.default)(_,u.GLYCEMIC_RANGES_PRESET.ADA_PREGNANCY_T1,u.ADA_PREGNANCY_T1_BG_BOUNDS),(0,n.default)(_,u.GLYCEMIC_RANGES_PRESET.ADA_GESTATIONAL_T2,u.ADA_GESTATIONAL_T2_BG_BOUNDS),_),l=e.getGlycemicRangesPreset=function(e){if(!e)return u.GLYCEMIC_RANGES_PRESET.ADA_STANDARD;switch(e.type){case u.GLYCEMIC_RANGES_TYPE.PRESET:return e.preset;case u.GLYCEMIC_RANGES_TYPE.CUSTOM:default:return u.GLYCEMIC_RANGES_PRESET.ADA_STANDARD}};e.getBgBoundsForGlycemicRanges=function(e,r){var t=l(e),o=Object.prototype.hasOwnProperty.call(A,t)?A[t]:u.ADA_STANDARD_BG_BOUNDS;if(!Object.prototype.hasOwnProperty.call(o,r))throw new TypeError('getBgBoundsForGlycemicRanges: invalid bgUnits "'.concat(r,'". Expected "mg/dL" or "mmol/L".'));return o[r]}})();var _=exports;for(var n in o)_[n]=o[n];o.__esModule&&Object.defineProperty(_,"__esModule",{value:!0})})();
2
+ //# sourceMappingURL=glycemicRanges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glycemicRanges.js","mappings":"mWAuBaA,EAAUC,EAAAA,WAAG,QACbC,EAAWD,EAAAA,YAAG,SAcdE,GAZsBF,EAAAA,uBAAG,CACpCG,aAAc,cACdC,oBAAqB,cACrBC,iBAAkB,oBAClBC,mBAAoB,qBAGWN,EAAAA,qBAAG,CAClCO,OAAQ,SACRC,OAAQ,UAGoBR,EAAAA,mBAAAS,EAAG,CAAC,GAAJ,EAAAC,EAAA,SAAAD,EAC3BV,EAAa,CACZY,iBAAkB,GAClBC,iBAAkB,GAClBC,iBAAkB,IAClBC,kBAAmB,IACnBC,qBAAsB,IACtBC,eAAgB,OACjB,EAAAN,EAAA,SAAAD,EACAR,EAAc,CACbU,iBAAkB,EAClBC,iBAAkB,IAClBC,iBAAkB,GAClBC,kBAAmB,KACnBC,qBAAsB,KACtBC,eAAgB,OACjBP,IAwBUQ,GArBsBjB,EAAAA,uBAAGE,EAEIF,EAAAA,+BAAAkB,EAAG,CAAC,GAAJ,EAAAR,EAAA,SAAAQ,EACvCnB,EAAa,CACZY,iBAAkB,KAClBC,iBAAkB,GAClBC,iBAAkB,IAClBC,kBAAmB,IACnBC,qBAAsB,KACtBC,eAAg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EAAAA,6BAA0B,EAAAP,EAAA,SAAAkD,EACpEI,EAAAA,uBAAuB1D,mBAAqB6D,EAAAA,8BAA4BP,GAuB9DQ,EAAuBpE,EAAAA,wBAAG,SAAAqE,GAErC,IAAKA,EAAgB,OAAOL,EAAAA,uBAAuB7D,aAEnD,OAAQkE,EAAeC,MACrB,KAAKC,EAAAA,qBAAqBhE,OACxB,OAAO8D,EAAeG,OACxB,KAAKD,EAAAA,qBAAqB/D,OAE1B,QACE,OAAOwD,EAAAA,uBAAuB7D,aAEpC,EAYyCH,EAAAA,6BAAG,SAACqE,EAAgBI,GAC3D,IAAMD,EAASJ,EAAwBC,GAKjCK,EAAShD,OAAOqB,UAAUU,eAAelB,KAAKwB,EAAeS,GAC/DT,EAAcS,GACdP,EAAAA,uBACJ,IAAKvC,OAAOqB,UAAUU,eAAelB,KAAKmC,EAAQD,GAChD,MAAM,IAAIhC,UAAU,kDAADkC,OACiCF,EAAO,qCAG7D,OAAOC,EAAOD,EAChB,C","sources":["webpack://@tidepool/viz/./src/utils/glycemicRangeConstants.js","webpack://@tidepool/viz/./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/interopRequireDefault.js","webpack://@tidepool/viz/./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://@tidepool/viz/./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://@tidepool/viz/./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://@tidepool/viz/./node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://@tidepool/viz/webpack/bootstrap","webpack://@tidepool/viz/webpack/runtime/define property getters","webpack://@tidepool/viz/webpack/runtime/hasOwnProperty shorthand","webpack://@tidepool/viz/webpack/runtime/make namespace object","webpack://@tidepool/viz/./src/utils/glycemicRanges.js"],"sourcesContent":["/*\n * == BSD2 LICENSE ==\n * Copyright (c) 2026, Tidepool Project\n *\n * This program is free software; you can redistribute it and/or modify it under\n * the terms of the associated License, which is identical to the BSD 2-Clause\n * License as published by the Open Source Initiative at opensource.org.\n *\n * This program is distributed in the hope that it will be useful, but WITHOUT\n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n * FOR A PARTICULAR PURPOSE. See the License for more details.\n *\n * You should have received a copy of the License along with this program; if\n * not, you can obtain one from Tidepool Project at tidepool.org.\n * == BSD2 LICENSE ==\n */\n\n// Glycemic-range constants extracted from utils/constants.js into their own\n// dependency-free module so they can be exposed via a Node-friendly bundle\n// (dist/glycemicRanges.js) for non-browser consumers (e.g. data-export-service).\n// Do not import i18next, lodash, or anything else from here — keeping this\n// module side-effect-free is what lets it load in plain Node.\n\nexport const MGDL_UNITS = 'mg/dL';\nexport const MMOLL_UNITS = 'mmol/L';\n\nexport const GLYCEMIC_RANGES_PRESET = {\n ADA_STANDARD: 'adaStandard',\n ADA_OLDER_HIGH_RISK: 'adaHighRisk',\n ADA_PREGNANCY_T1: 'adaPregnancyType1',\n ADA_GESTATIONAL_T2: 'adaPregnancyType2',\n};\n\nexport const GLYCEMIC_RANGES_TYPE = {\n PRESET: 'preset',\n CUSTOM: 'custom',\n};\n\nexport const DEFAULT_BG_BOUNDS = {\n [MGDL_UNITS]: {\n veryLowThreshold: 54,\n targetLowerBound: 70,\n targetUpperBound: 180,\n veryHighThreshold: 250,\n extremeHighThreshold: 350,\n clampThreshold: 600,\n },\n [MMOLL_UNITS]: {\n veryLowThreshold: 3.0,\n targetLowerBound: 3.9,\n targetUpperBound: 10.0,\n veryHighThreshold: 13.9,\n extremeHighThreshold: 19.4,\n clampThreshold: 33.3,\n },\n};\n\nexport const ADA_STANDARD_BG_BOUNDS = DEFAULT_BG_BOUNDS;\n\nexport const ADA_OLDER_HIGH_RISK_BG_BOUNDS = {\n [MGDL_UNITS]: {\n veryLowThreshold: null,\n targetLowerBound: 70,\n targetUpperBound: 180,\n veryHighThreshold: 250,\n extremeHighThreshold: null,\n clampThreshold: 600,\n },\n [MMOLL_UNITS]: {\n veryLowThreshold: null,\n targetLowerBound: 3.9,\n targetUpperBound: 10.0,\n veryHighThreshold: 13.9,\n extremeHighThreshold: null,\n clampThreshold: 33.3,\n },\n};\n\nexport const ADA_PREGNANCY_T1_BG_BOUNDS = {\n [MGDL_UNITS]: {\n veryLowThreshold: 54,\n targetLowerBound: 63,\n targetUpperBound: 140,\n veryHighThreshold: null,\n extremeHighThreshold: null,\n clampThreshold: 600,\n },\n [MMOLL_UNITS]: {\n veryLowThreshold: 3.0,\n targetLowerBound: 3.5,\n targetUpperBound: 7.8,\n veryHighThreshold: null,\n extremeHighThreshold: null,\n clampThreshold: 33.3,\n },\n};\n\nexport const ADA_GESTATIONAL_T2_BG_BOUNDS = ADA_PREGNANCY_T1_BG_BOUNDS;\n","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {\n ADA_GESTATIONAL_T2_BG_BOUNDS,\n ADA_OLDER_HIGH_RISK_BG_BOUNDS,\n ADA_PREGNANCY_T1_BG_BOUNDS,\n ADA_STANDARD_BG_BOUNDS,\n GLYCEMIC_RANGES_PRESET,\n GLYCEMIC_RANGES_TYPE,\n} from './glycemicRangeConstants';\n\nconst PRESET_BOUNDS = {\n [GLYCEMIC_RANGES_PRESET.ADA_STANDARD]: ADA_STANDARD_BG_BOUNDS,\n [GLYCEMIC_RANGES_PRESET.ADA_OLDER_HIGH_RISK]: ADA_OLDER_HIGH_RISK_BG_BOUNDS,\n [GLYCEMIC_RANGES_PRESET.ADA_PREGNANCY_T1]: ADA_PREGNANCY_T1_BG_BOUNDS,\n [GLYCEMIC_RANGES_PRESET.ADA_GESTATIONAL_T2]: ADA_GESTATIONAL_T2_BG_BOUNDS,\n};\n\nexport {\n ADA_GESTATIONAL_T2_BG_BOUNDS,\n ADA_OLDER_HIGH_RISK_BG_BOUNDS,\n ADA_PREGNANCY_T1_BG_BOUNDS,\n ADA_STANDARD_BG_BOUNDS,\n DEFAULT_BG_BOUNDS,\n GLYCEMIC_RANGES_PRESET,\n GLYCEMIC_RANGES_TYPE,\n MGDL_UNITS,\n MMOLL_UNITS,\n} from './glycemicRangeConstants';\n\n/**\n * Extracts the glycemic ranges preset value from the glycemicRanges object of the\n * clinicPatient record\n *\n * @param {Object} glycemicRanges the glycemicRanges object of the clinicPatient record\n *\n * @return {String} target range preset, e.g. 'adaStandard', 'adaPregnancyType1', etc\n */\nexport const getGlycemicRangesPreset = glycemicRanges => {\n // glycemicRanges field will not exist on older clinicPatient records\n if (!glycemicRanges) return GLYCEMIC_RANGES_PRESET.ADA_STANDARD;\n\n switch (glycemicRanges.type) {\n case GLYCEMIC_RANGES_TYPE.PRESET:\n return glycemicRanges.preset;\n case GLYCEMIC_RANGES_TYPE.CUSTOM:\n // feature to be implemented in future revisions\n default: // eslint-disable-line no-fallthrough\n return GLYCEMIC_RANGES_PRESET.ADA_STANDARD;\n }\n};\n\n/**\n * Resolve the BG bounds table for a patient's assigned glycemic range.\n * Single source of truth used by both blip (browser PDFs) and the\n * data-export-service (EHR PDFs) so the two stay in lockstep.\n *\n * @param {Object|null} glycemicRanges the glycemicRanges object of the clinicPatient record\n * @param {string} bgUnits 'mg/dL' or 'mmol/L'\n *\n * @return {Object} bgBounds, e.g. { veryLowThreshold, targetLowerBound, targetUpperBound, veryHighThreshold, extremeHighThreshold, clampThreshold }\n */\nexport const getBgBoundsForGlycemicRanges = (glycemicRanges, bgUnits) => {\n const preset = getGlycemicRangesPreset(glycemicRanges);\n // Own-property checks: `preset` comes straight from patient data and `bgUnits`\n // from the caller, so a value like \"constructor\"/\"toString\" would otherwise\n // resolve an inherited prototype member — skipping the ADA_STANDARD fallback\n // and defeating the TypeError guard below.\n const bounds = Object.prototype.hasOwnProperty.call(PRESET_BOUNDS, preset)\n ? PRESET_BOUNDS[preset]\n : ADA_STANDARD_BG_BOUNDS;\n if (!Object.prototype.hasOwnProperty.call(bounds, bgUnits)) {\n throw new TypeError(\n `getBgBoundsForGlycemicRanges: invalid bgUnits \"${bgUnits}\". Expected \"mg/dL\" or \"mmol/L\".`\n );\n }\n return bounds[bgUnits];\n};\n"],"names":["MGDL_UNITS","exports","MMOLL_UNITS","DEFAULT_BG_BOUNDS","ADA_STANDARD","ADA_OLDER_HIGH_RISK","ADA_PREGNANCY_T1","ADA_GESTATIONAL_T2","PRESET","CUSTOM","_DEFAULT_BG_BOUNDS","_defineProperty2","veryLowThreshold","targetLowerBound","targetUpperBound","veryHighThreshold","extremeHighThreshold","clampThreshold","ADA_PREGNANCY_T1_BG_BOUNDS","_ADA_OLDER_HIGH_RISK_","_ADA_PREGNANCY_T1_BG_","module","obj","__esModule","_defineProperty","key","value","Object","defineProperty","enumerable","configurable","writable","_toPropertyKey","arg","input","prim","Symbol","toPrimitive","undefined","res","call","hint","TypeError","String","_typeof","o","iterator","constructor","prototype","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","get","prop","hasOwnProperty","r","toStringTag","_PRESET_BOUNDS","_glycemicRangeConstants","require","PRESET_BOUNDS","GLYCEMIC_RANGES_PRESET","ADA_STANDARD_BG_BOUNDS","ADA_OLDER_HIGH_RISK_BG_BOUNDS","ADA_GESTATIONAL_T2_BG_BOUNDS","getGlycemicRangesPreset","glycemicRanges","type","GLYCEMIC_RANGES_TYPE","preset","bgUnits","bounds","concat"],"sourceRoot":""}