@tellescope/react-components 1.237.6 → 1.239.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.
- package/lib/cjs/Forms/forms.d.ts.map +1 -1
- package/lib/cjs/Forms/forms.js +29 -27
- package/lib/cjs/Forms/forms.js.map +1 -1
- package/lib/cjs/Forms/forms.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/forms.v2.js +29 -27
- package/lib/cjs/Forms/forms.v2.js.map +1 -1
- package/lib/cjs/Forms/hooks.d.ts +25 -1
- package/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +40 -2
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts +6 -2
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +138 -23
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/Forms/inputs.v2.d.ts +2 -1
- package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.v2.js +26 -9
- package/lib/cjs/Forms/inputs.v2.js.map +1 -1
- package/lib/cjs/Forms/localization.d.ts.map +1 -1
- package/lib/cjs/Forms/localization.js +7 -0
- package/lib/cjs/Forms/localization.js.map +1 -1
- package/lib/cjs/inputs_shared.d.ts +6 -2
- package/lib/cjs/inputs_shared.d.ts.map +1 -1
- package/lib/cjs/inputs_shared.js +4 -3
- package/lib/cjs/inputs_shared.js.map +1 -1
- package/lib/esm/Forms/forms.d.ts.map +1 -1
- package/lib/esm/Forms/forms.js +30 -28
- package/lib/esm/Forms/forms.js.map +1 -1
- package/lib/esm/Forms/forms.v2.d.ts.map +1 -1
- package/lib/esm/Forms/forms.v2.js +30 -28
- package/lib/esm/Forms/forms.v2.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +25 -1
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +38 -1
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +6 -2
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +136 -22
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/inputs.v2.d.ts +2 -1
- package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.v2.js +25 -9
- package/lib/esm/Forms/inputs.v2.js.map +1 -1
- package/lib/esm/Forms/localization.d.ts.map +1 -1
- package/lib/esm/Forms/localization.js +7 -0
- package/lib/esm/Forms/localization.js.map +1 -1
- package/lib/esm/inputs_shared.d.ts +6 -2
- package/lib/esm/inputs_shared.d.ts.map +1 -1
- package/lib/esm/inputs_shared.js +4 -3
- package/lib/esm/inputs_shared.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/forms.tsx +9 -2
- package/src/Forms/forms.v2.tsx +9 -2
- package/src/Forms/hooks.tsx +57 -2
- package/src/Forms/inputs.tsx +246 -17
- package/src/Forms/inputs.v2.tsx +29 -11
- package/src/Forms/localization.ts +8 -0
- package/src/inputs_shared.tsx +6 -5
package/lib/esm/Forms/inputs.js
CHANGED
|
@@ -93,6 +93,7 @@ import { Elements, PaymentElement, useStripe, useElements, EmbeddedCheckout, Emb
|
|
|
93
93
|
import { loadStripe } from '@stripe/stripe-js';
|
|
94
94
|
import { CheckCircleOutline, Delete, Edit, ExpandMore } from "@mui/icons-material";
|
|
95
95
|
import { WYSIWYG } from "./wysiwyg";
|
|
96
|
+
import { useConditionalChoices } from "./hooks";
|
|
96
97
|
// Bridge Eligibility - shared variable for storing most recent eligibility userIds
|
|
97
98
|
var bridgeEligibilityResult = {
|
|
98
99
|
userIds: [],
|
|
@@ -831,6 +832,91 @@ export var BridgeEligibilityInput = function (_a) {
|
|
|
831
832
|
// User/admin interface (non-enduser sessions)
|
|
832
833
|
return (_jsxs(Grid, __assign({ container: true, spacing: 2, direction: "column" }, { children: [_jsxs(Grid, __assign({ item: true }, { children: [_jsxs(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: ["Eligibility Type: ", eligibilityType] })), _jsxs(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: ["Service Type IDs: ", ((_e = (_d = field.options) === null || _d === void 0 ? void 0 : _d.bridgeServiceTypeIds) === null || _e === void 0 ? void 0 : _e.join(', ')) || 'Not configured'] })), state && _jsxs(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: ["State: ", state] })), payerId && _jsxs(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: ["Payer ID: ", payerId] })), memberId && _jsxs(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: ["Member ID: ", memberId] }))] })), error && (_jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "body2", color: "error" }, { children: error })) }))), polling && (_jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "body2", color: "primary" }, { children: form_display_text_for_language(form, "Polling for results... (this may take 15-30 seconds)") })) }))), _jsxs(Grid, __assign({ item: true, container: true, spacing: 2 }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsx(LoadingButton, { variant: "outlined", onClick: checkProviderEligibility, submitText: form_display_text_for_language(form, "Check Provider Eligibility (Free)"), submittingText: form_display_text_for_language(form, "Checking..."), submitting: loading && !polling, disabled: !((_g = (_f = field.options) === null || _f === void 0 ? void 0 : _f.bridgeServiceTypeIds) === null || _g === void 0 ? void 0 : _g.length) || loading || polling }) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(LoadingButton, { variant: "outlined", onClick: checkServiceEligibility, submitText: form_display_text_for_language(form, "Check Service Eligibility (Paid)"), submittingText: polling ? form_display_text_for_language(form, "Polling...") : form_display_text_for_language(form, "Initiating..."), submitting: loading || polling, disabled: !((_j = (_h = field.options) === null || _h === void 0 ? void 0 : _h.bridgeServiceTypeIds) === null || _j === void 0 ? void 0 : _j.length) || loading || polling }) }))] })), value && (_jsxs(Grid, __assign({ item: true }, { children: [_jsx(Typography, __assign({ variant: "caption", color: "textSecondary" }, { children: "Current Answer:" })), _jsx("pre", __assign({ style: { fontSize: 11, whiteSpace: 'pre-wrap', wordBreak: 'break-word' } }, { children: JSON.stringify(value, null, 2) }))] })))] })));
|
|
833
834
|
};
|
|
835
|
+
export var PharmacySearchInput = function (_a) {
|
|
836
|
+
var field = _a.field, rawValue = _a.value, onChange = _a.onChange, responses = _a.responses, enduser = _a.enduser, form = _a.form, props = __rest(_a, ["field", "value", "onChange", "responses", "enduser", "form"]);
|
|
837
|
+
var value = rawValue;
|
|
838
|
+
var session = useResolvedSession();
|
|
839
|
+
// Get initial ZIP code from responses or enduser data
|
|
840
|
+
var getInitialZipCode = function () {
|
|
841
|
+
var _a;
|
|
842
|
+
// Check Address field responses first
|
|
843
|
+
var addressResponse = responses === null || responses === void 0 ? void 0 : responses.find(function (r) { var _a, _b, _d; return ((_a = r.answer) === null || _a === void 0 ? void 0 : _a.type) === 'Address' && ((_d = (_b = r.answer) === null || _b === void 0 ? void 0 : _b.value) === null || _d === void 0 ? void 0 : _d.zipCode); });
|
|
844
|
+
if (((_a = addressResponse === null || addressResponse === void 0 ? void 0 : addressResponse.answer) === null || _a === void 0 ? void 0 : _a.type) === 'Address') {
|
|
845
|
+
var addressValue = addressResponse.answer.value;
|
|
846
|
+
if (addressValue === null || addressValue === void 0 ? void 0 : addressValue.zipCode) {
|
|
847
|
+
return addressValue.zipCode;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
// Fall back to enduser.zipCode
|
|
851
|
+
return (enduser === null || enduser === void 0 ? void 0 : enduser.zipCode) || '';
|
|
852
|
+
};
|
|
853
|
+
var _b = useState(getInitialZipCode()), zipCode = _b[0], setZipCode = _b[1];
|
|
854
|
+
var _d = useState(false), loading = _d[0], setLoading = _d[1];
|
|
855
|
+
var _e = useState(), error = _e[0], setError = _e[1];
|
|
856
|
+
var _f = useState([]), pharmacies = _f[0], setPharmacies = _f[1];
|
|
857
|
+
var _g = useState(false), hasSearched = _g[0], setHasSearched = _g[1];
|
|
858
|
+
var searchPharmacies = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
859
|
+
var data, err_6;
|
|
860
|
+
return __generator(this, function (_a) {
|
|
861
|
+
switch (_a.label) {
|
|
862
|
+
case 0:
|
|
863
|
+
if (!zipCode || zipCode.length !== 5) {
|
|
864
|
+
setError(form_display_text_for_language(form, 'Please enter a valid 5-digit ZIP code'));
|
|
865
|
+
return [2 /*return*/];
|
|
866
|
+
}
|
|
867
|
+
setLoading(true);
|
|
868
|
+
setError(undefined);
|
|
869
|
+
setHasSearched(true);
|
|
870
|
+
_a.label = 1;
|
|
871
|
+
case 1:
|
|
872
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
873
|
+
return [4 /*yield*/, session.api.integrations.proxy_read({
|
|
874
|
+
integration: 'ScriptSure',
|
|
875
|
+
type: 'pharmacy-search',
|
|
876
|
+
query: JSON.stringify({ zipCode: zipCode }),
|
|
877
|
+
})];
|
|
878
|
+
case 2:
|
|
879
|
+
data = (_a.sent()).data;
|
|
880
|
+
setPharmacies(data || []);
|
|
881
|
+
if (!(data === null || data === void 0 ? void 0 : data.length)) {
|
|
882
|
+
setError(form_display_text_for_language(form, 'No pharmacies found for this ZIP code'));
|
|
883
|
+
}
|
|
884
|
+
return [3 /*break*/, 5];
|
|
885
|
+
case 3:
|
|
886
|
+
err_6 = _a.sent();
|
|
887
|
+
setError((err_6 === null || err_6 === void 0 ? void 0 : err_6.message) || form_display_text_for_language(form, 'Failed to search pharmacies'));
|
|
888
|
+
setPharmacies([]);
|
|
889
|
+
return [3 /*break*/, 5];
|
|
890
|
+
case 4:
|
|
891
|
+
setLoading(false);
|
|
892
|
+
return [7 /*endfinally*/];
|
|
893
|
+
case 5: return [2 /*return*/];
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
}); }, [session, zipCode, form]);
|
|
897
|
+
var handleSelectPharmacy = function (pharmacy) {
|
|
898
|
+
onChange({
|
|
899
|
+
npi: pharmacy.npi,
|
|
900
|
+
ncpdpId: pharmacy.ncpdpId,
|
|
901
|
+
businessName: pharmacy.businessName,
|
|
902
|
+
primaryTelephone: pharmacy.primaryTelephone || '',
|
|
903
|
+
addressLine1: pharmacy.addressLine1,
|
|
904
|
+
city: pharmacy.city,
|
|
905
|
+
stateProvince: pharmacy.stateProvince,
|
|
906
|
+
postalCode: pharmacy.postalCode,
|
|
907
|
+
}, field.id);
|
|
908
|
+
};
|
|
909
|
+
var formatPharmacyAddress = function (p) {
|
|
910
|
+
var parts = [p.addressLine1, p.city, p.stateProvince, p.postalCode].filter(Boolean);
|
|
911
|
+
return parts.join(', ');
|
|
912
|
+
};
|
|
913
|
+
return (_jsxs(Grid, __assign({ container: true, direction: "column", spacing: 2 }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsxs(Grid, __assign({ container: true, spacing: 2, alignItems: "flex-end" }, { children: [_jsx(Grid, __assign({ item: true, xs: 8, sm: 6 }, { children: _jsx(TextField, { fullWidth: true, size: "small", label: form_display_text_for_language(form, "ZIP Code"), value: zipCode, onChange: function (e) { return setZipCode(e.target.value.replace(/\D/g, '').slice(0, 5)); }, InputProps: defaultInputProps, placeholder: "12345", required: !field.isOptional }) })), _jsx(Grid, __assign({ item: true, xs: 4, sm: 6 }, { children: _jsx(LoadingButton, { variant: "contained", onClick: searchPharmacies, submitText: form_display_text_for_language(form, "Search"), submittingText: form_display_text_for_language(form, "Searching..."), submitting: loading, disabled: zipCode.length !== 5 || loading, style: { width: '100%', marginTop: 0 } }) }))] })) })), error && (_jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ color: "error", sx: { fontSize: 14 } }, { children: error })) }))), value && (_jsx(Grid, __assign({ item: true }, { children: _jsx(Paper, __assign({ elevation: 2, sx: { p: 2, backgroundColor: '#e8f5e9' } }, { children: _jsxs(Grid, __assign({ container: true, alignItems: "center", justifyContent: "space-between" }, { children: [_jsxs(Grid, __assign({ item: true, xs: true }, { children: [_jsxs(Typography, __assign({ variant: "subtitle1", fontWeight: "bold" }, { children: [_jsx(CheckCircleOutline, { sx: { color: 'success.main', mr: 1, verticalAlign: 'middle' } }), value.businessName] })), _jsx(Typography, __assign({ variant: "body2", color: "text.secondary" }, { children: formatPharmacyAddress(value) })), value.primaryTelephone && (_jsx(Typography, __assign({ variant: "body2", color: "text.secondary" }, { children: value.primaryTelephone })))] })), _jsx(Grid, __assign({ item: true }, { children: _jsx(MuiIconButton, __assign({ onClick: function () { return onChange(undefined, field.id); }, size: "small" }, { children: _jsx(CancelIcon, {}) })) }))] })) })) }))), !value && hasSearched && pharmacies.length > 0 && (_jsxs(Grid, __assign({ item: true }, { children: [_jsxs(Typography, __assign({ variant: "subtitle2", sx: { mb: 1 } }, { children: [pharmacies.length, " ", form_display_text_for_language(form, pharmacies.length === 1 ? 'pharmacy found' : 'pharmacies found')] })), _jsx(Box, __assign({ sx: { maxHeight: 300, overflow: 'auto' } }, { children: pharmacies.map(function (pharmacy, index) { return (_jsxs(Paper, __assign({ elevation: 1, sx: {
|
|
914
|
+
p: 1.5,
|
|
915
|
+
mb: 1,
|
|
916
|
+
cursor: 'pointer',
|
|
917
|
+
'&:hover': { backgroundColor: '#f5f5f5' },
|
|
918
|
+
}, onClick: function () { return handleSelectPharmacy(pharmacy); } }, { children: [_jsx(Typography, __assign({ variant: "subtitle2", fontWeight: "medium" }, { children: pharmacy.businessName })), _jsx(Typography, __assign({ variant: "body2", color: "text.secondary" }, { children: formatPharmacyAddress(pharmacy) })), pharmacy.primaryTelephone && (_jsx(Typography, __assign({ variant: "caption", color: "text.secondary" }, { children: pharmacy.primaryTelephone })))] }), "".concat(pharmacy.ncpdpId, "-").concat(index))); }) }))] }))), loading && (_jsx(Grid, __assign({ item: true }, { children: _jsx(LinearProgress, {}) })))] })));
|
|
919
|
+
};
|
|
834
920
|
var HourSelector = function (props) { return (_jsx(StringSelector, __assign({}, props, { options: Array(12).fill('').map(function (_, i) { return (i + 1) <= 9 ? "0".concat(i + 1) : (i + 1).toString(); }) }))); };
|
|
835
921
|
var MinuteSelector = function (props) { return (_jsx(StringSelector, __assign({}, props, { options: Array(60).fill('').map(function (_, i) { return i <= 9 ? "0".concat(i) : i.toString(); }) }))); };
|
|
836
922
|
var AmPmSelector = function (props) { return (_jsx(StringSelector, __assign({}, props, { options: ['AM', 'PM'] }))); };
|
|
@@ -1128,13 +1214,24 @@ var multipleChoiceItemSx = {
|
|
|
1128
1214
|
};
|
|
1129
1215
|
export var MultipleChoiceInput = function (_a) {
|
|
1130
1216
|
var _b;
|
|
1131
|
-
var field = _a.field, form = _a.form, _value = _a.value, onChange = _a.onChange;
|
|
1217
|
+
var field = _a.field, form = _a.form, _value = _a.value, onChange = _a.onChange, responses = _a.responses, enduser = _a.enduser;
|
|
1132
1218
|
var value = typeof _value === 'string' ? [_value] : _value; // if loading existingResponses, allows them to be a string
|
|
1133
1219
|
var _d = field.options, choices = _d.choices, radio = _d.radio, other = _d.other, optionDetails = _d.optionDetails;
|
|
1134
1220
|
var _e = useState({}), expandedDescriptions = _e[0], setExpandedDescriptions = _e[1];
|
|
1135
1221
|
// current other string
|
|
1136
1222
|
var enteringOtherStringRef = React.useRef(''); // if typing otherString as prefix of a checkbox value, don't auto-select
|
|
1137
1223
|
var otherString = (_b = value === null || value === void 0 ? void 0 : value.find(function (v) { var _a; return v === enteringOtherStringRef.current || !((_a = (choices !== null && choices !== void 0 ? choices : [])) === null || _a === void 0 ? void 0 : _a.find(function (c) { return c === v; })); })) !== null && _b !== void 0 ? _b : '';
|
|
1224
|
+
// Conditional visibility for choices
|
|
1225
|
+
var _f = useConditionalChoices({
|
|
1226
|
+
choices: choices,
|
|
1227
|
+
optionDetails: optionDetails,
|
|
1228
|
+
responses: responses,
|
|
1229
|
+
enduser: enduser,
|
|
1230
|
+
form: form,
|
|
1231
|
+
onChange: onChange,
|
|
1232
|
+
fieldId: field.id,
|
|
1233
|
+
otherString: otherString,
|
|
1234
|
+
}), visibleChoices = _f.visibleChoices, handleChange = _f.handleChange;
|
|
1138
1235
|
var getDescriptionForChoice = useCallback(function (choice) {
|
|
1139
1236
|
var _a;
|
|
1140
1237
|
return (_a = optionDetails === null || optionDetails === void 0 ? void 0 : optionDetails.find(function (detail) { return detail.option === choice; })) === null || _a === void 0 ? void 0 : _a.description;
|
|
@@ -1146,11 +1243,11 @@ export var MultipleChoiceInput = function (_a) {
|
|
|
1146
1243
|
});
|
|
1147
1244
|
}, []);
|
|
1148
1245
|
return (_jsxs(Grid, __assign({ container: true, alignItems: "center" }, { children: [radio
|
|
1149
|
-
? (_jsxs(FormControl, __assign({ fullWidth: true }, { children: [_jsx(FormLabel, __assign({ id: "radio-group-".concat(field.id, "-label") }, { children: form_display_text_for_language(form, "Select One") })), _jsx(RadioGroup, __assign({ "aria-labelledby": "radio-group-".concat(field.id, "-label"), defaultValue: "female", name: "radio-group-".concat(field.id) }, { children:
|
|
1246
|
+
? (_jsxs(FormControl, __assign({ fullWidth: true }, { children: [_jsx(FormLabel, __assign({ id: "radio-group-".concat(field.id, "-label") }, { children: form_display_text_for_language(form, "Select One") })), _jsx(RadioGroup, __assign({ "aria-labelledby": "radio-group-".concat(field.id, "-label"), defaultValue: "female", name: "radio-group-".concat(field.id) }, { children: visibleChoices.map(function (c, i) {
|
|
1150
1247
|
var description = getDescriptionForChoice(c);
|
|
1151
1248
|
var hasDescription = !!description;
|
|
1152
1249
|
var isExpanded = expandedDescriptions[i];
|
|
1153
|
-
return (_jsxs(Box, __assign({ sx: { width: '100%' } }, { children: [_jsx(Box, __assign({ sx: { display: 'flex', alignItems: 'center', width: '100%' } }, { children: _jsx(FormControlLabel, { sx: __assign(__assign({}, multipleChoiceItemSx), { flex: 1, marginLeft: '0px' }), checked: !!(value === null || value === void 0 ? void 0 : value.includes(c)) && c !== otherString, control: _jsx(Radio, { onClick: function () { return
|
|
1250
|
+
return (_jsxs(Box, __assign({ sx: { width: '100%' } }, { children: [_jsx(Box, __assign({ sx: { display: 'flex', alignItems: 'center', width: '100%' } }, { children: _jsx(FormControlLabel, { sx: __assign(__assign({}, multipleChoiceItemSx), { flex: 1, marginLeft: '0px' }), checked: !!(value === null || value === void 0 ? void 0 : value.includes(c)) && c !== otherString, control: _jsx(Radio, { onClick: function () { return handleChange((value === null || value === void 0 ? void 0 : value.includes(c)) ? [] : [c], field.id); } }), label: _jsxs(Box, __assign({ sx: { display: 'flex', alignItems: 'center', width: '100%' } }, { children: [_jsx(Typography, __assign({ component: "span", sx: { flex: 1 } }, { children: c })), hasDescription && (_jsx(MuiIconButton, __assign({ size: "small", onClick: function (e) {
|
|
1154
1251
|
e.stopPropagation();
|
|
1155
1252
|
toggleDescription(i);
|
|
1156
1253
|
}, sx: {
|
|
@@ -1158,7 +1255,7 @@ export var MultipleChoiceInput = function (_a) {
|
|
|
1158
1255
|
transition: 'transform 0.2s',
|
|
1159
1256
|
ml: 1
|
|
1160
1257
|
} }, { children: _jsx(ExpandMore, { fontSize: "small" }) })))] })) }) })), hasDescription && (_jsx(Collapse, __assign({ in: isExpanded }, { children: _jsx(Box, __assign({ sx: { pl: '42px', pr: 2, pb: 1 } }, { children: _jsx(Typography, __assign({ variant: "body2", color: "text.secondary" }, { children: description })) })) })))] }), i));
|
|
1161
|
-
}) }))] }))) : (
|
|
1258
|
+
}) }))] }))) : (visibleChoices.map(function (c, i) {
|
|
1162
1259
|
var description = getDescriptionForChoice(c);
|
|
1163
1260
|
var hasDescription = !!description;
|
|
1164
1261
|
var isExpanded = expandedDescriptions[i];
|
|
@@ -1168,7 +1265,7 @@ export var MultipleChoiceInput = function (_a) {
|
|
|
1168
1265
|
if (e.target.closest('.expand-button')) {
|
|
1169
1266
|
return;
|
|
1170
1267
|
}
|
|
1171
|
-
|
|
1268
|
+
handleChange(((value === null || value === void 0 ? void 0 : value.includes(c))
|
|
1172
1269
|
? ((radio || ((_b = (_a = field.options) === null || _a === void 0 ? void 0 : _a.radioChoices) === null || _b === void 0 ? void 0 : _b.includes(c)))
|
|
1173
1270
|
? []
|
|
1174
1271
|
: value.filter(function (v) { return v !== c; }))
|
|
@@ -1189,13 +1286,13 @@ export var MultipleChoiceInput = function (_a) {
|
|
|
1189
1286
|
// onClick={() => !otherChecked && handleOtherChecked()} // allow click to enable when disabled
|
|
1190
1287
|
onChange: function (e) {
|
|
1191
1288
|
enteringOtherStringRef.current = e.target.value;
|
|
1192
|
-
|
|
1289
|
+
handleChange((radio
|
|
1193
1290
|
? (e.target.value.trim()
|
|
1194
1291
|
? [e.target.value]
|
|
1195
1292
|
: [])
|
|
1196
1293
|
: (e.target.value.trim()
|
|
1197
1294
|
// remove existing other string (if exists) and append new one
|
|
1198
|
-
? __spreadArray(__spreadArray([], (value !== null && value !== void 0 ? value : []).filter(function (v) { return v !== otherString; }), true), [e.target.value], false) : value
|
|
1295
|
+
? __spreadArray(__spreadArray([], (value !== null && value !== void 0 ? value : []).filter(function (v) { return v !== otherString; }), true), [e.target.value], false) : (value !== null && value !== void 0 ? value : []).filter(function (v) { return v !== otherString; }))), field.id);
|
|
1199
1296
|
} }) }))] })));
|
|
1200
1297
|
};
|
|
1201
1298
|
// Helper to emit GTM purchase event for Stripe payments (single source of truth)
|
|
@@ -1646,6 +1743,7 @@ export var DatabaseSelectInput = function (_a) {
|
|
|
1646
1743
|
var AddToDatabase = _a.AddToDatabase, field = _a.field, _value = _a.value, onChange = _a.onChange, onDatabaseSelect = _a.onDatabaseSelect, responses = _a.responses, size = _a.size, disabled = _a.disabled, enduser = _a.enduser, inputProps = _a.inputProps;
|
|
1647
1744
|
var _l = useState(''), typing = _l[0], setTyping = _l[1];
|
|
1648
1745
|
var _m = useState(false), open = _m[0], setOpen = _m[1];
|
|
1746
|
+
var selectedRecordsCache = useRef(new Map());
|
|
1649
1747
|
var _o = useDatabaseChoices({
|
|
1650
1748
|
databaseId: (_b = field.options) === null || _b === void 0 ? void 0 : _b.databaseId,
|
|
1651
1749
|
field: field,
|
|
@@ -1653,15 +1751,31 @@ export var DatabaseSelectInput = function (_a) {
|
|
|
1653
1751
|
searchQuery: typing,
|
|
1654
1752
|
}), addChoice = _o.addChoice, choices = _o.choices, doneLoading = _o.doneLoading, isSearching = _o.isSearching, minSearchChars = _o.minSearchChars;
|
|
1655
1753
|
var value = React.useMemo(function () {
|
|
1656
|
-
var _a, _b;
|
|
1657
1754
|
try {
|
|
1658
|
-
// if the value is a string (some single answer that was
|
|
1755
|
+
// if the value is a string (some single answer that was saved), make sure we coerce to array
|
|
1659
1756
|
var __value = typeof _value === 'string' ? [_value] : _value;
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1757
|
+
var result = [];
|
|
1758
|
+
var _loop_2 = function (v) {
|
|
1759
|
+
var recordId = typeof v === 'string' ? v : v.recordId;
|
|
1760
|
+
// First try to find in current choices
|
|
1761
|
+
var found = choices.find(function (c) {
|
|
1762
|
+
return c.id === recordId || (typeof v === 'string' && label_for_database_record(field, c) === v);
|
|
1663
1763
|
});
|
|
1664
|
-
|
|
1764
|
+
if (found) {
|
|
1765
|
+
// Update cache with found record
|
|
1766
|
+
selectedRecordsCache.current.set(found.id, found);
|
|
1767
|
+
result.push(found);
|
|
1768
|
+
}
|
|
1769
|
+
else if (recordId && selectedRecordsCache.current.has(recordId)) {
|
|
1770
|
+
// Use cached record if not in current choices (e.g., during search)
|
|
1771
|
+
result.push(selectedRecordsCache.current.get(recordId));
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
for (var _a = 0, _b = (__value !== null && __value !== void 0 ? __value : []); _a < _b.length; _a++) {
|
|
1775
|
+
var v = _b[_a];
|
|
1776
|
+
_loop_2(v);
|
|
1777
|
+
}
|
|
1778
|
+
return result;
|
|
1665
1779
|
}
|
|
1666
1780
|
catch (err) {
|
|
1667
1781
|
console.error('Error resolving database answers for _value', err);
|
|
@@ -2215,7 +2329,7 @@ export var AppointmentBookingInput = function (_a) {
|
|
|
2215
2329
|
var _s = useState(false), confirming = _s[0], setConfirming = _s[1];
|
|
2216
2330
|
var bookingPageId = (_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.bookingPageId;
|
|
2217
2331
|
var downloadICS = useCallback(function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2218
|
-
var _a,
|
|
2332
|
+
var _a, err_7;
|
|
2219
2333
|
return __generator(this, function (_b) {
|
|
2220
2334
|
switch (_b.label) {
|
|
2221
2335
|
case 0:
|
|
@@ -2227,8 +2341,8 @@ export var AppointmentBookingInput = function (_a) {
|
|
|
2227
2341
|
{ name: "event.ics", dataIsURL: true, type: 'text/calendar' }]);
|
|
2228
2342
|
return [3 /*break*/, 3];
|
|
2229
2343
|
case 2:
|
|
2230
|
-
|
|
2231
|
-
console.error(
|
|
2344
|
+
err_7 = _b.sent();
|
|
2345
|
+
console.error(err_7);
|
|
2232
2346
|
return [3 /*break*/, 3];
|
|
2233
2347
|
case 3: return [2 /*return*/];
|
|
2234
2348
|
}
|
|
@@ -2603,7 +2717,7 @@ export var AllergiesInput = function (_a) {
|
|
|
2603
2717
|
.flatMap(function (v) { var _a, _b; return ((_b = (_a = v === null || v === void 0 ? void 0 : v.resource) === null || _a === void 0 ? void 0 : _a.code) === null || _b === void 0 ? void 0 : _b.coding) || []; })
|
|
2604
2718
|
.filter(function (v) { return v.system.includes('fdbhealth'); })
|
|
2605
2719
|
.map(function (v) { return ({ code: v.code, display: v.display, system: v.system }); }));
|
|
2606
|
-
var
|
|
2720
|
+
var _loop_3 = function (v) {
|
|
2607
2721
|
if (deduped.find(function (d) { return d.display === v.display; })) {
|
|
2608
2722
|
return "continue";
|
|
2609
2723
|
}
|
|
@@ -2611,7 +2725,7 @@ export var AllergiesInput = function (_a) {
|
|
|
2611
2725
|
};
|
|
2612
2726
|
for (var _a = 0, totalResults_1 = totalResults; _a < totalResults_1.length; _a++) {
|
|
2613
2727
|
var v = totalResults_1[_a];
|
|
2614
|
-
|
|
2728
|
+
_loop_3(v);
|
|
2615
2729
|
}
|
|
2616
2730
|
setResults(deduped);
|
|
2617
2731
|
});
|
|
@@ -2620,7 +2734,7 @@ export var AllergiesInput = function (_a) {
|
|
|
2620
2734
|
session.api.allergy_codes.getSome({ search: { query: query } })
|
|
2621
2735
|
.then(function (results) {
|
|
2622
2736
|
var deduped = [];
|
|
2623
|
-
var
|
|
2737
|
+
var _loop_4 = function (v) {
|
|
2624
2738
|
if (deduped.find(function (d) { return d.display === v.display; })) {
|
|
2625
2739
|
return "continue";
|
|
2626
2740
|
}
|
|
@@ -2628,7 +2742,7 @@ export var AllergiesInput = function (_a) {
|
|
|
2628
2742
|
};
|
|
2629
2743
|
for (var _a = 0, results_1 = results; _a < results_1.length; _a++) {
|
|
2630
2744
|
var v = results_1[_a];
|
|
2631
|
-
|
|
2745
|
+
_loop_4(v);
|
|
2632
2746
|
}
|
|
2633
2747
|
setResults(deduped);
|
|
2634
2748
|
});
|
|
@@ -2663,7 +2777,7 @@ export var ConditionsInput = function (_a) {
|
|
|
2663
2777
|
session.api.diagnosis_codes.getSome({ search: { query: query } })
|
|
2664
2778
|
.then(function (codes) {
|
|
2665
2779
|
var deduped = [];
|
|
2666
|
-
var
|
|
2780
|
+
var _loop_5 = function (v) {
|
|
2667
2781
|
if (deduped.find(function (d) { return d.display === v.display; })) {
|
|
2668
2782
|
return "continue";
|
|
2669
2783
|
}
|
|
@@ -2671,7 +2785,7 @@ export var ConditionsInput = function (_a) {
|
|
|
2671
2785
|
};
|
|
2672
2786
|
for (var _a = 0, codes_1 = codes; _a < codes_1.length; _a++) {
|
|
2673
2787
|
var v = codes_1[_a];
|
|
2674
|
-
|
|
2788
|
+
_loop_5(v);
|
|
2675
2789
|
}
|
|
2676
2790
|
setResults(deduped);
|
|
2677
2791
|
});
|