@tellescope/react-components 1.234.1 → 1.235.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 +37 -35
- 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 +37 -35
- package/lib/cjs/Forms/forms.v2.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts +17 -2
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +308 -36
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/Forms/inputs.v2.d.ts +3 -2
- package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.v2.js +20 -293
- package/lib/cjs/Forms/inputs.v2.js.map +1 -1
- package/lib/cjs/Forms/types.d.ts +4 -0
- package/lib/cjs/Forms/types.d.ts.map +1 -1
- package/lib/esm/Forms/forms.d.ts.map +1 -1
- package/lib/esm/Forms/forms.js +38 -36
- 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 +38 -36
- package/lib/esm/Forms/forms.v2.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +17 -2
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +306 -37
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/Forms/inputs.v2.d.ts +3 -2
- package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.v2.js +15 -289
- package/lib/esm/Forms/inputs.v2.js.map +1 -1
- package/lib/esm/Forms/types.d.ts +4 -0
- package/lib/esm/Forms/types.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/forms.tsx +13 -6
- package/src/Forms/forms.v2.tsx +9 -2
- package/src/Forms/inputs.tsx +449 -65
- package/src/Forms/inputs.v2.tsx +12 -593
- package/src/Forms/types.ts +4 -2
package/lib/esm/Forms/inputs.js
CHANGED
|
@@ -72,9 +72,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
72
72
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
73
73
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
74
74
|
import axios from "axios";
|
|
75
|
-
import { Autocomplete, Box, Button, Checkbox, Chip, CircularProgress, Collapse, Divider, FormControl, FormControlLabel, FormLabel, Grid, IconButton as MuiIconButton, InputLabel, MenuItem, Radio, RadioGroup, Select, TextField, Typography } from "@mui/material";
|
|
75
|
+
import { Autocomplete, Box, Button, Checkbox, Chip, CircularProgress, Collapse, Divider, FormControl, FormControlLabel, FormLabel, Grid, IconButton as MuiIconButton, InputLabel, MenuItem, Paper, Radio, RadioGroup, Select, TextField, Typography } from "@mui/material";
|
|
76
76
|
import { useDropzone } from "react-dropzone";
|
|
77
|
-
import { CANVAS_TITLE, EMOTII_TITLE, INSURANCE_RELATIONSHIPS, INSURANCE_RELATIONSHIPS_CANVAS, PRIMARY_HEX, RELATIONSHIP_TYPES, TELLESCOPE_GENDERS } from "@tellescope/constants";
|
|
77
|
+
import { CANVAS_TITLE, BRIDGE_TITLE, EMOTII_TITLE, INSURANCE_RELATIONSHIPS, INSURANCE_RELATIONSHIPS_CANVAS, PRIMARY_HEX, RELATIONSHIP_TYPES, TELLESCOPE_GENDERS } from "@tellescope/constants";
|
|
78
78
|
import { MM_DD_YYYY_to_YYYY_MM_DD, capture_is_supported, downloadFile, emit_gtm_event, first_letter_capitalized, form_response_value_to_string, format_stripe_subscription_interval, getLocalTimezone, getPublicFileURL, mm_dd_yyyy, object_is_empty, replace_enduser_template_values, responses_satisfy_conditions, truncate_string, update_local_storage, user_display_name } from "@tellescope/utilities";
|
|
79
79
|
import { TIMEZONES_USA } from "@tellescope/types-models";
|
|
80
80
|
import { VALID_STATES, emailValidator, phoneValidator } from "@tellescope/validation";
|
|
@@ -93,6 +93,14 @@ 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
|
+
// Bridge Eligibility - shared variable for storing most recent eligibility userIds
|
|
97
|
+
var bridgeEligibilityResult = {
|
|
98
|
+
userIds: [],
|
|
99
|
+
};
|
|
100
|
+
export var getBridgeEligibilityUserIds = function () { return bridgeEligibilityResult.userIds; };
|
|
101
|
+
export var setBridgeEligibilityUserIds = function (userIds) {
|
|
102
|
+
bridgeEligibilityResult.userIds = userIds;
|
|
103
|
+
};
|
|
96
104
|
// Debounce hook for search functionality
|
|
97
105
|
var useDebounce = function (value, delay) {
|
|
98
106
|
var _a = useState(value), debouncedValue = _a[0], setDebouncedValue = _a[1];
|
|
@@ -245,8 +253,14 @@ export var TableInput = function (_a) {
|
|
|
245
253
|
: null }), v.label));
|
|
246
254
|
}), _jsx(Grid, __assign({ item: true, sx: { ml: 'auto', width: iconWidth } }, { children: _jsx(LabeledIconButton, { Icon: CancelIcon, label: "Remove", onClick: function () { return handleRemove(i); }, disabled: !field.isOptional && value.length === 1 }) }))] }), i), _jsx(Divider, { flexItem: true, sx: { my: 1 } })] })); }), _jsx(Button, __assign({ variant: "outlined", size: "small", onClick: handleNewRow, sx: { width: 200 } }, { children: "Add new entry" }))] })));
|
|
247
255
|
};
|
|
248
|
-
export var AutoFocusTextField = function (props) {
|
|
249
|
-
var
|
|
256
|
+
export var AutoFocusTextField = function (props) {
|
|
257
|
+
var inputProps = props.inputProps, textFieldProps = __rest(props, ["inputProps"]);
|
|
258
|
+
return _jsx(TextField, __assign({ InputProps: inputProps || defaultInputProps }, textFieldProps));
|
|
259
|
+
};
|
|
260
|
+
var CustomDateStringInput = forwardRef(function (props, ref) {
|
|
261
|
+
var inputProps = props.inputProps, textFieldProps = __rest(props, ["inputProps"]);
|
|
262
|
+
return (_jsx(TextField, __assign({ InputProps: inputProps || defaultInputProps, fullWidth: true, inputRef: ref }, textFieldProps)));
|
|
263
|
+
});
|
|
250
264
|
export var DateStringInput = function (_a) {
|
|
251
265
|
var _b;
|
|
252
266
|
var field = _a.field, value = _a.value, onChange = _a.onChange, props = __rest(_a, ["field", "value", "onChange"]);
|
|
@@ -328,7 +342,7 @@ export var NumberInput = function (_a) {
|
|
|
328
342
|
};
|
|
329
343
|
export var InsuranceInput = function (_a) {
|
|
330
344
|
var _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
331
|
-
var field = _a.field, onDatabaseSelect = _a.onDatabaseSelect, value = _a.value, onChange = _a.onChange, form = _a.form, responses = _a.responses, enduser = _a.enduser, props = __rest(_a, ["field", "onDatabaseSelect", "value", "onChange", "form", "responses", "enduser"]);
|
|
345
|
+
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"]);
|
|
332
346
|
var session = useResolvedSession();
|
|
333
347
|
var _t = useState([]), payers = _t[0], setPayers = _t[1];
|
|
334
348
|
var _u = useState(''), query = _u[0], setQuery = _u[1];
|
|
@@ -349,9 +363,11 @@ export var InsuranceInput = function (_a) {
|
|
|
349
363
|
}, [enduser === null || enduser === void 0 ? void 0 : enduser.state, addressQuestion]);
|
|
350
364
|
var loadRef = useRef(false); // so session changes don't cause
|
|
351
365
|
useEffect(function () {
|
|
352
|
-
var _a;
|
|
366
|
+
var _a, _b;
|
|
353
367
|
if (((_a = field === null || field === void 0 ? void 0 : field.options) === null || _a === void 0 ? void 0 : _a.dataSource) === CANVAS_TITLE)
|
|
354
368
|
return; // instead, look-up while typing against Canvas Search API
|
|
369
|
+
if (((_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.dataSource) === BRIDGE_TITLE)
|
|
370
|
+
return; // instead, look-up while typing against Bridge Search API
|
|
355
371
|
if (loadRef.current)
|
|
356
372
|
return;
|
|
357
373
|
loadRef.current = true;
|
|
@@ -376,8 +392,8 @@ export var InsuranceInput = function (_a) {
|
|
|
376
392
|
}, [session, state, (_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.dataSource]);
|
|
377
393
|
var searchRef = useRef(query);
|
|
378
394
|
useEffect(function () {
|
|
379
|
-
var _a;
|
|
380
|
-
if (((_a = field === null || field === void 0 ? void 0 : field.options) === null || _a === void 0 ? void 0 : _a.dataSource) !== CANVAS_TITLE) {
|
|
395
|
+
var _a, _b, _d, _e;
|
|
396
|
+
if (((_a = field === null || field === void 0 ? void 0 : field.options) === null || _a === void 0 ? void 0 : _a.dataSource) !== CANVAS_TITLE && ((_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.dataSource) !== BRIDGE_TITLE) {
|
|
381
397
|
return;
|
|
382
398
|
}
|
|
383
399
|
if (!query)
|
|
@@ -385,24 +401,30 @@ export var InsuranceInput = function (_a) {
|
|
|
385
401
|
if (searchRef.current === query)
|
|
386
402
|
return;
|
|
387
403
|
searchRef.current = query;
|
|
388
|
-
|
|
389
|
-
|
|
404
|
+
var integration = ((_d = field === null || field === void 0 ? void 0 : field.options) === null || _d === void 0 ? void 0 : _d.dataSource) === CANVAS_TITLE ? CANVAS_TITLE : BRIDGE_TITLE;
|
|
405
|
+
var type = ((_e = field === null || field === void 0 ? void 0 : field.options) === null || _e === void 0 ? void 0 : _e.dataSource) === CANVAS_TITLE ? 'organizations' : 'payers';
|
|
406
|
+
var t = setTimeout(function () { return (session.api.integrations.proxy_read({
|
|
407
|
+
integration: integration,
|
|
390
408
|
query: query,
|
|
391
|
-
type:
|
|
409
|
+
type: type,
|
|
392
410
|
})
|
|
393
411
|
.then(function (_a) {
|
|
394
412
|
var data = _a.data;
|
|
395
413
|
try {
|
|
396
|
-
setPayers(data.map(function (d) {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
414
|
+
setPayers(data.map(function (d) {
|
|
415
|
+
var _a, _b;
|
|
416
|
+
return ({
|
|
417
|
+
id: ((_a = field === null || field === void 0 ? void 0 : field.options) === null || _a === void 0 ? void 0 : _a.dataSource) === CANVAS_TITLE ? d.resource.id : d.id,
|
|
418
|
+
name: ((_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.dataSource) === CANVAS_TITLE ? d.resource.name : d.name,
|
|
419
|
+
});
|
|
420
|
+
}));
|
|
400
421
|
}
|
|
401
422
|
catch (err) {
|
|
402
423
|
console.error;
|
|
403
424
|
}
|
|
404
425
|
})
|
|
405
|
-
.catch(console.error);
|
|
426
|
+
.catch(console.error)); }, 300);
|
|
427
|
+
return function () { clearTimeout(t); };
|
|
406
428
|
}, [session, (_d = field === null || field === void 0 ? void 0 : field.options) === null || _d === void 0 ? void 0 : _d.dataSource, query]);
|
|
407
429
|
return (_jsxs(Grid, __assign({ container: true, spacing: 2, sx: { mt: '0' } }, { children: [_jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(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) {
|
|
408
430
|
var _a, _b;
|
|
@@ -422,34 +444,273 @@ export var InsuranceInput = function (_a) {
|
|
|
422
444
|
}
|
|
423
445
|
onChange(__assign(__assign({}, value), { payerName: v || '', payerId: ((_b = payers.find(function (p) { return p.name === v; })) === null || _b === void 0 ? void 0 : _b.id) || '', payerType: ((_d = payers.find(function (p) { return p.name === v; })) === null || _d === void 0 ? void 0 : _d.type) || '' }), field.id);
|
|
424
446
|
}, renderInput: function (params) {
|
|
425
|
-
var _a;
|
|
426
|
-
return (_jsx(TextField, __assign({}, params, { InputProps: __assign(__assign({}, params.InputProps), { sx: defaultInputProps.sx }), required: !field.isOptional, size: "small", label: "Insurer", placeholder: ((_a = field.options) === null || _a === void 0 ? void 0 : _a.dataSource) === CANVAS_TITLE ? "Search insurer..." : "Insurer" })));
|
|
427
|
-
} }) })), _jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(TextField, { InputProps: defaultInputProps, required: !field.isOptional, fullWidth: true, value: (_g = value === null || value === void 0 ? void 0 : value.memberId) !== null && _g !== void 0 ? _g : '', onChange: function (e) { return onChange(__assign(__assign({}, value), { memberId: e.target.value }), field.id); }, label: form_display_text_for_language(form, "Member ID", ''), size: "small" }) })), _jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(TextField, { InputProps: defaultInputProps, required: false, fullWidth: true, value: (_h = value === null || value === void 0 ? void 0 : value.planName) !== null && _h !== void 0 ? _h : '', onChange: function (e) { return onChange(__assign(__assign({}, value), { planName: e.target.value }), field.id); }, label: form_display_text_for_language(form, "Plan Name", ''), size: "small" }) })), _jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(DateStringInput, { size: "small", label: "Plan Start Date", field: __assign(__assign({}, field), { isOptional: true }), value: (value === null || value === void 0 ? void 0 : value.startDate) || '', onChange: function (startDate) {
|
|
447
|
+
var _a, _b;
|
|
448
|
+
return (_jsx(TextField, __assign({}, params, { InputProps: __assign(__assign({}, params.InputProps), { sx: (inputProps || defaultInputProps).sx }), required: !field.isOptional, size: "small", label: "Insurer", placeholder: (((_a = field.options) === null || _a === void 0 ? void 0 : _a.dataSource) === CANVAS_TITLE || ((_b = field.options) === null || _b === void 0 ? void 0 : _b.dataSource) === BRIDGE_TITLE) ? "Search insurer..." : "Insurer" })));
|
|
449
|
+
} }) })), _jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(TextField, { InputProps: inputProps || defaultInputProps, required: !field.isOptional, fullWidth: true, value: (_g = value === null || value === void 0 ? void 0 : value.memberId) !== null && _g !== void 0 ? _g : '', onChange: function (e) { return onChange(__assign(__assign({}, value), { memberId: e.target.value }), field.id); }, label: form_display_text_for_language(form, "Member ID", ''), size: "small" }) })), _jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(TextField, { InputProps: inputProps || defaultInputProps, required: false, fullWidth: true, value: (_h = value === null || value === void 0 ? void 0 : value.planName) !== null && _h !== void 0 ? _h : '', onChange: function (e) { return onChange(__assign(__assign({}, value), { planName: e.target.value }), field.id); }, label: form_display_text_for_language(form, "Plan Name", ''), size: "small" }) })), _jsx(Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: _jsx(DateStringInput, { size: "small", label: "Plan Start Date", inputProps: inputProps, field: __assign(__assign({}, field), { isOptional: true }), value: (value === null || value === void 0 ? void 0 : value.startDate) || '', onChange: function (startDate) {
|
|
428
450
|
return onChange(__assign(__assign({}, value), { startDate: startDate }), field.id);
|
|
429
451
|
} }) })), ((_j = field.options) === null || _j === void 0 ? void 0 : _j.includeGroupNumber) &&
|
|
430
|
-
_jsx(Grid, __assign({ item: true, xs: 12 }, { children: _jsx(TextField, { InputProps: defaultInputProps, fullWidth: true, value: (_k = value === null || value === void 0 ? void 0 : value.groupNumber) !== null && _k !== void 0 ? _k : '', onChange: function (e) { return onChange(__assign(__assign({}, value), { groupNumber: e.target.value }), field.id); }, label: form_display_text_for_language(form, "Group Number", ''), size: "small" }) })), _jsx(Grid, __assign({ item: true, xs: 12 }, { children: _jsx(StringSelector, { size: "small", label: "Relationship to Policy Owner", options: ((((_l = field.options) === null || _l === void 0 ? void 0 : _l.billingProvider) === CANVAS_TITLE || ((_m = field.options) === null || _m === void 0 ? void 0 : _m.dataSource) === CANVAS_TITLE)
|
|
452
|
+
_jsx(Grid, __assign({ item: true, xs: 12 }, { children: _jsx(TextField, { InputProps: inputProps || defaultInputProps, fullWidth: true, value: (_k = value === null || value === void 0 ? void 0 : value.groupNumber) !== null && _k !== void 0 ? _k : '', onChange: function (e) { return onChange(__assign(__assign({}, value), { groupNumber: e.target.value }), field.id); }, label: form_display_text_for_language(form, "Group Number", ''), size: "small" }) })), _jsx(Grid, __assign({ item: true, xs: 12 }, { children: _jsx(StringSelector, { size: "small", label: "Relationship to Policy Owner", inputProps: inputProps, options: ((((_l = field.options) === null || _l === void 0 ? void 0 : _l.billingProvider) === CANVAS_TITLE || ((_m = field.options) === null || _m === void 0 ? void 0 : _m.dataSource) === CANVAS_TITLE)
|
|
431
453
|
? INSURANCE_RELATIONSHIPS_CANVAS
|
|
432
454
|
: INSURANCE_RELATIONSHIPS)
|
|
433
455
|
.sort(function (x, y) { return x.localeCompare(y); }), value: (value === null || value === void 0 ? void 0 : value.relationship) || 'Self', onChange: function (relationship) {
|
|
434
456
|
return onChange(__assign(__assign({}, value), { relationship: relationship || 'Self' }), field.id);
|
|
435
457
|
} }) })), ((value === null || value === void 0 ? void 0 : value.relationship) || 'Self') !== 'Self' &&
|
|
436
|
-
_jsxs(_Fragment, { children: [_jsx(Grid, __assign({ item: true, xs: 12 }, { children: _jsx(Typography, __assign({ sx: { fontWeight: 'bold' } }, { children: "Policy Owner Details" })) })), _jsx(Grid, __assign({ item: true, xs: 6 }, { children: _jsx(TextField, { label: "First Name", size: "small", InputProps: defaultInputProps, fullWidth: true, value: ((_o = value === null || value === void 0 ? void 0 : value.relationshipDetails) === null || _o === void 0 ? void 0 : _o.fname) || '', required: !field.isOptional, onChange: function (e) {
|
|
458
|
+
_jsxs(_Fragment, { children: [_jsx(Grid, __assign({ item: true, xs: 12 }, { children: _jsx(Typography, __assign({ sx: { fontWeight: 'bold' } }, { children: "Policy Owner Details" })) })), _jsx(Grid, __assign({ item: true, xs: 6 }, { children: _jsx(TextField, { label: "First Name", size: "small", InputProps: inputProps || defaultInputProps, fullWidth: true, value: ((_o = value === null || value === void 0 ? void 0 : value.relationshipDetails) === null || _o === void 0 ? void 0 : _o.fname) || '', required: !field.isOptional, onChange: function (e) {
|
|
437
459
|
return onChange(__assign(__assign({}, value), { relationshipDetails: __assign(__assign({}, value === null || value === void 0 ? void 0 : value.relationshipDetails), { fname: e.target.value }) }), field.id);
|
|
438
|
-
} }) })), _jsx(Grid, __assign({ item: true, xs: 6 }, { children: _jsx(TextField, { label: "Last Name", size: "small", InputProps: defaultInputProps, fullWidth: true, value: ((_p = value === null || value === void 0 ? void 0 : value.relationshipDetails) === null || _p === void 0 ? void 0 : _p.lname) || '', required: !field.isOptional, onChange: function (e) {
|
|
460
|
+
} }) })), _jsx(Grid, __assign({ item: true, xs: 6 }, { children: _jsx(TextField, { label: "Last Name", size: "small", InputProps: inputProps || defaultInputProps, fullWidth: true, value: ((_p = value === null || value === void 0 ? void 0 : value.relationshipDetails) === null || _p === void 0 ? void 0 : _p.lname) || '', required: !field.isOptional, onChange: function (e) {
|
|
439
461
|
return onChange(__assign(__assign({}, value), { relationshipDetails: __assign(__assign({}, value === null || value === void 0 ? void 0 : value.relationshipDetails), { lname: e.target.value }) }), field.id);
|
|
440
|
-
} }) })), _jsx(Grid, __assign({ item: true, xs: 6 }, { children: _jsx(StringSelector, { options: TELLESCOPE_GENDERS, size: "small", label: "Gender", value: ((_q = value === null || value === void 0 ? void 0 : value.relationshipDetails) === null || _q === void 0 ? void 0 : _q.gender) || '', required: !field.isOptional, onChange: function (v) {
|
|
462
|
+
} }) })), _jsx(Grid, __assign({ item: true, xs: 6 }, { children: _jsx(StringSelector, { options: TELLESCOPE_GENDERS, size: "small", label: "Gender", inputProps: inputProps, value: ((_q = value === null || value === void 0 ? void 0 : value.relationshipDetails) === null || _q === void 0 ? void 0 : _q.gender) || '', required: !field.isOptional, onChange: function (v) {
|
|
441
463
|
return onChange(__assign(__assign({}, value), { relationshipDetails: __assign(__assign({}, value === null || value === void 0 ? void 0 : value.relationshipDetails), { gender: v }) }), field.id);
|
|
442
|
-
} }) })), _jsx(Grid, __assign({ item: true, xs: 6 }, { children: _jsx(DateStringInput, { size: "small", label: "Date of Birth", field: __assign(__assign({}, field), { isOptional: field.isOptional || ((_r = field.options) === null || _r === void 0 ? void 0 : _r.billingProvider) === 'Candid' }), value: ((_s = value === null || value === void 0 ? void 0 : value.relationshipDetails) === null || _s === void 0 ? void 0 : _s.dateOfBirth) || '', onChange: function (dateOfBirth) {
|
|
464
|
+
} }) })), _jsx(Grid, __assign({ item: true, xs: 6 }, { children: _jsx(DateStringInput, { size: "small", label: "Date of Birth", inputProps: inputProps, field: __assign(__assign({}, field), { isOptional: field.isOptional || ((_r = field.options) === null || _r === void 0 ? void 0 : _r.billingProvider) === 'Candid' }), value: ((_s = value === null || value === void 0 ? void 0 : value.relationshipDetails) === null || _s === void 0 ? void 0 : _s.dateOfBirth) || '', onChange: function (dateOfBirth) {
|
|
443
465
|
return onChange(__assign(__assign({}, value), { relationshipDetails: __assign(__assign({}, value === null || value === void 0 ? void 0 : value.relationshipDetails), { dateOfBirth: dateOfBirth }) }), field.id);
|
|
444
466
|
} }) }))] })] })));
|
|
445
467
|
};
|
|
446
468
|
var StringSelector = function (_a) {
|
|
447
|
-
var options = _a.options, value = _a.value, onChange = _a.onChange, required = _a.required, getDisplayValue = _a.getDisplayValue, props = __rest(_a, ["options", "value", "onChange", "required", "getDisplayValue"]);
|
|
448
|
-
return (_jsxs(FormControl, __assign({ fullWidth: true, size: props.size, required: required }, { children: [_jsx(InputLabel, { children: props.label }), _jsx(Select, __assign({}, props, { value: value, onChange: function (e) { return onChange(e.target.value); }, fullWidth: true, sx: defaultInputProps.sx }, { children: options.map(function (o, i) {
|
|
469
|
+
var options = _a.options, value = _a.value, onChange = _a.onChange, required = _a.required, getDisplayValue = _a.getDisplayValue, inputProps = _a.inputProps, props = __rest(_a, ["options", "value", "onChange", "required", "getDisplayValue", "inputProps"]);
|
|
470
|
+
return (_jsxs(FormControl, __assign({ fullWidth: true, size: props.size, required: required }, { children: [_jsx(InputLabel, { children: props.label }), _jsx(Select, __assign({}, props, { value: value, onChange: function (e) { return onChange(e.target.value); }, fullWidth: true, sx: (inputProps || defaultInputProps).sx }, { children: options.map(function (o, i) {
|
|
449
471
|
var _a;
|
|
450
472
|
return (_jsx(MenuItem, __assign({ value: o }, { children: (_a = getDisplayValue === null || getDisplayValue === void 0 ? void 0 : getDisplayValue(o)) !== null && _a !== void 0 ? _a : o }), o || i));
|
|
451
473
|
}) }))] })));
|
|
452
474
|
};
|
|
475
|
+
export var BridgeEligibilityInput = function (_a) {
|
|
476
|
+
var _b, _d, _e, _f;
|
|
477
|
+
var field = _a.field, value = _a.value, onChange = _a.onChange, responses = _a.responses, enduser = _a.enduser, inputProps = _a.inputProps, enduserId = _a.enduserId, props = __rest(_a, ["field", "value", "onChange", "responses", "enduser", "inputProps", "enduserId"]);
|
|
478
|
+
var session = useResolvedSession();
|
|
479
|
+
var _g = useState(false), loading = _g[0], setLoading = _g[1];
|
|
480
|
+
var _h = useState(false), polling = _h[0], setPolling = _h[1];
|
|
481
|
+
var _j = useState(), error = _j[0], setError = _j[1];
|
|
482
|
+
// single-page form must require button-click to check, but 1-page-at-a-time enduser sessions should auto-check
|
|
483
|
+
var isEnduserSession = session.type === 'enduser';
|
|
484
|
+
var eligibilityType = ((_b = field.options) === null || _b === void 0 ? void 0 : _b.bridgeEligibilityType) || 'Soft';
|
|
485
|
+
// Extract payerId from Insurance question response
|
|
486
|
+
var _k = useMemo(function () {
|
|
487
|
+
var _a, _b, _d, _e;
|
|
488
|
+
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); });
|
|
489
|
+
if (((_a = insuranceResponse === null || insuranceResponse === void 0 ? void 0 : insuranceResponse.answer) === null || _a === void 0 ? void 0 : _a.type) === 'Insurance') {
|
|
490
|
+
return [
|
|
491
|
+
(_b = insuranceResponse.answer.value) === null || _b === void 0 ? void 0 : _b.payerId,
|
|
492
|
+
(_d = insuranceResponse.answer.value) === null || _d === void 0 ? void 0 : _d.memberId,
|
|
493
|
+
(_e = insuranceResponse.answer.value) === null || _e === void 0 ? void 0 : _e.payerName,
|
|
494
|
+
];
|
|
495
|
+
}
|
|
496
|
+
// existing payer id is automatically resolved on the backend as default
|
|
497
|
+
return [];
|
|
498
|
+
}, [responses]), payerId = _k[0], memberId = _k[1], payerName = _k[2];
|
|
499
|
+
// Extract state from Address question or enduser
|
|
500
|
+
var state = useMemo(function () {
|
|
501
|
+
var _a, _b;
|
|
502
|
+
// Find Address field with state value
|
|
503
|
+
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); });
|
|
504
|
+
if (((_a = addressResponse === null || addressResponse === void 0 ? void 0 : addressResponse.answer) === null || _a === void 0 ? void 0 : _a.type) === 'Address') {
|
|
505
|
+
return (_b = addressResponse.answer.value) === null || _b === void 0 ? void 0 : _b.state;
|
|
506
|
+
}
|
|
507
|
+
// enduser state is automatically resolved on the backend as default
|
|
508
|
+
}, [responses]);
|
|
509
|
+
// Soft eligibility check function
|
|
510
|
+
var checkProviderEligibility = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
511
|
+
var serviceTypeId, data, userIds, err_1;
|
|
512
|
+
var _a;
|
|
513
|
+
return __generator(this, function (_b) {
|
|
514
|
+
switch (_b.label) {
|
|
515
|
+
case 0:
|
|
516
|
+
serviceTypeId = (_a = field.options) === null || _a === void 0 ? void 0 : _a.bridgeServiceTypeId;
|
|
517
|
+
if (!serviceTypeId) {
|
|
518
|
+
setError('Bridge Service Type ID not configured');
|
|
519
|
+
return [2 /*return*/];
|
|
520
|
+
}
|
|
521
|
+
// payerId and state can be automatically resolved on the backend, if already saved on Enduser, so not required here
|
|
522
|
+
setLoading(true);
|
|
523
|
+
setError(undefined);
|
|
524
|
+
_b.label = 1;
|
|
525
|
+
case 1:
|
|
526
|
+
_b.trys.push([1, 3, 4, 5]);
|
|
527
|
+
return [4 /*yield*/, session.api.integrations.proxy_read({
|
|
528
|
+
id: enduserId,
|
|
529
|
+
integration: BRIDGE_TITLE,
|
|
530
|
+
type: 'provider-eligibility',
|
|
531
|
+
query: JSON.stringify({
|
|
532
|
+
serviceTypeId: serviceTypeId,
|
|
533
|
+
payerId: payerId,
|
|
534
|
+
state: state,
|
|
535
|
+
}),
|
|
536
|
+
})
|
|
537
|
+
// Store userIds in shared variable for Appointment Booking to use
|
|
538
|
+
];
|
|
539
|
+
case 2:
|
|
540
|
+
data = (_b.sent()).data;
|
|
541
|
+
userIds = (data === null || data === void 0 ? void 0 : data.userIds) || [];
|
|
542
|
+
setBridgeEligibilityUserIds(userIds);
|
|
543
|
+
// Update the answer with the eligibility result
|
|
544
|
+
onChange({
|
|
545
|
+
status: (data === null || data === void 0 ? void 0 : data.status) || 'unknown',
|
|
546
|
+
userIds: userIds,
|
|
547
|
+
}, field.id);
|
|
548
|
+
return [3 /*break*/, 5];
|
|
549
|
+
case 3:
|
|
550
|
+
err_1 = _b.sent();
|
|
551
|
+
setError((err_1 === null || err_1 === void 0 ? void 0 : err_1.message) || 'Failed to check eligibility');
|
|
552
|
+
console.error('Provider eligibility check failed:', err_1);
|
|
553
|
+
return [3 /*break*/, 5];
|
|
554
|
+
case 4:
|
|
555
|
+
setLoading(false);
|
|
556
|
+
return [7 /*endfinally*/];
|
|
557
|
+
case 5: return [2 /*return*/];
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
}); }, [session, field, payerId, state, onChange, enduserId]);
|
|
561
|
+
// Hard eligibility check function with polling
|
|
562
|
+
var checkServiceEligibility = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
563
|
+
var serviceTypeId, data, serviceEligibilityId_1, pollForResults, err_2;
|
|
564
|
+
var _a;
|
|
565
|
+
return __generator(this, function (_b) {
|
|
566
|
+
switch (_b.label) {
|
|
567
|
+
case 0:
|
|
568
|
+
serviceTypeId = (_a = field.options) === null || _a === void 0 ? void 0 : _a.bridgeServiceTypeId;
|
|
569
|
+
if (!serviceTypeId) {
|
|
570
|
+
setError('Bridge Service Type ID not configured');
|
|
571
|
+
return [2 /*return*/];
|
|
572
|
+
}
|
|
573
|
+
setLoading(true);
|
|
574
|
+
setError(undefined);
|
|
575
|
+
_b.label = 1;
|
|
576
|
+
case 1:
|
|
577
|
+
_b.trys.push([1, 3, , 4]);
|
|
578
|
+
return [4 /*yield*/, session.api.integrations.proxy_read({
|
|
579
|
+
id: enduserId,
|
|
580
|
+
integration: BRIDGE_TITLE,
|
|
581
|
+
type: 'service-eligibility',
|
|
582
|
+
query: JSON.stringify({
|
|
583
|
+
serviceTypeId: serviceTypeId,
|
|
584
|
+
payerId: payerId,
|
|
585
|
+
memberId: memberId,
|
|
586
|
+
state: state,
|
|
587
|
+
}),
|
|
588
|
+
})];
|
|
589
|
+
case 2:
|
|
590
|
+
data = (_b.sent()).data;
|
|
591
|
+
serviceEligibilityId_1 = data === null || data === void 0 ? void 0 : data.id;
|
|
592
|
+
if (!serviceEligibilityId_1) {
|
|
593
|
+
throw new Error('No service eligibility ID returned');
|
|
594
|
+
}
|
|
595
|
+
setLoading(false);
|
|
596
|
+
setPolling(true);
|
|
597
|
+
pollForResults = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
598
|
+
var maxAttempts, attempts, poll;
|
|
599
|
+
return __generator(this, function (_a) {
|
|
600
|
+
maxAttempts = 60 // Poll for up to 60 attempts (2 minutes at 2s intervals)
|
|
601
|
+
;
|
|
602
|
+
attempts = 0;
|
|
603
|
+
poll = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
604
|
+
var pollData, status_1, userIds, err_3;
|
|
605
|
+
return __generator(this, function (_a) {
|
|
606
|
+
switch (_a.label) {
|
|
607
|
+
case 0:
|
|
608
|
+
if (attempts >= maxAttempts) {
|
|
609
|
+
setError('Eligibility check timed out. Please try again.');
|
|
610
|
+
setPolling(false);
|
|
611
|
+
return [2 /*return*/];
|
|
612
|
+
}
|
|
613
|
+
attempts++;
|
|
614
|
+
_a.label = 1;
|
|
615
|
+
case 1:
|
|
616
|
+
_a.trys.push([1, 3, , 4]);
|
|
617
|
+
return [4 /*yield*/, session.api.integrations.proxy_read({
|
|
618
|
+
id: serviceEligibilityId_1,
|
|
619
|
+
integration: BRIDGE_TITLE,
|
|
620
|
+
type: 'service-eligibility-poll',
|
|
621
|
+
})];
|
|
622
|
+
case 2:
|
|
623
|
+
pollData = (_a.sent()).data;
|
|
624
|
+
status_1 = pollData === null || pollData === void 0 ? void 0 : pollData.status;
|
|
625
|
+
// Check if we're in a terminal state
|
|
626
|
+
if (status_1 && status_1 !== 'PENDING') {
|
|
627
|
+
userIds = (pollData === null || pollData === void 0 ? void 0 : pollData.userIds) || [];
|
|
628
|
+
setBridgeEligibilityUserIds(userIds);
|
|
629
|
+
// Update the answer with the eligibility result
|
|
630
|
+
onChange({
|
|
631
|
+
status: status_1 || 'unknown',
|
|
632
|
+
userIds: userIds,
|
|
633
|
+
}, field.id);
|
|
634
|
+
setPolling(false);
|
|
635
|
+
return [2 /*return*/];
|
|
636
|
+
}
|
|
637
|
+
// Still pending, poll again after delay
|
|
638
|
+
setTimeout(poll, 2000); // Poll every 2 seconds
|
|
639
|
+
return [3 /*break*/, 4];
|
|
640
|
+
case 3:
|
|
641
|
+
err_3 = _a.sent();
|
|
642
|
+
setError((err_3 === null || err_3 === void 0 ? void 0 : err_3.message) || 'Failed to poll eligibility status');
|
|
643
|
+
console.error('Service eligibility polling failed:', err_3);
|
|
644
|
+
setPolling(false);
|
|
645
|
+
return [3 /*break*/, 4];
|
|
646
|
+
case 4: return [2 /*return*/];
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
}); };
|
|
650
|
+
poll();
|
|
651
|
+
return [2 /*return*/];
|
|
652
|
+
});
|
|
653
|
+
}); };
|
|
654
|
+
pollForResults();
|
|
655
|
+
return [3 /*break*/, 4];
|
|
656
|
+
case 3:
|
|
657
|
+
err_2 = _b.sent();
|
|
658
|
+
setError((err_2 === null || err_2 === void 0 ? void 0 : err_2.message) || 'Failed to check service eligibility');
|
|
659
|
+
console.error('Service eligibility check failed:', err_2);
|
|
660
|
+
setLoading(false);
|
|
661
|
+
setPolling(false);
|
|
662
|
+
return [3 /*break*/, 4];
|
|
663
|
+
case 4: return [2 /*return*/];
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
}); }, [session, field, payerId, memberId, state, onChange, enduserId]);
|
|
667
|
+
// Auto-check eligibility for enduser sessions
|
|
668
|
+
var autoCheckRef = useRef(false);
|
|
669
|
+
useEffect(function () {
|
|
670
|
+
if (!isEnduserSession)
|
|
671
|
+
return;
|
|
672
|
+
if (autoCheckRef.current)
|
|
673
|
+
return;
|
|
674
|
+
autoCheckRef.current = true;
|
|
675
|
+
if (eligibilityType === 'Hard') {
|
|
676
|
+
checkServiceEligibility();
|
|
677
|
+
}
|
|
678
|
+
else {
|
|
679
|
+
checkProviderEligibility();
|
|
680
|
+
}
|
|
681
|
+
}, [isEnduserSession, eligibilityType, checkProviderEligibility, checkServiceEligibility]);
|
|
682
|
+
var errorComponent = useMemo(function () { return (_jsx(Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center", style: { padding: '20px 0' } }, { children: _jsx(Grid, __assign({ item: true }, { children: _jsx(Paper, __assign({ style: {
|
|
683
|
+
padding: 16,
|
|
684
|
+
backgroundColor: '#ffebee',
|
|
685
|
+
border: '2px solid #f44336'
|
|
686
|
+
} }, { children: _jsxs(Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center" }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "h2", style: { color: '#f44336' } }, { children: "\u26A0\uFE0F" })) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "h6", align: "center", color: "error" }, { children: "Unable to Check Eligibility" })) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "body2", align: "center", style: { color: '#d32f2f' } }, { children: error })) }))] })) })) })) }))); }, [error]);
|
|
687
|
+
var checkingEligibilityComponent = useMemo(function () { return (_jsxs(Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center", style: { padding: '20px 0' } }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsx(CircularProgress, { size: 40 }) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "body1" }, { children: polling ? 'Verifying eligibility with insurance...' : 'Checking eligibility...' })) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: polling ? 'This usually takes 15-30 seconds' : 'This may take a few moments' })) }))] }))); }, [polling]);
|
|
688
|
+
var resultsComponent = useMemo(function () {
|
|
689
|
+
var isEligible = (value === null || value === void 0 ? void 0 : value.status) === 'ELIGIBLE';
|
|
690
|
+
return (_jsx(Grid, __assign({ container: true, spacing: 2, direction: "column" }, { children: _jsx(Grid, __assign({ item: true }, { children: _jsx(Paper, __assign({ style: {
|
|
691
|
+
padding: 16,
|
|
692
|
+
backgroundColor: isEligible ? '#e8f5e9' : '#fff3e0',
|
|
693
|
+
border: "2px solid ".concat(isEligible ? '#4caf50' : '#ff9800')
|
|
694
|
+
} }, { children: _jsxs(Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center" }, { children: [_jsx(Grid, __assign({ item: true }, { children: isEligible ? (_jsx(CheckCircleOutline, { style: { fontSize: 48, color: '#4caf50' } })) : (_jsx(Typography, __assign({ variant: "h2", style: { color: '#ff9800' } }, { children: "\u26A0\uFE0F" }))) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "h6", align: "center" }, { children: isEligible
|
|
695
|
+
? "".concat(payerName || 'Your insurance provider', " is accepted!")
|
|
696
|
+
: 'Eligibility Status: ' + first_letter_capitalized(((value === null || value === void 0 ? void 0 : value.status) || 'Unknown').toLowerCase()) })) }))] })) })) })) })));
|
|
697
|
+
}, [value]);
|
|
698
|
+
// Loading/polling state for enduser sessions
|
|
699
|
+
if (isEnduserSession) {
|
|
700
|
+
if (loading || polling) {
|
|
701
|
+
return checkingEligibilityComponent;
|
|
702
|
+
}
|
|
703
|
+
if (error) {
|
|
704
|
+
return errorComponent;
|
|
705
|
+
}
|
|
706
|
+
if (value === null || value === void 0 ? void 0 : value.status) {
|
|
707
|
+
return resultsComponent;
|
|
708
|
+
}
|
|
709
|
+
return errorComponent;
|
|
710
|
+
}
|
|
711
|
+
// User/admin interface (non-enduser sessions)
|
|
712
|
+
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: ", ((_d = field.options) === null || _d === void 0 ? void 0 : _d.bridgeServiceTypeId) || '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: "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: "Check Provider Eligibility (Free)", submittingText: "Checking...", submitting: loading && !polling, disabled: !((_e = field.options) === null || _e === void 0 ? void 0 : _e.bridgeServiceTypeId) || loading || polling }) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(LoadingButton, { variant: "outlined", onClick: checkServiceEligibility, submitText: "Check Service Eligibility (Paid)", submittingText: polling ? "Polling..." : "Initiating...", submitting: loading || polling, disabled: !((_f = field.options) === null || _f === void 0 ? void 0 : _f.bridgeServiceTypeId) || 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) }))] })))] })));
|
|
713
|
+
};
|
|
453
714
|
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(); }) }))); };
|
|
454
715
|
var MinuteSelector = function (props) { return (_jsx(StringSelector, __assign({}, props, { options: Array(60).fill('').map(function (_, i) { return i <= 9 ? "0".concat(i) : i.toString(); }) }))); };
|
|
455
716
|
var AmPmSelector = function (props) { return (_jsx(StringSelector, __assign({}, props, { options: ['AM', 'PM'] }))); };
|
|
@@ -1824,17 +2085,17 @@ export var RelatedContactsInput = function (_a) {
|
|
|
1824
2085
|
return (_jsxs(Grid, __assign({ container: true, direction: "column", spacing: 1 }, { children: [_jsx(Grid, __assign({ item: true }, { children: value.map(function (contact, i) { return (_jsx(Grid, __assign({ item: true }, { children: _jsxs(Grid, __assign({ container: true, alignItems: "center", justifyContent: "space-between", wrap: "nowrap", spacing: 1 }, { children: [_jsx(Grid, __assign({ item: true }, { children: _jsxs(Grid, __assign({ container: true, alignItems: "center" }, { children: [_jsx(IconButton, __assign({ onClick: function () { return setEditing(i); }, color: "primary", size: "small" }, { children: _jsx(Edit, {}) })), _jsx(Typography, __assign({ noWrap: true }, { children: user_display_name(contact) || "Unnamed Contact ".concat(i + 1) }))] })) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(LabeledIconButton, { Icon: Delete, label: "Remove", onClick: function () { return onChange(value.filter(function (v, _i) { return i !== _i; }), field.id); } }) }))] })) }), i)); }) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Button, __assign({ variant: "contained", onClick: handleAddContact }, { children: "Add Contact" })) }))] })));
|
|
1825
2086
|
};
|
|
1826
2087
|
export var AppointmentBookingInput = function (_a) {
|
|
1827
|
-
var _b, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
2088
|
+
var _b, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1828
2089
|
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"]);
|
|
1829
2090
|
var session = useResolvedSession();
|
|
1830
|
-
var
|
|
1831
|
-
var
|
|
1832
|
-
var
|
|
1833
|
-
var
|
|
1834
|
-
var
|
|
2091
|
+
var _o = useState(), loaded = _o[0], setLoaded = _o[1];
|
|
2092
|
+
var _p = useState(''), error = _p[0], setError = _p[1];
|
|
2093
|
+
var _q = useState(false), acknowledgedWarning = _q[0], setAcknowledgedWarning = _q[1];
|
|
2094
|
+
var _r = useState(450), height = _r[0], setHeight = _r[1];
|
|
2095
|
+
var _s = useState(false), confirming = _s[0], setConfirming = _s[1];
|
|
1835
2096
|
var bookingPageId = (_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.bookingPageId;
|
|
1836
2097
|
var downloadICS = useCallback(function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1837
|
-
var _a,
|
|
2098
|
+
var _a, err_4;
|
|
1838
2099
|
return __generator(this, function (_b) {
|
|
1839
2100
|
switch (_b.label) {
|
|
1840
2101
|
case 0:
|
|
@@ -1846,8 +2107,8 @@ export var AppointmentBookingInput = function (_a) {
|
|
|
1846
2107
|
{ name: "event.ics", dataIsURL: true, type: 'text/calendar' }]);
|
|
1847
2108
|
return [3 /*break*/, 3];
|
|
1848
2109
|
case 2:
|
|
1849
|
-
|
|
1850
|
-
console.error(
|
|
2110
|
+
err_4 = _b.sent();
|
|
2111
|
+
console.error(err_4);
|
|
1851
2112
|
return [3 /*break*/, 3];
|
|
1852
2113
|
case 3: return [2 /*return*/];
|
|
1853
2114
|
}
|
|
@@ -1983,12 +2244,20 @@ export var AppointmentBookingInput = function (_a) {
|
|
|
1983
2244
|
})
|
|
1984
2245
|
.join(','));
|
|
1985
2246
|
}
|
|
2247
|
+
// Filter to Bridge eligibility userIds if option is enabled
|
|
2248
|
+
if ((_h = field.options) === null || _h === void 0 ? void 0 : _h.useBridgeEligibilityResult) {
|
|
2249
|
+
var bridgeUserIds = getBridgeEligibilityUserIds();
|
|
2250
|
+
if (bridgeUserIds.length === 0) {
|
|
2251
|
+
return _jsx(Typography, { children: "No eligible users found for booking" });
|
|
2252
|
+
}
|
|
2253
|
+
bookingURL += "&userIds=".concat(bridgeUserIds.join(','));
|
|
2254
|
+
}
|
|
1986
2255
|
// need to use form?.id for internally-submitted forms because formResponseId isn't generated until initial submission or saved draft
|
|
1987
|
-
if (((
|
|
2256
|
+
if (((_j = field.options) === null || _j === void 0 ? void 0 : _j.holdAppointmentMinutes) && (formResponseId || (field === null || field === void 0 ? void 0 : field.id))) {
|
|
1988
2257
|
bookingURL += "&formResponseId=".concat(formResponseId || (field === null || field === void 0 ? void 0 : field.id));
|
|
1989
2258
|
bookingURL += "&holdAppointmentMinutes=".concat(field.options.holdAppointmentMinutes);
|
|
1990
2259
|
}
|
|
1991
|
-
return (_jsxs(Grid, __assign({ container: true, direction: "column", spacing: 1, sx: { mt: 1 } }, { children: [!!((
|
|
2260
|
+
return (_jsxs(Grid, __assign({ container: true, direction: "column", spacing: 1, sx: { mt: 1 } }, { children: [!!((_l = (_k = field.options) === null || _k === void 0 ? void 0 : _k.userFilterTags) === null || _l === void 0 ? void 0 : _l.length) && !((_m = field.options.userTags) === null || _m === void 0 ? void 0 : _m.length) && !(isPreviousDisabled === null || isPreviousDisabled === void 0 ? void 0 : isPreviousDisabled()) && !confirming &&
|
|
1992
2261
|
_jsx(Grid, __assign({ item: true, alignSelf: "flex-start" }, { children: _jsx(Button, __assign({ variant: "outlined", onClick: goToPreviousField, sx: { height: 25, p: 0.5, px: 1 } }, { children: "Back" })) })), loaded.warningMessage &&
|
|
1993
2262
|
_jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ color: "error", sx: { fontSize: 20, fontWeight: 'bold' } }, { children: loaded.warningMessage })) })), _jsx(Grid, __assign({ item: true }, { children: (!loaded.warningMessage || acknowledgedWarning)
|
|
1994
2263
|
? (_jsx("iframe", { title: "Appointment Booking Embed", src: bookingURL, style: { border: 'none', width: '100%', height: height } }))
|