@tellescope/react-components 1.249.1 → 1.249.2
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 +13 -5
- 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 +13 -5
- package/lib/cjs/Forms/forms.v2.js.map +1 -1
- package/lib/cjs/Forms/hooks.d.ts +2 -1
- package/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +49 -26
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts +19 -4
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +224 -173
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/Forms/inputs.v2.d.ts +7 -3
- package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.v2.js +42 -32
- package/lib/cjs/Forms/inputs.v2.js.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioControls.d.ts.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioControls.js +12 -2
- package/lib/cjs/TwilioVideo/TwilioControls.js.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioLocalPreview.d.ts.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioLocalPreview.js +154 -2
- package/lib/cjs/TwilioVideo/TwilioLocalPreview.js.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioVideoContext.d.ts +7 -0
- package/lib/cjs/TwilioVideo/TwilioVideoContext.d.ts.map +1 -1
- package/lib/cjs/TwilioVideo/TwilioVideoContext.js +148 -1
- package/lib/cjs/TwilioVideo/TwilioVideoContext.js.map +1 -1
- package/lib/esm/Forms/forms.d.ts.map +1 -1
- package/lib/esm/Forms/forms.js +13 -5
- 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 +13 -5
- package/lib/esm/Forms/forms.v2.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +2 -1
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +49 -26
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +19 -4
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +69 -20
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/inputs.v2.d.ts +7 -3
- package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.v2.js +27 -17
- package/lib/esm/Forms/inputs.v2.js.map +1 -1
- package/lib/esm/TwilioVideo/TwilioControls.d.ts.map +1 -1
- package/lib/esm/TwilioVideo/TwilioControls.js +14 -4
- package/lib/esm/TwilioVideo/TwilioControls.js.map +1 -1
- package/lib/esm/TwilioVideo/TwilioLocalPreview.d.ts.map +1 -1
- package/lib/esm/TwilioVideo/TwilioLocalPreview.js +155 -3
- package/lib/esm/TwilioVideo/TwilioLocalPreview.js.map +1 -1
- package/lib/esm/TwilioVideo/TwilioVideoContext.d.ts +7 -0
- package/lib/esm/TwilioVideo/TwilioVideoContext.d.ts.map +1 -1
- package/lib/esm/TwilioVideo/TwilioVideoContext.js +146 -0
- package/lib/esm/TwilioVideo/TwilioVideoContext.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -10
- package/src/Forms/forms.tsx +18 -2
- package/src/Forms/forms.v2.tsx +18 -2
- package/src/Forms/hooks.tsx +67 -30
- package/src/Forms/inputs.tsx +143 -18
- package/src/Forms/inputs.v2.tsx +58 -8
- package/src/TwilioVideo/TwilioControls.tsx +27 -1
- package/src/TwilioVideo/TwilioLocalPreview.tsx +136 -1
- package/src/TwilioVideo/TwilioVideoContext.tsx +126 -0
package/lib/cjs/Forms/inputs.js
CHANGED
|
@@ -97,9 +97,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
97
97
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
98
98
|
};
|
|
99
99
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
100
|
-
exports.
|
|
100
|
+
exports.RichTextInput = exports.ConditionsInput = exports.AllergiesInput = exports.EmotiiInput = exports.HiddenValueInput = exports.RedirectInput = exports.include_current_url_parameters_if_templated = exports.HeightInput = exports.AppointmentBookingInput = exports.RelatedContactsInput = exports.contact_is_valid = exports.BelugaPatientPreferenceInput = exports.MedicationsInput = exports.CanvasMedicationsInput = exports.DatabaseSelectInput = exports.DropdownInput = exports.Progress = exports.StripeInput = exports.MultipleChoiceInput = exports.FilesInput = exports.safe_create_url = exports.FileInput = exports.ExistingFilePicker = exports.convertHEIC = exports.SignatureInput = exports.ESignatureTerms = exports.AddressInput = exports.TimezoneInput = exports.TimeInput = exports.PharmacySearchInput = exports.CandidEligibilityInput = exports.BridgeEligibilityInput = exports.InsuranceInput = exports.NumberInput = exports.EmailInput = exports.PhoneInput = exports.StringLongInput = exports.StringInput = exports.DateStringInput = exports.AutoFocusTextField = exports.TableInput = exports.DateInput = exports.RankingInput = exports.RatingInput = exports.PdfViewer = exports.defaultButtonStyles = exports.defaultInputProps = exports.LanguageSelect = exports.setBridgeEligibilityUserIds = exports.getBridgeEligibilityUserIds = void 0;
|
|
101
|
+
exports.ChargeebeeInput = void 0;
|
|
102
|
+
var react_1 = require("react");
|
|
101
103
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
102
|
-
var
|
|
104
|
+
var react_2 = __importStar(require("react"));
|
|
103
105
|
var axios_1 = __importDefault(require("axios"));
|
|
104
106
|
var material_1 = require("@mui/material");
|
|
105
107
|
var react_dropzone_1 = require("react-dropzone");
|
|
@@ -135,8 +137,8 @@ var setBridgeEligibilityUserIds = function (userIds) {
|
|
|
135
137
|
exports.setBridgeEligibilityUserIds = setBridgeEligibilityUserIds;
|
|
136
138
|
// Debounce hook for search functionality
|
|
137
139
|
var useDebounce = function (value, delay) {
|
|
138
|
-
var _a = (0,
|
|
139
|
-
(0,
|
|
140
|
+
var _a = (0, react_2.useState)(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
|
|
141
|
+
(0, react_2.useEffect)(function () {
|
|
140
142
|
var handler = setTimeout(function () { return setDebouncedValue(value); }, delay);
|
|
141
143
|
return function () { return clearTimeout(handler); };
|
|
142
144
|
}, [value, delay]);
|
|
@@ -228,11 +230,11 @@ var RankingInput = function (_a) {
|
|
|
228
230
|
} }, { children: (0, jsx_runtime_1.jsx)(react_beautiful_dnd_1.Droppable, __assign({ droppableId: "droppable" }, { children: function (provided, snapshot) { return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({}, provided.droppableProps, { ref: provided.innerRef, sx: getListStyle(snapshot.isDraggingOver) }, { children: [(value !== null && value !== void 0 ? value : []).map(function (item, index) { return ((0, jsx_runtime_1.jsx)(react_beautiful_dnd_1.Draggable, __assign({ draggableId: item, index: index }, { children: function (provided, snapshot) { return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, alignItems: "center", justifyContent: "space-between", ref: provided.innerRef }, provided.draggableProps, provided.dragHandleProps, { sx: getItemStyle(snapshot.isDragging, provided.draggableProps.style) }, { children: [item, (0, jsx_runtime_1.jsx)(DragIndicator_1.default, { color: "primary" })] }))); } }), item)); }), provided.placeholder] }))); } })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ color: "primary", style: { marginTop: 3 } }, { children: (0, __1.form_display_text_for_language)(form, "Drag and drop to re-order the above options") }))] })));
|
|
229
231
|
};
|
|
230
232
|
exports.RankingInput = RankingInput;
|
|
231
|
-
var CustomDateInput = (0,
|
|
233
|
+
var CustomDateInput = (0, react_2.forwardRef)(function (props, ref) { return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ InputProps: exports.defaultInputProps, fullWidth: true, inputRef: ref }, props))); });
|
|
232
234
|
var DateInput = function (_a) {
|
|
233
235
|
var _b, _d;
|
|
234
236
|
var field = _a.field, value = _a.value, onChange = _a.onChange, _e = _a.placement, placement = _e === void 0 ? 'top' : _e, props = __rest(_a, ["field", "value", "onChange", "placement"]);
|
|
235
|
-
var inputRef = (0,
|
|
237
|
+
var inputRef = (0, react_2.useRef)(null);
|
|
236
238
|
var minDate = ((_b = field.options) === null || _b === void 0 ? void 0 : _b.minDateOffsetMs) !== undefined ? (0, hooks_1.dateFromOffsetMs)(field.options.minDateOffsetMs) : undefined;
|
|
237
239
|
var maxDate = ((_d = field.options) === null || _d === void 0 ? void 0 : _d.maxDateOffsetMs) !== undefined ? (0, hooks_1.dateFromOffsetMs)(field.options.maxDateOffsetMs) : undefined;
|
|
238
240
|
return ((0, jsx_runtime_1.jsx)(react_datepicker_1.default // wrap in item to prevent movement on focused
|
|
@@ -245,7 +247,7 @@ var TableInput = function (_a) {
|
|
|
245
247
|
var _b;
|
|
246
248
|
var field = _a.field, _d = _a.value, value = _d === void 0 ? [] : _d, onChange = _a.onChange, form = _a.form, props = __rest(_a, ["field", "value", "onChange", "form"]);
|
|
247
249
|
var choices = (_b = field.options) === null || _b === void 0 ? void 0 : _b.tableChoices;
|
|
248
|
-
var handleNewRow = (0,
|
|
250
|
+
var handleNewRow = (0, react_2.useCallback)(function () {
|
|
249
251
|
if (!(choices === null || choices === void 0 ? void 0 : choices.length))
|
|
250
252
|
return;
|
|
251
253
|
onChange(__spreadArray(__spreadArray([], value, true), [choices.map(function (c) { return ({
|
|
@@ -253,17 +255,17 @@ var TableInput = function (_a) {
|
|
|
253
255
|
entry: '',
|
|
254
256
|
}); })], false), field.id, true);
|
|
255
257
|
}, [value, field.id]);
|
|
256
|
-
var handleChange = (0,
|
|
258
|
+
var handleChange = (0, react_2.useCallback)(function (r, c, u) {
|
|
257
259
|
onChange(value.map(function (v, _i) {
|
|
258
260
|
return _i !== r
|
|
259
261
|
? v
|
|
260
262
|
: v.map(function (e, _c) { return _c === c ? u : e; });
|
|
261
263
|
}), field.id, true);
|
|
262
264
|
}, [value, onChange, field.id]);
|
|
263
|
-
var handleRemove = (0,
|
|
265
|
+
var handleRemove = (0, react_2.useCallback)(function (i) {
|
|
264
266
|
onChange(value.filter(function (_, _i) { return i !== _i; }), field.id, true);
|
|
265
267
|
}, [value, onChange, field.id]);
|
|
266
|
-
(0,
|
|
268
|
+
(0, react_2.useEffect)(function () {
|
|
267
269
|
if (field.isOptional)
|
|
268
270
|
return;
|
|
269
271
|
if (value.length)
|
|
@@ -299,14 +301,14 @@ var AutoFocusTextField = function (props) {
|
|
|
299
301
|
return (0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ InputProps: inputProps || exports.defaultInputProps }, textFieldProps));
|
|
300
302
|
};
|
|
301
303
|
exports.AutoFocusTextField = AutoFocusTextField;
|
|
302
|
-
var CustomDateStringInput = (0,
|
|
304
|
+
var CustomDateStringInput = (0, react_2.forwardRef)(function (props, ref) {
|
|
303
305
|
var inputProps = props.inputProps, textFieldProps = __rest(props, ["inputProps"]);
|
|
304
306
|
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ InputProps: inputProps || exports.defaultInputProps, fullWidth: true, inputRef: ref }, textFieldProps)));
|
|
305
307
|
});
|
|
306
308
|
var DateStringInput = function (_a) {
|
|
307
309
|
var _b, _d, _e;
|
|
308
310
|
var field = _a.field, value = _a.value, onChange = _a.onChange, form = _a.form, props = __rest(_a, ["field", "value", "onChange", "form"]);
|
|
309
|
-
var inputRef = (0,
|
|
311
|
+
var inputRef = (0, react_2.useRef)(null);
|
|
310
312
|
var minDate = ((_b = field.options) === null || _b === void 0 ? void 0 : _b.minDateOffsetMs) !== undefined ? (0, hooks_1.dateFromOffsetMs)(field.options.minDateOffsetMs) : undefined;
|
|
311
313
|
var maxDate = ((_d = field.options) === null || _d === void 0 ? void 0 : _d.maxDateOffsetMs) !== undefined ? (0, hooks_1.dateFromOffsetMs)(field.options.maxDateOffsetMs) : undefined;
|
|
312
314
|
// if (value && isDateString(value)) {
|
|
@@ -358,8 +360,8 @@ exports.EmailInput = EmailInput;
|
|
|
358
360
|
var NumberInput = function (_a) {
|
|
359
361
|
var field = _a.field, value = _a.value, onChange = _a.onChange, form = _a.form, props = __rest(_a, ["field", "value", "onChange", "form"]);
|
|
360
362
|
// Prevent the default scroll behavior when focused on this input
|
|
361
|
-
var inputRef = (0,
|
|
362
|
-
(0,
|
|
363
|
+
var inputRef = (0, react_2.useRef)(null);
|
|
364
|
+
(0, react_2.useEffect)(function () {
|
|
363
365
|
var _a;
|
|
364
366
|
var handleWheel = function (e) {
|
|
365
367
|
var _a;
|
|
@@ -394,9 +396,9 @@ var InsuranceInput = function (_a) {
|
|
|
394
396
|
var _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
395
397
|
var field = _a.field, onDatabaseSelect = _a.onDatabaseSelect, value = _a.value, onChange = _a.onChange, form = _a.form, responses = _a.responses, enduser = _a.enduser, inputProps = _a.inputProps, props = __rest(_a, ["field", "onDatabaseSelect", "value", "onChange", "form", "responses", "enduser", "inputProps"]);
|
|
396
398
|
var session = (0, __1.useResolvedSession)();
|
|
397
|
-
var _t = (0,
|
|
398
|
-
var _u = (0,
|
|
399
|
-
var addressQuestion = (0,
|
|
399
|
+
var _t = (0, react_2.useState)([]), payers = _t[0], setPayers = _t[1];
|
|
400
|
+
var _u = (0, react_2.useState)(''), query = _u[0], setQuery = _u[1];
|
|
401
|
+
var addressQuestion = (0, react_2.useMemo)(function () { return responses === null || responses === void 0 ? void 0 : responses.find(function (r) {
|
|
400
402
|
var _a;
|
|
401
403
|
if (r.answer.type !== 'Address')
|
|
402
404
|
return false;
|
|
@@ -407,13 +409,13 @@ var InsuranceInput = function (_a) {
|
|
|
407
409
|
return false;
|
|
408
410
|
return true;
|
|
409
411
|
}); }, [responses]);
|
|
410
|
-
var state = (0,
|
|
412
|
+
var state = (0, react_2.useMemo)(function () {
|
|
411
413
|
var _a, _b, _d;
|
|
412
414
|
return ((((_a = addressQuestion === null || addressQuestion === void 0 ? void 0 : addressQuestion.answer) === null || _a === void 0 ? void 0 : _a.type) === 'Address' ? (_d = (_b = addressQuestion === null || addressQuestion === void 0 ? void 0 : addressQuestion.answer) === null || _b === void 0 ? void 0 : _b.value) === null || _d === void 0 ? void 0 : _d.state : undefined) || (enduser === null || enduser === void 0 ? void 0 : enduser.state));
|
|
413
415
|
}, [enduser === null || enduser === void 0 ? void 0 : enduser.state, addressQuestion]);
|
|
414
416
|
// load from database
|
|
415
|
-
var loadRef = (0,
|
|
416
|
-
(0,
|
|
417
|
+
var loadRef = (0, react_2.useRef)(false); // so session changes don't cause
|
|
418
|
+
(0, react_2.useEffect)(function () {
|
|
417
419
|
var _a, _b;
|
|
418
420
|
if (((_a = field === null || field === void 0 ? void 0 : field.options) === null || _a === void 0 ? void 0 : _a.dataSource) === constants_1.CANVAS_TITLE)
|
|
419
421
|
return; // instead, look-up while typing against Canvas Search API
|
|
@@ -442,8 +444,8 @@ var InsuranceInput = function (_a) {
|
|
|
442
444
|
.catch(console.error);
|
|
443
445
|
}, [session, state, (_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.dataSource]);
|
|
444
446
|
// load from 3rd-party on search only
|
|
445
|
-
var searchRef = (0,
|
|
446
|
-
(0,
|
|
447
|
+
var searchRef = (0, react_2.useRef)(query);
|
|
448
|
+
(0, react_2.useEffect)(function () {
|
|
447
449
|
var _a, _b, _d, _e;
|
|
448
450
|
if (((_a = field === null || field === void 0 ? void 0 : field.options) === null || _a === void 0 ? void 0 : _a.dataSource) !== constants_1.CANVAS_TITLE && ((_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.dataSource) !== constants_1.BRIDGE_TITLE) {
|
|
449
451
|
return;
|
|
@@ -479,8 +481,11 @@ var InsuranceInput = function (_a) {
|
|
|
479
481
|
return function () { clearTimeout(t); };
|
|
480
482
|
}, [session, (_d = field === null || field === void 0 ? void 0 : field.options) === null || _d === void 0 ? void 0 : _d.dataSource, query]);
|
|
481
483
|
return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, spacing: 2, sx: { mt: '0' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.Autocomplete, { freeSolo: !((_e = field.options) === null || _e === void 0 ? void 0 : _e.requirePredefinedInsurer), options: payers.map(function (p) { return p.name; }), value: (value === null || value === void 0 ? void 0 : value.payerName) || '', onChange: function (e, v) {
|
|
482
|
-
var
|
|
483
|
-
|
|
484
|
+
var matched = payers.find(function (p) { return p.name === v; });
|
|
485
|
+
if (matched === null || matched === void 0 ? void 0 : matched.databaseRecord) {
|
|
486
|
+
onDatabaseSelect === null || onDatabaseSelect === void 0 ? void 0 : onDatabaseSelect([matched.databaseRecord]);
|
|
487
|
+
}
|
|
488
|
+
onChange(__assign(__assign({}, value), { payerName: v || '', payerId: (matched === null || matched === void 0 ? void 0 : matched.id) || '', payerType: (matched === null || matched === void 0 ? void 0 : matched.type) || '' }), field.id);
|
|
484
489
|
}, onInputChange: ((_f = field.options) === null || _f === void 0 ? void 0 : _f.requirePredefinedInsurer)
|
|
485
490
|
? function (e, v) { if (v) {
|
|
486
491
|
setQuery(v);
|
|
@@ -530,14 +535,14 @@ var BridgeEligibilityInput = function (_a) {
|
|
|
530
535
|
var _b, _d, _e, _f, _g, _h, _j;
|
|
531
536
|
var field = _a.field, value = _a.value, onChange = _a.onChange, responses = _a.responses, enduser = _a.enduser, inputProps = _a.inputProps, enduserId = _a.enduserId, form = _a.form, props = __rest(_a, ["field", "value", "onChange", "responses", "enduser", "inputProps", "enduserId", "form"]);
|
|
532
537
|
var session = (0, __1.useResolvedSession)();
|
|
533
|
-
var _k = (0,
|
|
534
|
-
var _l = (0,
|
|
535
|
-
var _m = (0,
|
|
538
|
+
var _k = (0, react_2.useState)(false), loading = _k[0], setLoading = _k[1];
|
|
539
|
+
var _l = (0, react_2.useState)(false), polling = _l[0], setPolling = _l[1];
|
|
540
|
+
var _m = (0, react_2.useState)(), error = _m[0], setError = _m[1];
|
|
536
541
|
// single-page form must require button-click to check, but 1-page-at-a-time enduser sessions should auto-check
|
|
537
542
|
var isEnduserSession = session.type === 'enduser';
|
|
538
543
|
var eligibilityType = ((_b = field.options) === null || _b === void 0 ? void 0 : _b.bridgeEligibilityType) || 'Soft';
|
|
539
544
|
// Extract payerId from Insurance question response
|
|
540
|
-
var _o = (0,
|
|
545
|
+
var _o = (0, react_2.useMemo)(function () {
|
|
541
546
|
var _a, _b, _d, _e;
|
|
542
547
|
var insuranceResponse = 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) === 'Insurance' && ((_d = (_b = r.answer) === null || _b === void 0 ? void 0 : _b.value) === null || _d === void 0 ? void 0 : _d.payerId); });
|
|
543
548
|
if (((_a = insuranceResponse === null || insuranceResponse === void 0 ? void 0 : insuranceResponse.answer) === null || _a === void 0 ? void 0 : _a.type) === 'Insurance') {
|
|
@@ -551,7 +556,7 @@ var BridgeEligibilityInput = function (_a) {
|
|
|
551
556
|
return [];
|
|
552
557
|
}, [responses]), payerId = _o[0], memberId = _o[1], payerName = _o[2];
|
|
553
558
|
// Extract state from Address question or enduser
|
|
554
|
-
var state = (0,
|
|
559
|
+
var state = (0, react_2.useMemo)(function () {
|
|
555
560
|
var _a, _b;
|
|
556
561
|
// Find Address field with state value
|
|
557
562
|
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.state); });
|
|
@@ -561,7 +566,7 @@ var BridgeEligibilityInput = function (_a) {
|
|
|
561
566
|
// enduser state is automatically resolved on the backend as default
|
|
562
567
|
}, [responses]);
|
|
563
568
|
// Soft eligibility check function - supports multiple service type IDs
|
|
564
|
-
var checkProviderEligibility = (0,
|
|
569
|
+
var checkProviderEligibility = (0, react_2.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
565
570
|
var serviceTypeIds, results, allUserIds, uniqueUserIds, aggregatedStatus, err_1;
|
|
566
571
|
var _a, _b;
|
|
567
572
|
return __generator(this, function (_d) {
|
|
@@ -645,7 +650,7 @@ var BridgeEligibilityInput = function (_a) {
|
|
|
645
650
|
});
|
|
646
651
|
}); }, [session, field, payerId, state, onChange, enduserId]);
|
|
647
652
|
// Hard eligibility check function with polling - supports multiple service type IDs
|
|
648
|
-
var checkServiceEligibility = (0,
|
|
653
|
+
var checkServiceEligibility = (0, react_2.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
649
654
|
var serviceTypeIds, initiatedChecks_1, pollForAllResults, err_3;
|
|
650
655
|
var _a;
|
|
651
656
|
return __generator(this, function (_b) {
|
|
@@ -832,8 +837,8 @@ var BridgeEligibilityInput = function (_a) {
|
|
|
832
837
|
});
|
|
833
838
|
}); }, [session, field, payerId, memberId, state, onChange, enduserId]);
|
|
834
839
|
// Auto-check eligibility for enduser sessions
|
|
835
|
-
var autoCheckRef = (0,
|
|
836
|
-
(0,
|
|
840
|
+
var autoCheckRef = (0, react_2.useRef)(false);
|
|
841
|
+
(0, react_2.useEffect)(function () {
|
|
837
842
|
if (!isEnduserSession)
|
|
838
843
|
return;
|
|
839
844
|
// If we already have a result and the payer hasn't changed, use the cached result
|
|
@@ -850,13 +855,13 @@ var BridgeEligibilityInput = function (_a) {
|
|
|
850
855
|
checkProviderEligibility();
|
|
851
856
|
}
|
|
852
857
|
}, [isEnduserSession, eligibilityType, checkProviderEligibility, checkServiceEligibility, value, payerId]);
|
|
853
|
-
var errorComponent = (0,
|
|
858
|
+
var errorComponent = (0, react_2.useMemo)(function () { return ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center", style: { padding: '20px 0' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Paper, __assign({ style: {
|
|
854
859
|
padding: 16,
|
|
855
860
|
backgroundColor: '#ffebee',
|
|
856
861
|
border: '2px solid #f44336'
|
|
857
862
|
} }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h2", style: { color: '#f44336' } }, { children: "\u26A0\uFE0F" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h6", align: "center", color: "error" }, { children: "Unable to Check Eligibility" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body2", align: "center", style: { color: '#d32f2f' } }, { children: error })) }))] })) })) })) }))); }, [error]);
|
|
858
|
-
var checkingEligibilityComponent = (0,
|
|
859
|
-
var resultsComponent = (0,
|
|
863
|
+
var checkingEligibilityComponent = (0, react_2.useMemo)(function () { return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center", style: { padding: '20px 0' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 40 }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1" }, { children: polling ? 'Verifying eligibility with insurance...' : 'Checking eligibility...' })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: polling ? 'This usually takes 15-30 seconds' : 'This may take a few moments' })) }))] }))); }, [polling]);
|
|
864
|
+
var resultsComponent = (0, react_2.useMemo)(function () {
|
|
860
865
|
var isEligible = (value === null || value === void 0 ? void 0 : value.status) === 'ELIGIBLE';
|
|
861
866
|
return ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ container: true, spacing: 2, direction: "column" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Paper, __assign({ style: {
|
|
862
867
|
padding: 16,
|
|
@@ -887,20 +892,20 @@ var CandidEligibilityInput = function (_a) {
|
|
|
887
892
|
var _b, _d;
|
|
888
893
|
var field = _a.field, value = _a.value, onChange = _a.onChange, responses = _a.responses, enduser = _a.enduser, inputProps = _a.inputProps, enduserId = _a.enduserId, form = _a.form, props = __rest(_a, ["field", "value", "onChange", "responses", "enduser", "inputProps", "enduserId", "form"]);
|
|
889
894
|
var session = (0, __1.useResolvedSession)();
|
|
890
|
-
var _e = (0,
|
|
891
|
-
var _f = (0,
|
|
892
|
-
var _g = (0,
|
|
895
|
+
var _e = (0, react_2.useState)(false), loading = _e[0], setLoading = _e[1];
|
|
896
|
+
var _f = (0, react_2.useState)(false), polling = _f[0], setPolling = _f[1];
|
|
897
|
+
var _g = (0, react_2.useState)(), error = _g[0], setError = _g[1];
|
|
893
898
|
var isEnduserSession = session.type === 'enduser';
|
|
894
|
-
var pollTimeoutRef = (0,
|
|
899
|
+
var pollTimeoutRef = (0, react_2.useRef)();
|
|
895
900
|
// Clean up polling timeout on unmount
|
|
896
|
-
(0,
|
|
901
|
+
(0, react_2.useEffect)(function () {
|
|
897
902
|
return function () {
|
|
898
903
|
if (pollTimeoutRef.current)
|
|
899
904
|
clearTimeout(pollTimeoutRef.current);
|
|
900
905
|
};
|
|
901
906
|
}, []);
|
|
902
907
|
// Extract payerId from Insurance question response
|
|
903
|
-
var _h = (0,
|
|
908
|
+
var _h = (0, react_2.useMemo)(function () {
|
|
904
909
|
var _a, _b, _d, _e;
|
|
905
910
|
var insuranceResponse = 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) === 'Insurance' && ((_d = (_b = r.answer) === null || _b === void 0 ? void 0 : _b.value) === null || _d === void 0 ? void 0 : _d.payerId); });
|
|
906
911
|
if (((_a = insuranceResponse === null || insuranceResponse === void 0 ? void 0 : insuranceResponse.answer) === null || _a === void 0 ? void 0 : _a.type) === 'Insurance') {
|
|
@@ -912,7 +917,7 @@ var CandidEligibilityInput = function (_a) {
|
|
|
912
917
|
}
|
|
913
918
|
return [];
|
|
914
919
|
}, [responses]), payerId = _h[0], memberId = _h[1], payerName = _h[2];
|
|
915
|
-
var checkEligibility = (0,
|
|
920
|
+
var checkEligibility = (0, react_2.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
916
921
|
var data, coverageId_1, checkId_1, initialStatus, maxAttempts_1, attempts_1, pollForResult_1, err_6;
|
|
917
922
|
var _a, _b;
|
|
918
923
|
return __generator(this, function (_d) {
|
|
@@ -1019,8 +1024,8 @@ var CandidEligibilityInput = function (_a) {
|
|
|
1019
1024
|
});
|
|
1020
1025
|
}); }, [session, field, payerId, memberId, payerName, onChange, enduserId]);
|
|
1021
1026
|
// Auto-check eligibility for enduser sessions
|
|
1022
|
-
var autoCheckRef = (0,
|
|
1023
|
-
(0,
|
|
1027
|
+
var autoCheckRef = (0, react_2.useRef)(false);
|
|
1028
|
+
(0, react_2.useEffect)(function () {
|
|
1024
1029
|
if (!isEnduserSession)
|
|
1025
1030
|
return;
|
|
1026
1031
|
// If we already have a result and the payer hasn't changed, use the cached result
|
|
@@ -1032,13 +1037,13 @@ var CandidEligibilityInput = function (_a) {
|
|
|
1032
1037
|
autoCheckRef.current = true;
|
|
1033
1038
|
checkEligibility();
|
|
1034
1039
|
}, [isEnduserSession, checkEligibility, value, payerId]);
|
|
1035
|
-
var errorComponent = (0,
|
|
1040
|
+
var errorComponent = (0, react_2.useMemo)(function () { return ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center", style: { padding: '20px 0' } }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Paper, __assign({ style: {
|
|
1036
1041
|
padding: 16,
|
|
1037
1042
|
backgroundColor: '#ffebee',
|
|
1038
1043
|
border: '2px solid #f44336'
|
|
1039
1044
|
} }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h2", style: { color: '#f44336' } }, { children: "!" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "h6", align: "center", color: "error" }, { children: "Unable to Check Eligibility" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body2", align: "center", style: { color: '#d32f2f' } }, { children: error })) }))] })) })) })) }))); }, [error]);
|
|
1040
|
-
var checkingEligibilityComponent = (0,
|
|
1041
|
-
var resultsComponent = (0,
|
|
1045
|
+
var checkingEligibilityComponent = (0, react_2.useMemo)(function () { return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center", style: { padding: '20px 0' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, { size: 40 }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body1" }, { children: polling ? 'Verifying eligibility with insurance...' : 'Checking eligibility...' })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: polling ? 'This usually takes 15-30 seconds' : 'This may take a few moments' })) }))] }))); }, [polling]);
|
|
1046
|
+
var resultsComponent = (0, react_2.useMemo)(function () {
|
|
1042
1047
|
var isCompleted = (value === null || value === void 0 ? void 0 : value.status) === 'COMPLETED';
|
|
1043
1048
|
var isFailed = (value === null || value === void 0 ? void 0 : value.status) === 'FAILED';
|
|
1044
1049
|
return ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ container: true, spacing: 2, direction: "column" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Paper, __assign({ style: {
|
|
@@ -1086,12 +1091,12 @@ var PharmacySearchInput = function (_a) {
|
|
|
1086
1091
|
// Fall back to enduser.zipCode
|
|
1087
1092
|
return (enduser === null || enduser === void 0 ? void 0 : enduser.zipCode) || '';
|
|
1088
1093
|
};
|
|
1089
|
-
var _b = (0,
|
|
1090
|
-
var _d = (0,
|
|
1091
|
-
var _e = (0,
|
|
1092
|
-
var _f = (0,
|
|
1093
|
-
var _g = (0,
|
|
1094
|
-
var searchPharmacies = (0,
|
|
1094
|
+
var _b = (0, react_2.useState)(getInitialZipCode()), zipCode = _b[0], setZipCode = _b[1];
|
|
1095
|
+
var _d = (0, react_2.useState)(false), loading = _d[0], setLoading = _d[1];
|
|
1096
|
+
var _e = (0, react_2.useState)(), error = _e[0], setError = _e[1];
|
|
1097
|
+
var _f = (0, react_2.useState)([]), pharmacies = _f[0], setPharmacies = _f[1];
|
|
1098
|
+
var _g = (0, react_2.useState)(false), hasSearched = _g[0], setHasSearched = _g[1];
|
|
1099
|
+
var searchPharmacies = (0, react_2.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1095
1100
|
var data, err_8;
|
|
1096
1101
|
return __generator(this, function (_a) {
|
|
1097
1102
|
switch (_a.label) {
|
|
@@ -1289,12 +1294,49 @@ function convertHEIC(file) {
|
|
|
1289
1294
|
exports.convertHEIC = convertHEIC;
|
|
1290
1295
|
;
|
|
1291
1296
|
var value_is_image = function (f) { var _a; return (_a = f === null || f === void 0 ? void 0 : f.type) === null || _a === void 0 ? void 0 : _a.includes('image'); };
|
|
1297
|
+
var fileMatchesValidTypes = function (file, validFileTypes) {
|
|
1298
|
+
if (!(validFileTypes === null || validFileTypes === void 0 ? void 0 : validFileTypes.length))
|
|
1299
|
+
return true;
|
|
1300
|
+
if (!file.type)
|
|
1301
|
+
return false;
|
|
1302
|
+
return !!validFileTypes.find(function (t) { return file.type.includes(t.toLowerCase()); });
|
|
1303
|
+
};
|
|
1304
|
+
var ExistingFilePicker = function (_a) {
|
|
1305
|
+
var enduserId = _a.enduserId, excludedSecureNames = _a.excludedSecureNames, validFileTypes = _a.validFileTypes, onSelect = _a.onSelect, form = _a.form, label = _a.label;
|
|
1306
|
+
var session = (0, __1.useResolvedSession)();
|
|
1307
|
+
var isEnduserSession = session.type === 'enduser';
|
|
1308
|
+
var _b = (0, __1.useFiles)({
|
|
1309
|
+
loadFilter: { enduserId: enduserId },
|
|
1310
|
+
dontFetch: !enduserId || isEnduserSession,
|
|
1311
|
+
}), getFiltered = _b[1].filtered;
|
|
1312
|
+
var filesLoading = getFiltered(function (e) { return (!!enduserId) && (e.enduserId === enduserId); });
|
|
1313
|
+
var filtered = (0, react_2.useMemo)(function () {
|
|
1314
|
+
if (!(0, __1.value_is_loaded)(filesLoading))
|
|
1315
|
+
return [];
|
|
1316
|
+
return filesLoading.value.filter(function (f) { return (!!f.confirmedAt
|
|
1317
|
+
&& fileMatchesValidTypes(f, validFileTypes)
|
|
1318
|
+
&& !(excludedSecureNames === null || excludedSecureNames === void 0 ? void 0 : excludedSecureNames.includes(f.secureName))); });
|
|
1319
|
+
}, [filesLoading, validFileTypes, excludedSecureNames]);
|
|
1320
|
+
// Only available in User (staff) sessions — endusers must upload.
|
|
1321
|
+
if (isEnduserSession)
|
|
1322
|
+
return null;
|
|
1323
|
+
if (!enduserId)
|
|
1324
|
+
return null;
|
|
1325
|
+
if (filtered.length === 0)
|
|
1326
|
+
return null;
|
|
1327
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, sx: { mt: 1 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Autocomplete, { size: "small", options: filtered, getOptionLabel: function (f) { return f.name; }, renderOption: function (props, option) { return ((0, react_1.createElement)("li", __assign({}, props, { key: option.id }),
|
|
1328
|
+
(0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { fontSize: 14 } }, { children: option.name })), option.timestamp && ((0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { fontSize: 12, color: '#666' } }, { children: new Date(option.timestamp).toLocaleDateString() })))] })))); }, onChange: function (_, value) {
|
|
1329
|
+
if (value)
|
|
1330
|
+
onSelect(value);
|
|
1331
|
+
}, value: null, blurOnSelect: true, clearOnBlur: true, renderInput: function (params) { return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({}, params, { label: label || (0, __1.form_display_text_for_language)(form, "Or select an existing file from this patient") }))); } }) })));
|
|
1332
|
+
};
|
|
1333
|
+
exports.ExistingFilePicker = ExistingFilePicker;
|
|
1292
1334
|
var FileInput = function (_a) {
|
|
1293
|
-
var _b;
|
|
1294
|
-
var value = _a.value, onChange = _a.onChange, field = _a.field, existingFileName = _a.existingFileName, uploadingFiles = _a.uploadingFiles, handleFileUpload = _a.handleFileUpload, setUploadingFiles = _a.setUploadingFiles, form = _a.form;
|
|
1295
|
-
var
|
|
1296
|
-
var
|
|
1297
|
-
onDrop: (0,
|
|
1335
|
+
var _b, _d;
|
|
1336
|
+
var value = _a.value, onChange = _a.onChange, field = _a.field, existingFileName = _a.existingFileName, uploadingFiles = _a.uploadingFiles, handleFileUpload = _a.handleFileUpload, setUploadingFiles = _a.setUploadingFiles, form = _a.form, enduserId = _a.enduserId, onSelectExistingFile = _a.onSelectExistingFile;
|
|
1337
|
+
var _e = (0, react_2.useState)(''), error = _e[0], setError = _e[1];
|
|
1338
|
+
var _f = (0, react_dropzone_1.useDropzone)({
|
|
1339
|
+
onDrop: (0, react_2.useCallback)(function (acceptedFiles) {
|
|
1298
1340
|
var _a, _b, _d, _e;
|
|
1299
1341
|
var file = acceptedFiles.pop();
|
|
1300
1342
|
if (!file)
|
|
@@ -1316,9 +1358,9 @@ var FileInput = function (_a) {
|
|
|
1316
1358
|
.finally(function () { return setUploadingFiles === null || setUploadingFiles === void 0 ? void 0 : setUploadingFiles(function (fs) { return fs.filter(function (f) { return f.fieldId !== field.id; }); }); });
|
|
1317
1359
|
}
|
|
1318
1360
|
}, [onChange, (_b = field.options) === null || _b === void 0 ? void 0 : _b.validFileTypes, handleFileUpload, setUploadingFiles]),
|
|
1319
|
-
}), getRootProps =
|
|
1320
|
-
var
|
|
1321
|
-
(0,
|
|
1361
|
+
}), getRootProps = _f.getRootProps, getInputProps = _f.getInputProps, isDragActive = _f.isDragActive;
|
|
1362
|
+
var _g = (0, react_2.useState)(''), preview = _g[0], setPreview = _g[1];
|
|
1363
|
+
(0, react_2.useEffect)(function () {
|
|
1322
1364
|
if (!value_is_image(value))
|
|
1323
1365
|
return;
|
|
1324
1366
|
if ((value.type.includes('heif') || value.type.includes('heic'))) {
|
|
@@ -1352,7 +1394,10 @@ var FileInput = function (_a) {
|
|
|
1352
1394
|
: (0, utilities_1.capture_is_supported)()
|
|
1353
1395
|
? ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(AddPhotoAlternate_1.default, { color: "primary" }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { fontSize: 14, textAlign: 'center' } }, { children: (0, __1.form_display_text_for_language)(form, "Select file or take picture") })) }))] })))
|
|
1354
1396
|
: (0, __1.form_display_text_for_language)(form, "Select a File") })] })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, alignSelf: "center", sx: { mt: 0.5 } }, { children: (!(value === null || value === void 0 ? void 0 : value.name) && existingFileName) &&
|
|
1355
|
-
(0, jsx_runtime_1.jsxs)(material_1.Typography, { children: [existingFileName, " selected!"] }) })),
|
|
1397
|
+
(0, jsx_runtime_1.jsxs)(material_1.Typography, { children: [existingFileName, " selected!"] }) })), !value && onSelectExistingFile && ((0, jsx_runtime_1.jsx)(exports.ExistingFilePicker, { enduserId: enduserId, validFileTypes: (_d = field.options) === null || _d === void 0 ? void 0 : _d.validFileTypes, form: form, onSelect: function (file) {
|
|
1398
|
+
setError('');
|
|
1399
|
+
onSelectExistingFile({ secureName: file.secureName, name: file.name, type: file.type });
|
|
1400
|
+
} })), error &&
|
|
1356
1401
|
(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, alignSelf: "center", sx: { mt: 0.5 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ color: "error" }, { children: error })) }))] })));
|
|
1357
1402
|
};
|
|
1358
1403
|
exports.FileInput = FileInput;
|
|
@@ -1367,11 +1412,13 @@ var safe_create_url = function (file) {
|
|
|
1367
1412
|
};
|
|
1368
1413
|
exports.safe_create_url = safe_create_url;
|
|
1369
1414
|
var FilesInput = function (_a) {
|
|
1370
|
-
var _b;
|
|
1371
|
-
var value = _a.value, onChange = _a.onChange, field = _a.field, existingFileName = _a.existingFileName, uploadingFiles = _a.uploadingFiles, handleFileUpload = _a.handleFileUpload, setUploadingFiles = _a.setUploadingFiles, form = _a.form;
|
|
1372
|
-
var
|
|
1373
|
-
var
|
|
1374
|
-
|
|
1415
|
+
var _b, _d;
|
|
1416
|
+
var value = _a.value, onChange = _a.onChange, field = _a.field, existingFileName = _a.existingFileName, uploadingFiles = _a.uploadingFiles, handleFileUpload = _a.handleFileUpload, setUploadingFiles = _a.setUploadingFiles, form = _a.form, enduserId = _a.enduserId, existingSelections = _a.existingSelections, onSelectExistingFile = _a.onSelectExistingFile, onRemoveExistingFile = _a.onRemoveExistingFile;
|
|
1417
|
+
var _e = (0, react_2.useState)(''), error = _e[0], setError = _e[1];
|
|
1418
|
+
var safeExistingSelections = Array.isArray(existingSelections) ? existingSelections : undefined;
|
|
1419
|
+
var excludedSecureNames = (0, react_2.useMemo)(function () { return (safeExistingSelections === null || safeExistingSelections === void 0 ? void 0 : safeExistingSelections.map(function (s) { return s.secureName; })); }, [safeExistingSelections]);
|
|
1420
|
+
var _f = (0, react_dropzone_1.useDropzone)({
|
|
1421
|
+
onDrop: (0, react_2.useCallback)(function (acceptedFiles) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1375
1422
|
var _loop_1, _a, acceptedFiles_1, file, state_1;
|
|
1376
1423
|
var _b, _d, _e;
|
|
1377
1424
|
return __generator(this, function (_f) {
|
|
@@ -1420,8 +1467,8 @@ var FilesInput = function (_a) {
|
|
|
1420
1467
|
}
|
|
1421
1468
|
});
|
|
1422
1469
|
}); }, [onChange, value, (_b = field.options) === null || _b === void 0 ? void 0 : _b.validFileTypes, handleFileUpload, setUploadingFiles]),
|
|
1423
|
-
}), getRootProps =
|
|
1424
|
-
var previews = (0,
|
|
1470
|
+
}), getRootProps = _f.getRootProps, getInputProps = _f.getInputProps, isDragActive = _f.isDragActive;
|
|
1471
|
+
var previews = (0, react_2.useMemo)(function () { return ((value !== null && value !== void 0 ? value : []).map(function (v) {
|
|
1425
1472
|
return value_is_image(v) ? (0, exports.safe_create_url)(v) : null;
|
|
1426
1473
|
})); }, [value]);
|
|
1427
1474
|
if (uploadingFiles === null || uploadingFiles === void 0 ? void 0 : uploadingFiles.find(function (f) { return f.fieldId === field.id; })) {
|
|
@@ -1440,11 +1487,15 @@ var FilesInput = function (_a) {
|
|
|
1440
1487
|
? (0, __1.form_display_text_for_language)(form, "Drop to select files")
|
|
1441
1488
|
: (0, utilities_1.capture_is_supported)()
|
|
1442
1489
|
? ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(AddPhotoAlternate_1.default, { color: "primary" }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { fontSize: 14, textAlign: 'center' } }, { children: (0, __1.form_display_text_for_language)(form, "Select files or take pictures") })) }))] })))
|
|
1443
|
-
: (0, __1.form_display_text_for_language)(form, "Select Files") })] })), (0, jsx_runtime_1.
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1490
|
+
: (0, __1.form_display_text_for_language)(form, "Select Files") })] })), (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", sx: { overflowY: 'auto', maxHeight: '250px', mt: 1 }, wrap: "nowrap" }, { children: [value === null || value === void 0 ? void 0 : value.map(function (file, i) {
|
|
1491
|
+
var _a;
|
|
1492
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, sx: { mt: 0.5 } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, alignItems: "center", justifyContent: "space-between", wrap: "nowrap" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { mr: 1 } }, { children: file.name })), ((_a = file.type) === null || _a === void 0 ? void 0 : _a.includes('image')) && previews[i] &&
|
|
1493
|
+
(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)("img", { src: previews[i], style: { maxWidth: '45%', maxHeight: 80, height: '100%' } }) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(__1.LabeledIconButton, { label: (0, __1.form_display_text_for_language)(form, "Remove"), Icon: icons_material_1.Delete, onClick: function () { return onChange(value.filter(function (f, _i) { return i !== _i; }), field.id); } }) }))] })) }), i));
|
|
1494
|
+
}), safeExistingSelections === null || safeExistingSelections === void 0 ? void 0 : safeExistingSelections.map(function (selection, i) { return ((0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, sx: { mt: 0.5 } }, { children: (0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, alignItems: "center", justifyContent: "space-between", wrap: "nowrap" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { mr: 1 } }, { children: selection.name })) })), onRemoveExistingFile &&
|
|
1495
|
+
(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(__1.LabeledIconButton, { label: (0, __1.form_display_text_for_language)(form, "Remove"), Icon: icons_material_1.Delete, onClick: function () { return onRemoveExistingFile(selection.secureName); } }) }))] })) }), "existing-".concat(selection.secureName, "-").concat(i))); })] })), onSelectExistingFile && ((0, jsx_runtime_1.jsx)(exports.ExistingFilePicker, { enduserId: enduserId, excludedSecureNames: excludedSecureNames, validFileTypes: (_d = field.options) === null || _d === void 0 ? void 0 : _d.validFileTypes, form: form, onSelect: function (file) {
|
|
1496
|
+
setError('');
|
|
1497
|
+
onSelectExistingFile({ secureName: file.secureName, name: file.name, type: file.type });
|
|
1498
|
+
} })), error &&
|
|
1448
1499
|
(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, alignSelf: "center", sx: { mt: 0.5 } }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ color: "error" }, { children: error })) }))] })));
|
|
1449
1500
|
};
|
|
1450
1501
|
exports.FilesInput = FilesInput;
|
|
@@ -1463,9 +1514,9 @@ var MultipleChoiceInput = function (_a) {
|
|
|
1463
1514
|
var field = _a.field, form = _a.form, _value = _a.value, onChange = _a.onChange, responses = _a.responses, enduser = _a.enduser;
|
|
1464
1515
|
var value = typeof _value === 'string' ? [_value] : _value; // if loading existingResponses, allows them to be a string
|
|
1465
1516
|
var _d = field.options, choices = _d.choices, radio = _d.radio, other = _d.other, optionDetails = _d.optionDetails;
|
|
1466
|
-
var _e = (0,
|
|
1517
|
+
var _e = (0, react_2.useState)({}), expandedDescriptions = _e[0], setExpandedDescriptions = _e[1];
|
|
1467
1518
|
// current other string
|
|
1468
|
-
var enteringOtherStringRef =
|
|
1519
|
+
var enteringOtherStringRef = react_2.default.useRef(''); // if typing otherString as prefix of a checkbox value, don't auto-select
|
|
1469
1520
|
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 : '';
|
|
1470
1521
|
// Conditional visibility for choices
|
|
1471
1522
|
var _f = (0, hooks_1.useConditionalChoices)({
|
|
@@ -1478,11 +1529,11 @@ var MultipleChoiceInput = function (_a) {
|
|
|
1478
1529
|
fieldId: field.id,
|
|
1479
1530
|
otherString: otherString,
|
|
1480
1531
|
}), visibleChoices = _f.visibleChoices, handleChange = _f.handleChange;
|
|
1481
|
-
var getDescriptionForChoice = (0,
|
|
1532
|
+
var getDescriptionForChoice = (0, react_2.useCallback)(function (choice) {
|
|
1482
1533
|
var _a;
|
|
1483
1534
|
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;
|
|
1484
1535
|
}, [optionDetails]);
|
|
1485
|
-
var toggleDescription = (0,
|
|
1536
|
+
var toggleDescription = (0, react_2.useCallback)(function (index) {
|
|
1486
1537
|
setExpandedDescriptions(function (prev) {
|
|
1487
1538
|
var _a;
|
|
1488
1539
|
return (__assign(__assign({}, prev), (_a = {}, _a[index] = !prev[index], _a)));
|
|
@@ -1557,18 +1608,18 @@ var StripeInput = function (_a) {
|
|
|
1557
1608
|
var _b, _d, _e;
|
|
1558
1609
|
var field = _a.field, value = _a.value, onChange = _a.onChange, setCustomerId = _a.setCustomerId, enduserId = _a.enduserId, form = _a.form, responses = _a.responses, enduser = _a.enduser;
|
|
1559
1610
|
var session = (0, __1.useResolvedSession)();
|
|
1560
|
-
var _f = (0,
|
|
1561
|
-
var _g = (0,
|
|
1562
|
-
var _h = (0,
|
|
1563
|
-
var _j = (0,
|
|
1564
|
-
var _k = (0,
|
|
1565
|
-
var _l = (0,
|
|
1566
|
-
var _m = (0,
|
|
1567
|
-
var _o = (0,
|
|
1568
|
-
var _p = (0,
|
|
1569
|
-
var _q = (0,
|
|
1611
|
+
var _f = (0, react_2.useState)(''), clientSecret = _f[0], setClientSecret = _f[1];
|
|
1612
|
+
var _g = (0, react_2.useState)(''), businessName = _g[0], setBusinessName = _g[1];
|
|
1613
|
+
var _h = (0, react_2.useState)(false), isCheckout = _h[0], setIsCheckout = _h[1];
|
|
1614
|
+
var _j = (0, react_2.useState)(), stripePromise = _j[0], setStripePromise = _j[1];
|
|
1615
|
+
var _k = (0, react_2.useState)(''), answertext = _k[0], setAnswertext = _k[1];
|
|
1616
|
+
var _l = (0, react_2.useState)(''), error = _l[0], setError = _l[1];
|
|
1617
|
+
var _m = (0, react_2.useState)([]), selectedProducts = _m[0], setSelectedProducts = _m[1];
|
|
1618
|
+
var _o = (0, react_2.useState)(false), showProductSelection = _o[0], setShowProductSelection = _o[1];
|
|
1619
|
+
var _p = (0, react_2.useState)([]), availableProducts = _p[0], setAvailableProducts = _p[1];
|
|
1620
|
+
var _q = (0, react_2.useState)(false), loadingProducts = _q[0], setLoadingProducts = _q[1];
|
|
1570
1621
|
// Compute visible products based on conditional logic
|
|
1571
|
-
var visibleProducts = (0,
|
|
1622
|
+
var visibleProducts = (0, react_2.useMemo)(function () {
|
|
1572
1623
|
if (!showProductSelection || availableProducts.length === 0) {
|
|
1573
1624
|
return availableProducts;
|
|
1574
1625
|
}
|
|
@@ -1591,12 +1642,12 @@ var StripeInput = function (_a) {
|
|
|
1591
1642
|
});
|
|
1592
1643
|
}, [availableProducts, (_b = field.options) === null || _b === void 0 ? void 0 : _b.productConditions, responses, showProductSelection, enduser, form]);
|
|
1593
1644
|
// Automatically deselect products that become hidden
|
|
1594
|
-
(0,
|
|
1645
|
+
(0, react_2.useEffect)(function () {
|
|
1595
1646
|
var visibleProductIds = visibleProducts.map(function (p) { return p._id; });
|
|
1596
1647
|
setSelectedProducts(function (prev) { return prev.filter(function (id) { return visibleProductIds.includes(id); }); });
|
|
1597
1648
|
}, [visibleProducts]);
|
|
1598
|
-
var fetchRef = (0,
|
|
1599
|
-
(0,
|
|
1649
|
+
var fetchRef = (0, react_2.useRef)(false);
|
|
1650
|
+
(0, react_2.useEffect)(function () {
|
|
1600
1651
|
var _a, _b, _d;
|
|
1601
1652
|
if (fetchRef.current)
|
|
1602
1653
|
return;
|
|
@@ -1661,8 +1712,8 @@ var StripeInput = function (_a) {
|
|
|
1661
1712
|
: 0 // Will be calculated by existing Stripe flow when not in selection mode
|
|
1662
1713
|
);
|
|
1663
1714
|
// Emit GTM purchase event once when success screen is displayed
|
|
1664
|
-
var purchaseEmittedRef = (0,
|
|
1665
|
-
(0,
|
|
1715
|
+
var purchaseEmittedRef = (0, react_2.useRef)(false);
|
|
1716
|
+
(0, react_2.useEffect)(function () {
|
|
1666
1717
|
var _a;
|
|
1667
1718
|
// Only emit for actual purchases (chargeImmediately), not for saving card details
|
|
1668
1719
|
if (value && ((_a = field.options) === null || _a === void 0 ? void 0 : _a.chargeImmediately) && !purchaseEmittedRef.current) {
|
|
@@ -1751,8 +1802,8 @@ var StripeForm = function (_a) {
|
|
|
1751
1802
|
var businessName = _a.businessName, onSuccess = _a.onSuccess, field = _a.field, cost = _a.cost, form = _a.form;
|
|
1752
1803
|
var stripe = (0, react_stripe_js_1.useStripe)();
|
|
1753
1804
|
var elements = (0, react_stripe_js_1.useElements)();
|
|
1754
|
-
var _f = (0,
|
|
1755
|
-
var _g = (0,
|
|
1805
|
+
var _f = (0, react_2.useState)(false), ready = _f[0], setReady = _f[1];
|
|
1806
|
+
var _g = (0, react_2.useState)(''), errorMessage = _g[0], setErrorMessage = _g[1];
|
|
1756
1807
|
var handleSubmit = function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1757
1808
|
var error;
|
|
1758
1809
|
var _a, _b;
|
|
@@ -1809,10 +1860,10 @@ exports.Progress = Progress;
|
|
|
1809
1860
|
var DropdownInput = function (_a) {
|
|
1810
1861
|
var _b, _d, _e, _f, _g, _h, _j;
|
|
1811
1862
|
var field = _a.field, value = _a.value, onChange = _a.onChange;
|
|
1812
|
-
var _k = (0,
|
|
1863
|
+
var _k = (0, react_2.useState)(''), typing = _k[0], setTyping = _k[1];
|
|
1813
1864
|
// this should run only once, even if the field updates but the id is unchanged, otherwise will overwrite input
|
|
1814
|
-
var typingRef = (0,
|
|
1815
|
-
(0,
|
|
1865
|
+
var typingRef = (0, react_2.useRef)('');
|
|
1866
|
+
(0, react_2.useEffect)(function () {
|
|
1816
1867
|
if (typingRef.current === field.id)
|
|
1817
1868
|
return;
|
|
1818
1869
|
typingRef.current = field.id;
|
|
@@ -1846,13 +1897,13 @@ var useDatabaseChoices = function (_a) {
|
|
|
1846
1897
|
var _b, _d;
|
|
1847
1898
|
var _e = _a.databaseId, databaseId = _e === void 0 ? '' : _e, field = _a.field, otherAnswers = _a.otherAnswers, _f = _a.searchQuery, searchQuery = _f === void 0 ? '' : _f;
|
|
1848
1899
|
var session = (0, __1.useResolvedSession)();
|
|
1849
|
-
var _g = (0,
|
|
1850
|
-
var _h = (0,
|
|
1851
|
-
var _j = (0,
|
|
1900
|
+
var _g = (0, react_2.useState)(false), isSearching = _g[0], setIsSearching = _g[1];
|
|
1901
|
+
var _h = (0, react_2.useState)([]), searchResults = _h[0], setSearchResults = _h[1];
|
|
1902
|
+
var _j = (0, react_2.useState)(false), initialLoadComplete = _j[0], setInitialLoadComplete = _j[1];
|
|
1852
1903
|
var debouncedSearch = useDebounce(searchQuery, SEARCH_DEBOUNCE_MS);
|
|
1853
1904
|
// Load initial page on mount (only once, not recursively)
|
|
1854
|
-
var initialLoadRef = (0,
|
|
1855
|
-
(0,
|
|
1905
|
+
var initialLoadRef = (0, react_2.useRef)(false);
|
|
1906
|
+
(0, react_2.useEffect)(function () {
|
|
1856
1907
|
var _a, _b, _d;
|
|
1857
1908
|
if (initialLoadRef.current)
|
|
1858
1909
|
return;
|
|
@@ -1885,8 +1936,8 @@ var useDatabaseChoices = function (_a) {
|
|
|
1885
1936
|
});
|
|
1886
1937
|
}, [session, field, databaseId]);
|
|
1887
1938
|
// Handle debounced search
|
|
1888
|
-
var searchRef = (0,
|
|
1889
|
-
(0,
|
|
1939
|
+
var searchRef = (0, react_2.useRef)(debouncedSearch);
|
|
1940
|
+
(0, react_2.useEffect)(function () {
|
|
1890
1941
|
var trimmed = debouncedSearch.trim();
|
|
1891
1942
|
// If search is cleared, return to initial results
|
|
1892
1943
|
if (!trimmed) {
|
|
@@ -1933,7 +1984,7 @@ var useDatabaseChoices = function (_a) {
|
|
|
1933
1984
|
setIsSearching(false);
|
|
1934
1985
|
});
|
|
1935
1986
|
}, [session, field, databaseId, debouncedSearch]);
|
|
1936
|
-
var addChoice = (0,
|
|
1987
|
+
var addChoice = (0, react_2.useCallback)(function (record) {
|
|
1937
1988
|
if (!choicesForDatabase[databaseId]) {
|
|
1938
1989
|
choicesForDatabase[databaseId] = {
|
|
1939
1990
|
done: false,
|
|
@@ -1991,16 +2042,16 @@ var get_other_answers = function (_value, typing) {
|
|
|
1991
2042
|
var DatabaseSelectInput = function (_a) {
|
|
1992
2043
|
var _b, _d, _e, _f, _g, _h, _j, _k;
|
|
1993
2044
|
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;
|
|
1994
|
-
var _l = (0,
|
|
1995
|
-
var _m = (0,
|
|
1996
|
-
var selectedRecordsCache = (0,
|
|
2045
|
+
var _l = (0, react_2.useState)(''), typing = _l[0], setTyping = _l[1];
|
|
2046
|
+
var _m = (0, react_2.useState)(false), open = _m[0], setOpen = _m[1];
|
|
2047
|
+
var selectedRecordsCache = (0, react_2.useRef)(new Map());
|
|
1997
2048
|
var _o = useDatabaseChoices({
|
|
1998
2049
|
databaseId: (_b = field.options) === null || _b === void 0 ? void 0 : _b.databaseId,
|
|
1999
2050
|
field: field,
|
|
2000
2051
|
otherAnswers: get_other_answers(_value, ((_d = field === null || field === void 0 ? void 0 : field.options) === null || _d === void 0 ? void 0 : _d.other) ? typing : undefined),
|
|
2001
2052
|
searchQuery: typing,
|
|
2002
2053
|
}), addChoice = _o.addChoice, choices = _o.choices, doneLoading = _o.doneLoading, isSearching = _o.isSearching, minSearchChars = _o.minSearchChars;
|
|
2003
|
-
var value =
|
|
2054
|
+
var value = react_2.default.useMemo(function () {
|
|
2004
2055
|
try {
|
|
2005
2056
|
// if the value is a string (some single answer that was saved), make sure we coerce to array
|
|
2006
2057
|
var __value = typeof _value === 'string' ? [_value] : _value;
|
|
@@ -2032,14 +2083,14 @@ var DatabaseSelectInput = function (_a) {
|
|
|
2032
2083
|
return [];
|
|
2033
2084
|
}
|
|
2034
2085
|
}, [_value, choices, field]);
|
|
2035
|
-
var filterResponse = (0,
|
|
2086
|
+
var filterResponse = (0, react_2.useMemo)(function () {
|
|
2036
2087
|
var _a, _b, _d, _e;
|
|
2037
2088
|
return (((_b = (_a = field.options) === null || _a === void 0 ? void 0 : _a.databaseFilter) === null || _b === void 0 ? void 0 : _b.fieldId)
|
|
2038
2089
|
? (_e = (_d = responses.find(function (r) { var _a, _b; return r.fieldId === ((_b = (_a = field.options) === null || _a === void 0 ? void 0 : _a.databaseFilter) === null || _b === void 0 ? void 0 : _b.fieldId); })) === null || _d === void 0 ? void 0 : _d.answer) === null || _e === void 0 ? void 0 : _e.value
|
|
2039
2090
|
: undefined);
|
|
2040
2091
|
}, [responses, (_e = field.options) === null || _e === void 0 ? void 0 : _e.databaseFilter]);
|
|
2041
2092
|
// State filtering logic similar to Insurance component
|
|
2042
|
-
var addressQuestion = (0,
|
|
2093
|
+
var addressQuestion = (0, react_2.useMemo)(function () { return responses === null || responses === void 0 ? void 0 : responses.find(function (r) {
|
|
2043
2094
|
var _a;
|
|
2044
2095
|
if (r.answer.type !== 'Address')
|
|
2045
2096
|
return false;
|
|
@@ -2050,13 +2101,13 @@ var DatabaseSelectInput = function (_a) {
|
|
|
2050
2101
|
return false;
|
|
2051
2102
|
return true;
|
|
2052
2103
|
}); }, [responses]);
|
|
2053
|
-
var state = (0,
|
|
2104
|
+
var state = (0, react_2.useMemo)(function () {
|
|
2054
2105
|
var _a, _b, _d, _e;
|
|
2055
2106
|
return (((_a = field.options) === null || _a === void 0 ? void 0 : _a.filterByEnduserState)
|
|
2056
2107
|
? ((((_b = addressQuestion === null || addressQuestion === void 0 ? void 0 : addressQuestion.answer) === null || _b === void 0 ? void 0 : _b.type) === 'Address' ? (_e = (_d = addressQuestion === null || addressQuestion === void 0 ? void 0 : addressQuestion.answer) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.state : undefined) || (enduser === null || enduser === void 0 ? void 0 : enduser.state))
|
|
2057
2108
|
: undefined);
|
|
2058
2109
|
}, [enduser === null || enduser === void 0 ? void 0 : enduser.state, addressQuestion, (_f = field.options) === null || _f === void 0 ? void 0 : _f.filterByEnduserState]);
|
|
2059
|
-
var filteredChoicesWithPotentialDuplicates = (0,
|
|
2110
|
+
var filteredChoicesWithPotentialDuplicates = (0, react_2.useMemo)(function () {
|
|
2060
2111
|
var _a, _b;
|
|
2061
2112
|
if (!choices)
|
|
2062
2113
|
return [];
|
|
@@ -2095,7 +2146,7 @@ var DatabaseSelectInput = function (_a) {
|
|
|
2095
2146
|
}));
|
|
2096
2147
|
}, [choices, filterResponse, (_g = field.options) === null || _g === void 0 ? void 0 : _g.databaseFilter, value]);
|
|
2097
2148
|
// Apply state filtering as a secondary filter (doesn't modify existing logic)
|
|
2098
|
-
var stateFilteredChoices = (0,
|
|
2149
|
+
var stateFilteredChoices = (0, react_2.useMemo)(function () {
|
|
2099
2150
|
var _a;
|
|
2100
2151
|
if (!((_a = field.options) === null || _a === void 0 ? void 0 : _a.filterByEnduserState) || !state) {
|
|
2101
2152
|
return filteredChoicesWithPotentialDuplicates;
|
|
@@ -2106,7 +2157,7 @@ var DatabaseSelectInput = function (_a) {
|
|
|
2106
2157
|
return !recordState || recordState === state;
|
|
2107
2158
|
});
|
|
2108
2159
|
}, [filteredChoicesWithPotentialDuplicates, (_h = field.options) === null || _h === void 0 ? void 0 : _h.filterByEnduserState, state]);
|
|
2109
|
-
var filteredChoices = (0,
|
|
2160
|
+
var filteredChoices = (0, react_2.useMemo)(function () {
|
|
2110
2161
|
var filtered = [];
|
|
2111
2162
|
var uniques = new Set([]);
|
|
2112
2163
|
for (var _a = 0, stateFilteredChoices_1 = stateFilteredChoices; _a < stateFilteredChoices_1.length; _a++) {
|
|
@@ -2161,9 +2212,9 @@ var RX_NORM_CODE_FOR_DRUG = {};
|
|
|
2161
2212
|
var NDC_CODES_FOR_RX_NORM_CODE = {};
|
|
2162
2213
|
var useMedications = function (_a) {
|
|
2163
2214
|
var dontFetch = _a.dontFetch;
|
|
2164
|
-
var _b = (0,
|
|
2165
|
-
var fetchRef = (0,
|
|
2166
|
-
(0,
|
|
2215
|
+
var _b = (0, react_2.useState)(displayTermsCache), displayTerms = _b[0], setDisplayTerms = _b[1];
|
|
2216
|
+
var fetchRef = (0, react_2.useRef)(displayTerms !== undefined);
|
|
2217
|
+
(0, react_2.useEffect)(function () {
|
|
2167
2218
|
if (dontFetch)
|
|
2168
2219
|
return;
|
|
2169
2220
|
if (fetchRef.current)
|
|
@@ -2195,7 +2246,7 @@ var useMedications = function (_a) {
|
|
|
2195
2246
|
})
|
|
2196
2247
|
.catch(console.error);
|
|
2197
2248
|
}, [dontFetch]);
|
|
2198
|
-
var getDrugsForDisplayTerm = (0,
|
|
2249
|
+
var getDrugsForDisplayTerm = (0, react_2.useCallback)(function (s) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2199
2250
|
var drugs, _a;
|
|
2200
2251
|
var _b, _d, _e, _f;
|
|
2201
2252
|
return __generator(this, function (_g) {
|
|
@@ -2217,7 +2268,7 @@ var useMedications = function (_a) {
|
|
|
2217
2268
|
}
|
|
2218
2269
|
});
|
|
2219
2270
|
}); }, []);
|
|
2220
|
-
var getCodesForDrug = (0,
|
|
2271
|
+
var getCodesForDrug = (0, react_2.useCallback)(function (s) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2221
2272
|
var rxNormCode, _a, NDCs, _b;
|
|
2222
2273
|
var _d, _e, _f, _g, _h, _j, _k;
|
|
2223
2274
|
return __generator(this, function (_l) {
|
|
@@ -2282,15 +2333,15 @@ var CanvasMedicationsInput = function (_a) {
|
|
|
2282
2333
|
var _b;
|
|
2283
2334
|
var field = _a.field, _d = _a.value, value = _d === void 0 ? [] : _d, onChange = _a.onChange, form = _a.form;
|
|
2284
2335
|
var session = (0, __1.useResolvedSession)();
|
|
2285
|
-
var _e = (0,
|
|
2286
|
-
var _f = (0,
|
|
2336
|
+
var _e = (0, react_2.useState)(''), query = _e[0], setQuery = _e[1];
|
|
2337
|
+
var _f = (0, react_2.useState)([]), results = _f[0], setResults = _f[1];
|
|
2287
2338
|
// if two Medications questions shown in a row, reset state
|
|
2288
|
-
(0,
|
|
2339
|
+
(0, react_2.useEffect)(function () {
|
|
2289
2340
|
setQuery('');
|
|
2290
2341
|
setResults([]);
|
|
2291
2342
|
}, [field.id]);
|
|
2292
|
-
var fetchRef = (0,
|
|
2293
|
-
(0,
|
|
2343
|
+
var fetchRef = (0, react_2.useRef)(query);
|
|
2344
|
+
(0, react_2.useEffect)(function () {
|
|
2294
2345
|
if (fetchRef.current === query)
|
|
2295
2346
|
return;
|
|
2296
2347
|
fetchRef.current = query;
|
|
@@ -2341,7 +2392,7 @@ var MedicationsInput = function (_a) {
|
|
|
2341
2392
|
var _e = useMedications({
|
|
2342
2393
|
dontFetch: ((_b = field.options) === null || _b === void 0 ? void 0 : _b.dataSource) === constants_1.CANVAS_TITLE
|
|
2343
2394
|
}), displayTerms = _e.displayTerms, doneLoading = _e.doneLoading, getCodesForDrug = _e.getCodesForDrug, getDrugsForDisplayTerm = _e.getDrugsForDisplayTerm;
|
|
2344
|
-
var _f = (0,
|
|
2395
|
+
var _f = (0, react_2.useState)({}), drugs = _f[0], setDrugs = _f[1];
|
|
2345
2396
|
// uncomment to load data after initial typing
|
|
2346
2397
|
// const [query, setQuery] = useState('')
|
|
2347
2398
|
// useEffect(() => {
|
|
@@ -2532,8 +2583,8 @@ var RelatedContactsInput = function (_a) {
|
|
|
2532
2583
|
var field = _a.field, _value = _a.value, onChange = _a.onChange, parentError = _a.error, form = _a.form, props = __rest(_a, ["field", "value", "onChange", "error", "form"]);
|
|
2533
2584
|
// safeguard against any rogue values like empty string
|
|
2534
2585
|
var value = Array.isArray(_value) ? _value : [];
|
|
2535
|
-
var _y = (0,
|
|
2536
|
-
var handleAddContact = (0,
|
|
2586
|
+
var _y = (0, react_2.useState)(value.length === 1 ? 0 : -1), editing = _y[0], setEditing = _y[1];
|
|
2587
|
+
var handleAddContact = (0, react_2.useCallback)(function () {
|
|
2537
2588
|
var _a, _b;
|
|
2538
2589
|
onChange(__spreadArray(__spreadArray([], value, true), [
|
|
2539
2590
|
{ relationships: ((_b = (_a = field === null || field === void 0 ? void 0 : field.options) === null || _a === void 0 ? void 0 : _a.relatedContactTypes) === null || _b === void 0 ? void 0 : _b.length) === 1 ? [{ type: field.options.relatedContactTypes[0], id: '' }] : [] }
|
|
@@ -2578,13 +2629,13 @@ var AppointmentBookingInput = function (_a) {
|
|
|
2578
2629
|
var _b, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2579
2630
|
var formResponseId = _a.formResponseId, field = _a.field, value = _a.value, onChange = _a.onChange, form = _a.form, responses = _a.responses, goToPreviousField = _a.goToPreviousField, isPreviousDisabled = _a.isPreviousDisabled, enduserId = _a.enduserId, props = __rest(_a, ["formResponseId", "field", "value", "onChange", "form", "responses", "goToPreviousField", "isPreviousDisabled", "enduserId"]);
|
|
2580
2631
|
var session = (0, __1.useResolvedSession)();
|
|
2581
|
-
var _o = (0,
|
|
2582
|
-
var _p = (0,
|
|
2583
|
-
var _q = (0,
|
|
2584
|
-
var _r = (0,
|
|
2585
|
-
var _s = (0,
|
|
2632
|
+
var _o = (0, react_2.useState)(), loaded = _o[0], setLoaded = _o[1];
|
|
2633
|
+
var _p = (0, react_2.useState)(''), error = _p[0], setError = _p[1];
|
|
2634
|
+
var _q = (0, react_2.useState)(false), acknowledgedWarning = _q[0], setAcknowledgedWarning = _q[1];
|
|
2635
|
+
var _r = (0, react_2.useState)(450), height = _r[0], setHeight = _r[1];
|
|
2636
|
+
var _s = (0, react_2.useState)(false), confirming = _s[0], setConfirming = _s[1];
|
|
2586
2637
|
var bookingPageId = (_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.bookingPageId;
|
|
2587
|
-
var downloadICS = (0,
|
|
2638
|
+
var downloadICS = (0, react_2.useCallback)(function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2588
2639
|
var _a, err_9;
|
|
2589
2640
|
return __generator(this, function (_b) {
|
|
2590
2641
|
switch (_b.label) {
|
|
@@ -2604,7 +2655,7 @@ var AppointmentBookingInput = function (_a) {
|
|
|
2604
2655
|
}
|
|
2605
2656
|
});
|
|
2606
2657
|
}); }, [session]);
|
|
2607
|
-
var addressQuestion = (0,
|
|
2658
|
+
var addressQuestion = (0, react_2.useMemo)(function () { return responses === null || responses === void 0 ? void 0 : responses.find(function (r) {
|
|
2608
2659
|
var _a;
|
|
2609
2660
|
if (r.answer.type !== 'Address')
|
|
2610
2661
|
return false;
|
|
@@ -2615,11 +2666,11 @@ var AppointmentBookingInput = function (_a) {
|
|
|
2615
2666
|
return false;
|
|
2616
2667
|
return true;
|
|
2617
2668
|
}); }, [responses]);
|
|
2618
|
-
var state = (0,
|
|
2669
|
+
var state = (0, react_2.useMemo)(function () {
|
|
2619
2670
|
var _a, _b, _d;
|
|
2620
2671
|
return (((_a = addressQuestion === null || addressQuestion === void 0 ? void 0 : addressQuestion.answer) === null || _a === void 0 ? void 0 : _a.type) === 'Address' ? (_d = (_b = addressQuestion === null || addressQuestion === void 0 ? void 0 : addressQuestion.answer) === null || _b === void 0 ? void 0 : _b.value) === null || _d === void 0 ? void 0 : _d.state : undefined);
|
|
2621
2672
|
}, [addressQuestion]);
|
|
2622
|
-
var loadBookingInfo = (0,
|
|
2673
|
+
var loadBookingInfo = (0, react_2.useCallback)(function () {
|
|
2623
2674
|
if (!bookingPageId)
|
|
2624
2675
|
return;
|
|
2625
2676
|
setError('');
|
|
@@ -2631,8 +2682,8 @@ var AppointmentBookingInput = function (_a) {
|
|
|
2631
2682
|
.then(setLoaded)
|
|
2632
2683
|
.catch(function (e) { return setError((e === null || e === void 0 ? void 0 : e.message) || (e === null || e === void 0 ? void 0 : e.toString()) || 'Error loading appointment details'); });
|
|
2633
2684
|
}, [enduserId, bookingPageId, session, state]);
|
|
2634
|
-
var fetchRef = (0,
|
|
2635
|
-
(0,
|
|
2685
|
+
var fetchRef = (0, react_2.useRef)(false);
|
|
2686
|
+
(0, react_2.useEffect)(function () {
|
|
2636
2687
|
if (value)
|
|
2637
2688
|
return;
|
|
2638
2689
|
if (!bookingPageId)
|
|
@@ -2642,7 +2693,7 @@ var AppointmentBookingInput = function (_a) {
|
|
|
2642
2693
|
fetchRef.current = true;
|
|
2643
2694
|
loadBookingInfo();
|
|
2644
2695
|
}, [bookingPageId, loadBookingInfo, value]);
|
|
2645
|
-
(0,
|
|
2696
|
+
(0, react_2.useEffect)(function () {
|
|
2646
2697
|
var handleMessage = function (m) {
|
|
2647
2698
|
var _a, _b, _d, _e, _f, _g, _h, _j, _k;
|
|
2648
2699
|
// entropy to separate from other booking pages rendered on the same screen
|
|
@@ -2811,7 +2862,7 @@ var RedirectInput = function (_a) {
|
|
|
2811
2862
|
|| ((_g = (_f = (_e = responses === null || responses === void 0 ? void 0 : responses.find(function (r) { var _a, _b, _d; return r.intakeField === 'Address' && ((_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.state); })) === null || _e === void 0 ? void 0 : _e.answer) === null || _f === void 0 ? void 0 : _f.value) === null || _g === void 0 ? void 0 : _g.state)
|
|
2812
2863
|
|| (enduser === null || enduser === void 0 ? void 0 : enduser.state)
|
|
2813
2864
|
|| ((_h = session.userInfo) === null || _h === void 0 ? void 0 : _h.state));
|
|
2814
|
-
(0,
|
|
2865
|
+
(0, react_2.useEffect)(function () {
|
|
2815
2866
|
var _a, _b;
|
|
2816
2867
|
if (session.type === 'user') {
|
|
2817
2868
|
return;
|
|
@@ -2865,15 +2916,15 @@ var RedirectInput = function (_a) {
|
|
|
2865
2916
|
exports.RedirectInput = RedirectInput;
|
|
2866
2917
|
var HiddenValueInput = function (_a) {
|
|
2867
2918
|
var goToNextField = _a.goToNextField, goToPreviousField = _a.goToPreviousField, field = _a.field, value = _a.value, onChange = _a.onChange, isSinglePage = _a.isSinglePage, groupFields = _a.groupFields, lastNavigationDirectionRef = _a.lastNavigationDirectionRef;
|
|
2868
|
-
var lastRef = (0,
|
|
2869
|
-
var lastIdRef = (0,
|
|
2919
|
+
var lastRef = (0, react_2.useRef)(0);
|
|
2920
|
+
var lastIdRef = (0, react_2.useRef)('');
|
|
2870
2921
|
// in a Question Group, only the first Hidden Value should navigate
|
|
2871
2922
|
// AND, it should only navigate if the group only contains hidden values
|
|
2872
2923
|
var firstHiddenValue = groupFields === null || groupFields === void 0 ? void 0 : groupFields.find(function (v) { return v.type === 'Hidden Value'; });
|
|
2873
2924
|
var dontNavigate = ((firstHiddenValue && (firstHiddenValue === null || firstHiddenValue === void 0 ? void 0 : firstHiddenValue.id) !== field.id) // is in a group, but not the first hidden value
|
|
2874
2925
|
|| !!(groupFields === null || groupFields === void 0 ? void 0 : groupFields.find(function (v) { return v.type !== 'Hidden Value'; })) // group contains at least 1 non-hidden value
|
|
2875
2926
|
);
|
|
2876
|
-
var publicIdentifier = (0,
|
|
2927
|
+
var publicIdentifier = (0, react_2.useMemo)(function () {
|
|
2877
2928
|
try {
|
|
2878
2929
|
return new URL(window.location.href).searchParams.get('publicIdentifier') || '';
|
|
2879
2930
|
}
|
|
@@ -2881,9 +2932,9 @@ var HiddenValueInput = function (_a) {
|
|
|
2881
2932
|
return '';
|
|
2882
2933
|
}
|
|
2883
2934
|
}, []);
|
|
2884
|
-
var valueToSet = (0,
|
|
2935
|
+
var valueToSet = (0, react_2.useMemo)(function () { return ((field.title === "{{PUBLIC_IDENTIFIER}}" && publicIdentifier) ? publicIdentifier
|
|
2885
2936
|
: field.title); }, [field.title, publicIdentifier]);
|
|
2886
|
-
(0,
|
|
2937
|
+
(0, react_2.useEffect)(function () {
|
|
2887
2938
|
if (lastRef.current > Date.now() - 1000 && lastIdRef.current === field.id)
|
|
2888
2939
|
return;
|
|
2889
2940
|
lastRef.current = Date.now();
|
|
@@ -2913,11 +2964,11 @@ exports.HiddenValueInput = HiddenValueInput;
|
|
|
2913
2964
|
var EmotiiInput = function (_a) {
|
|
2914
2965
|
var goToNextField = _a.goToNextField, goToPreviousField = _a.goToPreviousField, field = _a.field, value = _a.value, onChange = _a.onChange, form = _a.form, formResponseId = _a.formResponseId, props = __rest(_a, ["goToNextField", "goToPreviousField", "field", "value", "onChange", "form", "formResponseId"]);
|
|
2915
2966
|
var session = (0, __1.useResolvedSession)();
|
|
2916
|
-
var requestIdRef = (0,
|
|
2917
|
-
var _b = (0,
|
|
2918
|
-
var _d = (0,
|
|
2919
|
-
var fetchRef = (0,
|
|
2920
|
-
(0,
|
|
2967
|
+
var requestIdRef = (0, react_2.useRef)(value || "".concat(field.id).concat(formResponseId || Date.now()));
|
|
2968
|
+
var _b = (0, react_2.useState)(), data = _b[0], setData = _b[1];
|
|
2969
|
+
var _d = (0, react_2.useState)(0), loadCount = _d[0], setLoadCount = _d[1];
|
|
2970
|
+
var fetchRef = (0, react_2.useRef)(false);
|
|
2971
|
+
(0, react_2.useEffect)(function () {
|
|
2921
2972
|
if (value)
|
|
2922
2973
|
return;
|
|
2923
2974
|
if (fetchRef.current)
|
|
@@ -2932,8 +2983,8 @@ var EmotiiInput = function (_a) {
|
|
|
2932
2983
|
})
|
|
2933
2984
|
.then(function (r) { return setData(r.data); });
|
|
2934
2985
|
}, [session, value, props === null || props === void 0 ? void 0 : props.enduserId]);
|
|
2935
|
-
var loadAnswerRef = (0,
|
|
2936
|
-
(0,
|
|
2986
|
+
var loadAnswerRef = (0, react_2.useRef)(false);
|
|
2987
|
+
(0, react_2.useEffect)(function () {
|
|
2937
2988
|
if (loadCount !== 2)
|
|
2938
2989
|
return;
|
|
2939
2990
|
if (loadAnswerRef.current)
|
|
@@ -2953,15 +3004,15 @@ var AllergiesInput = function (_a) {
|
|
|
2953
3004
|
var _b;
|
|
2954
3005
|
var goToNextField = _a.goToNextField, goToPreviousField = _a.goToPreviousField, field = _a.field, value = _a.value, onChange = _a.onChange, form = _a.form, formResponseId = _a.formResponseId, props = __rest(_a, ["goToNextField", "goToPreviousField", "field", "value", "onChange", "form", "formResponseId"]);
|
|
2955
3006
|
var session = (0, __1.useResolvedSession)();
|
|
2956
|
-
var _d = (0,
|
|
2957
|
-
var _e = (0,
|
|
3007
|
+
var _d = (0, react_2.useState)(''), query = _d[0], setQuery = _d[1];
|
|
3008
|
+
var _e = (0, react_2.useState)([]), results = _e[0], setResults = _e[1];
|
|
2958
3009
|
// if two allergy questions shown in a row, reset state
|
|
2959
|
-
(0,
|
|
3010
|
+
(0, react_2.useEffect)(function () {
|
|
2960
3011
|
setQuery('');
|
|
2961
3012
|
setResults([]);
|
|
2962
3013
|
}, [field.id]);
|
|
2963
|
-
var fetchRef = (0,
|
|
2964
|
-
(0,
|
|
3014
|
+
var fetchRef = (0, react_2.useRef)(query);
|
|
3015
|
+
(0, react_2.useEffect)(function () {
|
|
2965
3016
|
if (fetchRef.current === query)
|
|
2966
3017
|
return;
|
|
2967
3018
|
fetchRef.current = query;
|
|
@@ -3030,10 +3081,10 @@ var display_with_code = function (v) { return "".concat(v.code, ": ").concat((0,
|
|
|
3030
3081
|
var ConditionsInput = function (_a) {
|
|
3031
3082
|
var goToNextField = _a.goToNextField, goToPreviousField = _a.goToPreviousField, field = _a.field, value = _a.value, onChange = _a.onChange, form = _a.form, formResponseId = _a.formResponseId, props = __rest(_a, ["goToNextField", "goToPreviousField", "field", "value", "onChange", "form", "formResponseId"]);
|
|
3032
3083
|
var session = (0, __1.useResolvedSession)();
|
|
3033
|
-
var _b = (0,
|
|
3034
|
-
var _d = (0,
|
|
3035
|
-
var fetchRef = (0,
|
|
3036
|
-
(0,
|
|
3084
|
+
var _b = (0, react_2.useState)(''), query = _b[0], setQuery = _b[1];
|
|
3085
|
+
var _d = (0, react_2.useState)([]), results = _d[0], setResults = _d[1];
|
|
3086
|
+
var fetchRef = (0, react_2.useRef)(query);
|
|
3087
|
+
(0, react_2.useEffect)(function () {
|
|
3037
3088
|
if (fetchRef.current === query)
|
|
3038
3089
|
return;
|
|
3039
3090
|
fetchRef.current = query;
|
|
@@ -3078,13 +3129,13 @@ var ChargeebeeInput = function (_a) {
|
|
|
3078
3129
|
var _b;
|
|
3079
3130
|
var field = _a.field, value = _a.value, onChange = _a.onChange, setCustomerId = _a.setCustomerId, responses = _a.responses;
|
|
3080
3131
|
var session = (0, __1.useResolvedSession)();
|
|
3081
|
-
var _d = (0,
|
|
3082
|
-
var _e = (0,
|
|
3083
|
-
var _f = (0,
|
|
3084
|
-
var _g = (0,
|
|
3132
|
+
var _d = (0, react_2.useState)(''), url = _d[0], setUrl = _d[1];
|
|
3133
|
+
var _e = (0, react_2.useState)(''), error = _e[0], setError = _e[1];
|
|
3134
|
+
var _f = (0, react_2.useState)(false), verifying = _f[0], setVerifying = _f[1];
|
|
3135
|
+
var _g = (0, react_2.useState)(0), loadCount = _g[0], setLoadCount = _g[1];
|
|
3085
3136
|
var collectOnly = !!((_b = field.options) === null || _b === void 0 ? void 0 : _b.chargebeeCollectPaymentMethodOnly);
|
|
3086
|
-
var fetchRef = (0,
|
|
3087
|
-
(0,
|
|
3137
|
+
var fetchRef = (0, react_2.useRef)(false);
|
|
3138
|
+
(0, react_2.useEffect)(function () {
|
|
3088
3139
|
var _a, _b;
|
|
3089
3140
|
if (fetchRef.current)
|
|
3090
3141
|
return;
|
|
@@ -3111,8 +3162,8 @@ var ChargeebeeInput = function (_a) {
|
|
|
3111
3162
|
}
|
|
3112
3163
|
});
|
|
3113
3164
|
}, [session]);
|
|
3114
|
-
var loadAnswerRef = (0,
|
|
3115
|
-
(0,
|
|
3165
|
+
var loadAnswerRef = (0, react_2.useRef)(false);
|
|
3166
|
+
(0, react_2.useEffect)(function () {
|
|
3116
3167
|
if (loadCount !== 2)
|
|
3117
3168
|
return;
|
|
3118
3169
|
if (loadAnswerRef.current)
|