@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.
Files changed (39) hide show
  1. package/lib/cjs/Forms/forms.d.ts.map +1 -1
  2. package/lib/cjs/Forms/forms.js +37 -35
  3. package/lib/cjs/Forms/forms.js.map +1 -1
  4. package/lib/cjs/Forms/forms.v2.d.ts.map +1 -1
  5. package/lib/cjs/Forms/forms.v2.js +37 -35
  6. package/lib/cjs/Forms/forms.v2.js.map +1 -1
  7. package/lib/cjs/Forms/inputs.d.ts +17 -2
  8. package/lib/cjs/Forms/inputs.d.ts.map +1 -1
  9. package/lib/cjs/Forms/inputs.js +308 -36
  10. package/lib/cjs/Forms/inputs.js.map +1 -1
  11. package/lib/cjs/Forms/inputs.v2.d.ts +3 -2
  12. package/lib/cjs/Forms/inputs.v2.d.ts.map +1 -1
  13. package/lib/cjs/Forms/inputs.v2.js +20 -293
  14. package/lib/cjs/Forms/inputs.v2.js.map +1 -1
  15. package/lib/cjs/Forms/types.d.ts +4 -0
  16. package/lib/cjs/Forms/types.d.ts.map +1 -1
  17. package/lib/esm/Forms/forms.d.ts.map +1 -1
  18. package/lib/esm/Forms/forms.js +38 -36
  19. package/lib/esm/Forms/forms.js.map +1 -1
  20. package/lib/esm/Forms/forms.v2.d.ts.map +1 -1
  21. package/lib/esm/Forms/forms.v2.js +38 -36
  22. package/lib/esm/Forms/forms.v2.js.map +1 -1
  23. package/lib/esm/Forms/inputs.d.ts +17 -2
  24. package/lib/esm/Forms/inputs.d.ts.map +1 -1
  25. package/lib/esm/Forms/inputs.js +306 -37
  26. package/lib/esm/Forms/inputs.js.map +1 -1
  27. package/lib/esm/Forms/inputs.v2.d.ts +3 -2
  28. package/lib/esm/Forms/inputs.v2.d.ts.map +1 -1
  29. package/lib/esm/Forms/inputs.v2.js +15 -289
  30. package/lib/esm/Forms/inputs.v2.js.map +1 -1
  31. package/lib/esm/Forms/types.d.ts +4 -0
  32. package/lib/esm/Forms/types.d.ts.map +1 -1
  33. package/lib/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +9 -9
  35. package/src/Forms/forms.tsx +13 -6
  36. package/src/Forms/forms.v2.tsx +9 -2
  37. package/src/Forms/inputs.tsx +449 -65
  38. package/src/Forms/inputs.v2.tsx +12 -593
  39. package/src/Forms/types.ts +4 -2
@@ -30,7 +30,8 @@ export declare const StringLongInput: ({ field, value, onChange, form, ...props
30
30
  export declare const PhoneInput: ({ field, value, onChange, form, ...props }: FormInputProps<'phone'>) => JSX.Element;
31
31
  export declare const EmailInput: ({ field, value, onChange, form, ...props }: FormInputProps<'email'>) => JSX.Element;
32
32
  export declare const NumberInput: ({ field, value, onChange, form, ...props }: FormInputProps<'number'>) => JSX.Element;
33
- export declare const InsuranceInput: ({ field, onDatabaseSelect, value, onChange, form, responses, enduser, ...props }: FormInputProps<'Insurance'>) => JSX.Element;
33
+ export declare const InsuranceInput: (props: FormInputProps<'Insurance'>) => JSX.Element;
34
+ export declare const BridgeEligibilityInput: (props: FormInputProps<'Bridge Eligibility'>) => JSX.Element;
34
35
  export declare const TimeInput: ({ field, value, onChange, ...props }: FormInputProps<'string'>) => JSX.Element;
35
36
  export declare const TimezoneInput: ({ value, field, onChange, ...props }: FormInputProps<'Timezone'>) => JSX.Element;
36
37
  export declare const AddressInput: ({ field, form, value, onChange, ...props }: FormInputProps<'Address'>) => JSX.Element;
@@ -63,7 +64,7 @@ export declare const MedicationsInput: ({ field, value, onChange, ...props }: Fo
63
64
  export declare const BelugaPatientPreferenceInput: ({ field, value: _value, onChange }: FormInputProps<'Beluga Patient Preference'>) => JSX.Element;
64
65
  export declare const contact_is_valid: (e: Partial<Enduser>) => "Email is invalid" | "Phone is invalid" | "Date of birth should be MM-DD-YYYY" | undefined;
65
66
  export declare const RelatedContactsInput: ({ field, value: _value, onChange, error: parentError, ...props }: FormInputProps<'Related Contacts'>) => JSX.Element;
66
- export declare const AppointmentBookingInput: ({ formResponseId, field, value, onChange, form, responses, goToPreviousField, isPreviousDisabled, enduserId, ...props }: FormInputProps<'Appointment Booking'>) => JSX.Element;
67
+ export declare const AppointmentBookingInput: (props: FormInputProps<'Appointment Booking'>) => JSX.Element;
67
68
  export declare const HeightInput: ({ field, value, onChange, ...props }: FormInputProps<'Height'>) => JSX.Element;
68
69
  export { RedirectInput } from './inputs';
69
70
  export declare const HiddenValueInput: ({ goToNextField, goToPreviousField, field, value, onChange, isSinglePage, groupFields }: FormInputProps<'email'>) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"inputs.v2.d.ts","sourceRoot":"","sources":["../../../src/Forms/inputs.v2.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwE,MAAM,OAAO,CAAA;AAE5F,OAAO,EAAmH,OAAO,EAAa,cAAc,EAAc,MAAM,eAAe,CAAA;AAC/L,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIxC,OAAO,EAAE,OAAO,EAAuB,iBAAiB,EAAqG,MAAM,0BAA0B,CAAA;AAO7L,OAAO,EAAc,QAAQ,EAAgD,MAAM,EAAoE,MAAM,IAAI,CAAA;AACjK,OAAO,EAAiC,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAWnF,eAAO,MAAM,cAAc;WAAkC,MAAM;kBAAgB,MAAM,KAAK,IAAI;iBAgBjG,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE;IAAE,EAAE,EAAE,OAAO,CAAA;CAgB3C,CAAA;AACF,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,aAEvC,CAAA;AAED,eAAO,MAAM,SAAS;SAAiC,MAAM;;iBAoE5D,CAAA;AAED,eAAO,MAAM,WAAW,+BAAgC,eAAe,QAAQ,CAAC,gBA0B/E,CAAA;AAkCD,eAAO,MAAM,YAAY,+BAAgC,eAAe,SAAS,CAAC,gBAuDjF,CAAA;AAOD,eAAO,MAAM,SAAS;WAGb,SAAS;;mDAoBjB,CAAA;AAED,eAAO,MAAM,UAA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od && mod.__esModule) ? mod : { "default": mod };
98
98
  };
99
99
  Object.defineProperty(exports, "__esModule", { value: true });
100
- exports.ChargeebeeInput = exports.RichTextInput = exports.ConditionsInput = exports.AllergiesInput = exports.EmotiiInput = exports.HiddenValueInput = exports.RedirectInput = 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.convertHEIC = exports.SignatureInput = exports.ESignatureTerms = exports.AddressInput = exports.TimezoneInput = exports.TimeInput = 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 = void 0;
100
+ exports.ChargeebeeInput = exports.RichTextInput = exports.ConditionsInput = exports.AllergiesInput = exports.EmotiiInput = exports.HiddenValueInput = exports.RedirectInput = 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.convertHEIC = exports.SignatureInput = exports.ESignatureTerms = exports.AddressInput = exports.TimezoneInput = exports.TimeInput = 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 = void 0;
101
101
  var jsx_runtime_1 = require("react/jsx-runtime");
102
102
  var react_1 = __importStar(require("react"));
103
103
  var axios_1 = __importDefault(require("axios"));
@@ -370,124 +370,18 @@ var NumberInput = function (_a) {
370
370
  } })));
371
371
  };
372
372
  exports.NumberInput = NumberInput;
373
- var InsuranceInput = function (_a) {
374
- var _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
375
- 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"]);
376
- var session = (0, __1.useResolvedSession)();
377
- var _t = (0, react_1.useState)([]), payers = _t[0], setPayers = _t[1];
378
- var _u = (0, react_1.useState)(''), query = _u[0], setQuery = _u[1];
379
- var addressQuestion = (0, react_1.useMemo)(function () { return responses === null || responses === void 0 ? void 0 : responses.find(function (r) {
380
- var _a;
381
- if (r.answer.type !== 'Address')
382
- return false;
383
- if (r.field.intakeField !== 'Address')
384
- return false;
385
- // make sure state is actually defined (in case of multiple address questions, where 1+ are blank)
386
- if (!((_a = r.answer.value) === null || _a === void 0 ? void 0 : _a.state))
387
- return false;
388
- return true;
389
- }); }, [responses]);
390
- var state = (0, react_1.useMemo)(function () {
391
- var _a, _b, _d;
392
- 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));
393
- }, [enduser === null || enduser === void 0 ? void 0 : enduser.state, addressQuestion]);
394
- var loadRef = (0, react_1.useRef)(false); // so session changes don't cause
395
- (0, react_1.useEffect)(function () {
396
- var _a;
397
- if (((_a = field === null || field === void 0 ? void 0 : field.options) === null || _a === void 0 ? void 0 : _a.dataSource) === constants_1.CANVAS_TITLE)
398
- return; // instead, look-up while typing against Canvas Search API
399
- if (loadRef.current)
400
- return;
401
- loadRef.current = true;
402
- // just load all at once, should be reasonably performant compared to paging
403
- session.api.form_fields.load_choices_from_database({ fieldId: field.id, limit: 10000 })
404
- .then(function (_a) {
405
- var choices = _a.choices;
406
- return setPayers(choices
407
- .map(function (c) {
408
- var _a, _b, _d, _e, _f, _g, _h, _j;
409
- return ({
410
- id: ((_b = (_a = c.values.find(function (v) { var _a, _b; return ((_b = (_a = v.label) === null || _a === void 0 ? void 0 : _a.trim()) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'id'; })) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.toString()) || '',
411
- name: ((_e = (_d = c.values.find(function (v) { var _a, _b; return ((_b = (_a = v.label) === null || _a === void 0 ? void 0 : _a.trim()) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'name'; })) === null || _d === void 0 ? void 0 : _d.value) === null || _e === void 0 ? void 0 : _e.toString()) || '',
412
- state: ((_g = (_f = c.values.find(function (v) { var _a, _b; return ((_b = (_a = v.label) === null || _a === void 0 ? void 0 : _a.trim()) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'state'; })) === null || _f === void 0 ? void 0 : _f.value) === null || _g === void 0 ? void 0 : _g.toString()) || '',
413
- type: ((_j = (_h = c.values.find(function (v) { var _a, _b; return ((_b = (_a = v.label) === null || _a === void 0 ? void 0 : _a.trim()) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'type'; })) === null || _h === void 0 ? void 0 : _h.value) === null || _j === void 0 ? void 0 : _j.toString()) || '',
414
- databaseRecord: c,
415
- });
416
- })
417
- .filter(function (c) { return !c.state || !state || (c.state === state); }));
418
- })
419
- .catch(console.error);
420
- }, [session, state, (_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.dataSource]);
421
- var searchRef = (0, react_1.useRef)(query);
422
- (0, react_1.useEffect)(function () {
423
- var _a;
424
- if (((_a = field === null || field === void 0 ? void 0 : field.options) === null || _a === void 0 ? void 0 : _a.dataSource) !== constants_1.CANVAS_TITLE) {
425
- return;
426
- }
427
- if (!query)
428
- return;
429
- if (searchRef.current === query)
430
- return;
431
- searchRef.current = query;
432
- session.api.integrations.proxy_read({
433
- integration: constants_1.CANVAS_TITLE,
434
- query: query,
435
- type: 'organizations',
436
- })
437
- .then(function (_a) {
438
- var data = _a.data;
439
- try {
440
- setPayers(data.map(function (d) { return ({
441
- id: d.resource.id,
442
- name: d.resource.name,
443
- }); }));
444
- }
445
- catch (err) {
446
- console.error;
447
- }
448
- })
449
- .catch(console.error);
450
- }, [session, (_d = field === null || field === void 0 ? void 0 : field.options) === null || _d === void 0 ? void 0 : _d.dataSource, query]);
451
- 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) {
452
- var _a, _b;
453
- return onChange(__assign(__assign({}, value), { payerName: v || '', payerId: ((_a = payers.find(function (p) { return p.name === v; })) === null || _a === void 0 ? void 0 : _a.id) || '', payerType: ((_b = payers.find(function (p) { return p.name === v; })) === null || _b === void 0 ? void 0 : _b.type) || '' }), field.id);
454
- }, onInputChange: ((_f = field.options) === null || _f === void 0 ? void 0 : _f.requirePredefinedInsurer)
455
- ? function (e, v) { if (v) {
456
- setQuery(v);
457
- } }
458
- : function (e, v) {
459
- var _a, _b, _d;
460
- if (v) {
461
- setQuery(v);
462
- }
463
- var databaseRecord = (_a = payers.find(function (p) { return p.name === v; })) === null || _a === void 0 ? void 0 : _a.databaseRecord;
464
- if (databaseRecord) {
465
- onDatabaseSelect === null || onDatabaseSelect === void 0 ? void 0 : onDatabaseSelect([databaseRecord]);
466
- }
467
- 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);
468
- }, renderInput: function (params) {
469
- var _a;
470
- return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({}, params, { InputProps: __assign(__assign({}, params.InputProps), { sx: exports.defaultInputProps.sx }), required: !field.isOptional, size: "small", label: "Insurer", placeholder: ((_a = field.options) === null || _a === void 0 ? void 0 : _a.dataSource) === constants_1.CANVAS_TITLE ? "Search insurer..." : "Insurer" })));
471
- } }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { InputProps: exports.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: (0, __1.form_display_text_for_language)(form, "Member ID", ''), size: "small" }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { InputProps: exports.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: (0, __1.form_display_text_for_language)(form, "Plan Name", ''), size: "small" }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12, sm: 6 }, { children: (0, jsx_runtime_1.jsx)(exports.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) {
472
- return onChange(__assign(__assign({}, value), { startDate: startDate }), field.id);
473
- } }) })), ((_j = field.options) === null || _j === void 0 ? void 0 : _j.includeGroupNumber) &&
474
- (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { InputProps: exports.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: (0, __1.form_display_text_for_language)(form, "Group Number", ''), size: "small" }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(StringSelector, { size: "small", label: "Relationship to Policy Owner", options: ((((_l = field.options) === null || _l === void 0 ? void 0 : _l.billingProvider) === constants_1.CANVAS_TITLE || ((_m = field.options) === null || _m === void 0 ? void 0 : _m.dataSource) === constants_1.CANVAS_TITLE)
475
- ? constants_1.INSURANCE_RELATIONSHIPS_CANVAS
476
- : constants_1.INSURANCE_RELATIONSHIPS)
477
- .sort(function (x, y) { return x.localeCompare(y); }), value: (value === null || value === void 0 ? void 0 : value.relationship) || 'Self', onChange: function (relationship) {
478
- return onChange(__assign(__assign({}, value), { relationship: relationship || 'Self' }), field.id);
479
- } }) })), ((value === null || value === void 0 ? void 0 : value.relationship) || 'Self') !== 'Self' &&
480
- (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 12 }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { fontWeight: 'bold' } }, { children: "Policy Owner Details" })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { label: "First Name", size: "small", InputProps: exports.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) {
481
- return onChange(__assign(__assign({}, value), { relationshipDetails: __assign(__assign({}, value === null || value === void 0 ? void 0 : value.relationshipDetails), { fname: e.target.value }) }), field.id);
482
- } }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { label: "Last Name", size: "small", InputProps: exports.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) {
483
- return onChange(__assign(__assign({}, value), { relationshipDetails: __assign(__assign({}, value === null || value === void 0 ? void 0 : value.relationshipDetails), { lname: e.target.value }) }), field.id);
484
- } }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(StringSelector, { options: constants_1.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) {
485
- return onChange(__assign(__assign({}, value), { relationshipDetails: __assign(__assign({}, value === null || value === void 0 ? void 0 : value.relationshipDetails), { gender: v }) }), field.id);
486
- } }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, xs: 6 }, { children: (0, jsx_runtime_1.jsx)(exports.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) {
487
- return onChange(__assign(__assign({}, value), { relationshipDetails: __assign(__assign({}, value === null || value === void 0 ? void 0 : value.relationshipDetails), { dateOfBirth: dateOfBirth }) }), field.id);
488
- } }) }))] })] })));
373
+ // InsuranceInput, BridgeEligibilityInput, and AppointmentBookingInput logic is shared with inputs.tsx to avoid duplication
374
+ var inputs_1 = require("./inputs");
375
+ // Wrap the shared InsuranceInput component with v2-specific props
376
+ var InsuranceInput = function (props) {
377
+ return (0, jsx_runtime_1.jsx)(inputs_1.InsuranceInput, __assign({}, props, { inputProps: exports.defaultInputProps }));
489
378
  };
490
379
  exports.InsuranceInput = InsuranceInput;
380
+ // Wrap the shared BridgeEligibilityInput component with v2-specific props
381
+ var BridgeEligibilityInput = function (props) {
382
+ return (0, jsx_runtime_1.jsx)(inputs_1.BridgeEligibilityInput, __assign({}, props, { inputProps: exports.defaultInputProps }));
383
+ };
384
+ exports.BridgeEligibilityInput = BridgeEligibilityInput;
491
385
  var StringSelector = function (_a) {
492
386
  var options = _a.options, value = _a.value, onChange = _a.onChange, required = _a.required, getDisplayValue = _a.getDisplayValue, props = __rest(_a, ["options", "value", "onChange", "required", "getDisplayValue"]);
493
387
  return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, __assign({ fullWidth: true, size: props.size, required: required }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, { children: props.label }), (0, jsx_runtime_1.jsx)(material_1.Select, __assign({}, props, { value: value, onChange: function (e) { return onChange(e.target.value); }, fullWidth: true, sx: exports.defaultInputProps.sx }, { children: options.map(function (o, i) {
@@ -860,8 +754,8 @@ exports.MultipleChoiceInput = MultipleChoiceInput;
860
754
  // Both versions use the same implementation from inputs.tsx to ensure consistent behavior
861
755
  // and avoid code duplication. Re-exporting here maintains the pattern where forms.v2.tsx
862
756
  // only imports from inputs.v2.tsx
863
- var inputs_1 = require("./inputs");
864
- Object.defineProperty(exports, "StripeInput", { enumerable: true, get: function () { return inputs_1.StripeInput; } });
757
+ var inputs_2 = require("./inputs");
758
+ Object.defineProperty(exports, "StripeInput", { enumerable: true, get: function () { return inputs_2.StripeInput; } });
865
759
  var Progress = function (_a) {
866
760
  var numerator = _a.numerator, denominator = _a.denominator, style = _a.style, color = _a.color;
867
761
  return ((0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: __assign({ display: 'flex', alignItems: 'center' }, style) }, { children: (0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: { width: '100%' } }, { children: (0, jsx_runtime_1.jsx)(LinearProgress_1.default, { variant: "determinate", value: (numerator / (denominator || 1)) * 100, sx: color ? {
@@ -914,11 +808,11 @@ var DropdownInput = function (_a) {
914
808
  exports.DropdownInput = DropdownInput;
915
809
  // DatabaseSelectInput logic is shared with inputs.tsx to avoid duplication
916
810
  // Import the interface and component from the shared implementation
917
- var inputs_2 = require("./inputs");
811
+ var inputs_3 = require("./inputs");
918
812
  // Wrap the shared DatabaseSelectInput component with v2-specific props
919
813
  var DatabaseSelectInput = function (props) {
920
814
  // Pass all props plus v2-specific defaultInputProps to the shared component
921
- return (0, jsx_runtime_1.jsx)(inputs_2.DatabaseSelectInput, __assign({}, props, { inputProps: exports.defaultInputProps }));
815
+ return (0, jsx_runtime_1.jsx)(inputs_3.DatabaseSelectInput, __assign({}, props, { inputProps: exports.defaultInputProps }));
922
816
  };
923
817
  exports.DatabaseSelectInput = DatabaseSelectInput;
924
818
  var displayTermsCache = undefined;
@@ -1340,176 +1234,9 @@ var RelatedContactsInput = function (_a) {
1340
1234
  return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", spacing: 1 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: value.map(function (contact, i) { return ((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", justifyContent: "space-between", wrap: "nowrap", spacing: 1 }, { 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)(__1.IconButton, __assign({ onClick: function () { return setEditing(i); }, color: "primary", size: "small" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Edit, {}) })), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ noWrap: true }, { children: (0, utilities_1.user_display_name)(contact) || "Unnamed Contact ".concat(i + 1) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(__1.LabeledIconButton, { Icon: icons_material_1.Delete, label: "Remove", onClick: function () { return onChange(value.filter(function (v, _i) { return i !== _i; }), field.id); } }) }))] })) }), i)); }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ variant: "contained", onClick: handleAddContact }, { children: "Add Contact" })) }))] })));
1341
1235
  };
1342
1236
  exports.RelatedContactsInput = RelatedContactsInput;
1343
- var AppointmentBookingInput = function (_a) {
1344
- var _b, _d, _e, _f, _g, _h, _j, _k, _l;
1345
- 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"]);
1346
- var session = (0, __1.useResolvedSession)();
1347
- var _m = (0, react_1.useState)(), loaded = _m[0], setLoaded = _m[1];
1348
- var _o = (0, react_1.useState)(''), error = _o[0], setError = _o[1];
1349
- var _p = (0, react_1.useState)(false), acknowledgedWarning = _p[0], setAcknowledgedWarning = _p[1];
1350
- var _q = (0, react_1.useState)(450), height = _q[0], setHeight = _q[1];
1351
- var _r = (0, react_1.useState)(false), confirming = _r[0], setConfirming = _r[1];
1352
- var bookingPageId = (_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.bookingPageId;
1353
- var downloadICS = (0, react_1.useCallback)(function (event) { return __awaiter(void 0, void 0, void 0, function () {
1354
- var _a, err_1;
1355
- return __generator(this, function (_b) {
1356
- switch (_b.label) {
1357
- case 0:
1358
- _b.trys.push([0, 2, , 3]);
1359
- _a = utilities_1.downloadFile;
1360
- return [4 /*yield*/, session.api.calendar_events.download_ics_file({ calendarEventId: event.id, excludeAttendee: true })];
1361
- case 1:
1362
- _a.apply(void 0, [_b.sent(),
1363
- { name: "event.ics", dataIsURL: true, type: 'text/calendar' }]);
1364
- return [3 /*break*/, 3];
1365
- case 2:
1366
- err_1 = _b.sent();
1367
- console.error(err_1);
1368
- return [3 /*break*/, 3];
1369
- case 3: return [2 /*return*/];
1370
- }
1371
- });
1372
- }); }, [session]);
1373
- var addressQuestion = (0, react_1.useMemo)(function () { return responses === null || responses === void 0 ? void 0 : responses.find(function (r) {
1374
- var _a;
1375
- if (r.answer.type !== 'Address')
1376
- return false;
1377
- if (r.field.intakeField !== 'Address')
1378
- return false;
1379
- // make sure state is actually defined (in case of multiple address questions, where 1+ are blank)
1380
- if (!((_a = r.answer.value) === null || _a === void 0 ? void 0 : _a.state))
1381
- return false;
1382
- return true;
1383
- }); }, [responses]);
1384
- var state = (0, react_1.useMemo)(function () {
1385
- var _a, _b, _d;
1386
- 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);
1387
- }, [addressQuestion]);
1388
- var loadBookingInfo = (0, react_1.useCallback)(function () {
1389
- if (!bookingPageId)
1390
- return;
1391
- setError('');
1392
- session.api.form_fields.booking_info({
1393
- enduserId: enduserId,
1394
- bookingPageId: bookingPageId,
1395
- enduserFields: { state: state }
1396
- })
1397
- .then(setLoaded)
1398
- .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'); });
1399
- }, [enduserId, bookingPageId, session, state]);
1400
- var fetchRef = (0, react_1.useRef)(false);
1401
- (0, react_1.useEffect)(function () {
1402
- if (value)
1403
- return;
1404
- if (!bookingPageId)
1405
- return;
1406
- if (fetchRef.current)
1407
- return;
1408
- fetchRef.current = true;
1409
- loadBookingInfo();
1410
- }, [bookingPageId, loadBookingInfo, value]);
1411
- (0, react_1.useEffect)(function () {
1412
- var handleMessage = function (m) {
1413
- var _a, _b, _d, _e, _f, _g, _h, _j, _k;
1414
- // entropy to separate from other booking pages rendered on the same screen
1415
- if (((_a = m === null || m === void 0 ? void 0 : m.data) === null || _a === void 0 ? void 0 : _a.type) === 'Booking Success'
1416
- && typeof ((_b = m === null || m === void 0 ? void 0 : m.data) === null || _b === void 0 ? void 0 : _b.bookedEventId) === 'string'
1417
- && (!((_d = m === null || m === void 0 ? void 0 : m.data) === null || _d === void 0 ? void 0 : _d.entropy) || ((_e = m === null || m === void 0 ? void 0 : m.data) === null || _e === void 0 ? void 0 : _e.entropy) === (loaded === null || loaded === void 0 ? void 0 : loaded.entropy))) {
1418
- onChange(m.data.bookedEventId, field.id);
1419
- (0, utilities_1.emit_gtm_event)({ event: 'form_progress', fieldId: field.id, formId: field.formId, title: field.title, status: "Appointment Booked" });
1420
- }
1421
- if (((_f = m === null || m === void 0 ? void 0 : m.data) === null || _f === void 0 ? void 0 : _f.type) === 'CalendarPicker') {
1422
- setHeight(750);
1423
- }
1424
- if (((_g = m === null || m === void 0 ? void 0 : m.data) === null || _g === void 0 ? void 0 : _g.type) === 'UsersPicker') {
1425
- setHeight(450);
1426
- }
1427
- if (((_h = m === null || m === void 0 ? void 0 : m.data) === null || _h === void 0 ? void 0 : _h.type) === 'Confirmation') {
1428
- setConfirming(true);
1429
- }
1430
- if (((_j = m === null || m === void 0 ? void 0 : m.data) === null || _j === void 0 ? void 0 : _j.type) === 'Join Link' && ((_k = m === null || m === void 0 ? void 0 : m.data) === null || _k === void 0 ? void 0 : _k.link)) {
1431
- (0, utilities_1.update_local_storage)('tellescope_last_booking_page_join_link', m.data.link);
1432
- }
1433
- else {
1434
- setConfirming(false);
1435
- }
1436
- };
1437
- window.addEventListener('message', handleMessage);
1438
- return function () { window.removeEventListener('message', handleMessage); };
1439
- }, [field === null || field === void 0 ? void 0 : field.id, field === null || field === void 0 ? void 0 : field.formId, field === null || field === void 0 ? void 0 : field.title, onChange, acknowledgedWarning, value, loaded === null || loaded === void 0 ? void 0 : loaded.entropy]);
1440
- if (value) {
1441
- return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", spacing: 1 }, { 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", wrap: "nowrap" }, { children: [(0, jsx_runtime_1.jsx)(icons_material_1.CheckCircleOutline, { color: "success" }), (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ sx: { ml: 1, fontSize: 20 } }, { children: "Your appointment has been booked" }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, sx: { maxWidth: 250 } }, { children: (0, jsx_runtime_1.jsx)(__1.LoadingButton, { variant: "contained", style: { maxWidth: 250 }, submitText: "Add to Calendar", submittingText: "Downloading...", onClick: function () { return downloadICS({ id: value }); } }) }))] })));
1442
- }
1443
- if (!bookingPageId) {
1444
- return (0, jsx_runtime_1.jsx)(material_1.Typography, { children: "No booking page specified" });
1445
- }
1446
- if (error) {
1447
- return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", spacing: 1 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Typography, __assign({ color: "error" }, { children: ["Error: ", error] })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(__1.LoadingButton, { disabled: !bookingPageId, style: { maxWidth: 300 }, variant: "contained", onClick: loadBookingInfo, submitText: "Try Again", submittingText: "Loading..." }) }))] })));
1448
- }
1449
- if (!(loaded === null || loaded === void 0 ? void 0 : loaded.bookingURL)) {
1450
- return (0, jsx_runtime_1.jsx)(LinearProgress_1.default, {});
1451
- }
1452
- var bookingURL = loaded.bookingURL;
1453
- if ((_e = (_d = field.options) === null || _d === void 0 ? void 0 : _d.userTags) === null || _e === void 0 ? void 0 : _e.length) {
1454
- bookingURL += "&userTags=".concat(field.options.userTags
1455
- .flatMap(function (t) {
1456
- var _a, _b;
1457
- // set dynamic tags if found
1458
- if (t === '{{logic}}') {
1459
- return new URL(window.location.href).searchParams.get('logic') || '{{logic}}';
1460
- }
1461
- if (t.startsWith("{{field.") && t.endsWith(".value}}")) {
1462
- var fieldId_1 = t.replace('{{field.', '').replace(".value}}", '');
1463
- var answer = (_a = responses === null || responses === void 0 ? void 0 : responses.find(function (r) { return r.fieldId === fieldId_1; })) === null || _a === void 0 ? void 0 : _a.answer;
1464
- if (!(answer === null || answer === void 0 ? void 0 : answer.value))
1465
- return t;
1466
- if (answer.type === 'Insurance') {
1467
- return answer.value.payerName || '';
1468
- }
1469
- if (Array.isArray(answer.value) && typeof ((_b = answer.value) === null || _b === void 0 ? void 0 : _b[0]) === 'string') {
1470
- return answer.value;
1471
- }
1472
- return (0, utilities_1.form_response_value_to_string)(answer.value);
1473
- }
1474
- return t;
1475
- })
1476
- .join(','));
1477
- }
1478
- if ((_g = (_f = field.options) === null || _f === void 0 ? void 0 : _f.userFilterTags) === null || _g === void 0 ? void 0 : _g.length) {
1479
- bookingURL += "&userFilterTags=".concat(field.options.userFilterTags
1480
- .flatMap(function (t) {
1481
- var _a, _b;
1482
- // set dynamic tags if found
1483
- if (t === '{{logic}}') {
1484
- return new URL(window.location.href).searchParams.get('logic') || '{{logic}}';
1485
- }
1486
- if (t.startsWith("{{field.") && t.endsWith(".value}}")) {
1487
- var fieldId_2 = t.replace('{{field.', '').replace(".value}}", '');
1488
- var answer = (_a = responses === null || responses === void 0 ? void 0 : responses.find(function (r) { return r.fieldId === fieldId_2; })) === null || _a === void 0 ? void 0 : _a.answer;
1489
- if (!(answer === null || answer === void 0 ? void 0 : answer.value))
1490
- return t;
1491
- if (answer.type === 'Insurance') {
1492
- return answer.value.payerName || '';
1493
- }
1494
- if (Array.isArray(answer.value) && typeof ((_b = answer.value) === null || _b === void 0 ? void 0 : _b[0]) === 'string') {
1495
- return answer.value;
1496
- }
1497
- return (0, utilities_1.form_response_value_to_string)(answer.value);
1498
- }
1499
- return t;
1500
- })
1501
- .join(','));
1502
- }
1503
- // need to use form?.id for internally-submitted forms because formResponseId isn't generated until initial submission or saved draft
1504
- if (((_h = field.options) === null || _h === void 0 ? void 0 : _h.holdAppointmentMinutes) && (formResponseId || (field === null || field === void 0 ? void 0 : field.id))) {
1505
- bookingURL += "&formResponseId=".concat(formResponseId || (field === null || field === void 0 ? void 0 : field.id));
1506
- bookingURL += "&holdAppointmentMinutes=".concat(field.options.holdAppointmentMinutes);
1507
- }
1508
- return ((0, jsx_runtime_1.jsxs)(material_1.Grid, __assign({ container: true, direction: "column", spacing: 1, sx: { mt: 1 } }, { children: [!!((_k = (_j = field.options) === null || _j === void 0 ? void 0 : _j.userFilterTags) === null || _k === void 0 ? void 0 : _k.length) && !((_l = field.options.userTags) === null || _l === void 0 ? void 0 : _l.length) && !(isPreviousDisabled === null || isPreviousDisabled === void 0 ? void 0 : isPreviousDisabled()) && !confirming &&
1509
- (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true, alignSelf: "flex-start" }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, __assign({ variant: "outlined", onClick: goToPreviousField, sx: { height: 25, p: 0.5, px: 1 } }, { children: "Back" })) })), loaded.warningMessage &&
1510
- (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (0, jsx_runtime_1.jsx)(material_1.Typography, __assign({ color: "error", sx: { fontSize: 20, fontWeight: 'bold' } }, { children: loaded.warningMessage })) })), (0, jsx_runtime_1.jsx)(material_1.Grid, __assign({ item: true }, { children: (!loaded.warningMessage || acknowledgedWarning)
1511
- ? ((0, jsx_runtime_1.jsx)("iframe", { title: "Appointment Booking Embed", src: bookingURL, style: { border: 'none', width: '100%', height: height } }))
1512
- : ((0, jsx_runtime_1.jsx)(material_1.Button, __assign({ variant: "outlined", onClick: function () { return setAcknowledgedWarning(true); } }, { children: "Show Booking Page Preview" }))) }))] })));
1237
+ // AppointmentBookingInput logic is shared with inputs.tsx to avoid duplication
1238
+ var AppointmentBookingInput = function (props) {
1239
+ return (0, jsx_runtime_1.jsx)(inputs_1.AppointmentBookingInput, __assign({}, props));
1513
1240
  };
1514
1241
  exports.AppointmentBookingInput = AppointmentBookingInput;
1515
1242
  var HeightInput = function (_a) {
@@ -1519,8 +1246,8 @@ var HeightInput = function (_a) {
1519
1246
  };
1520
1247
  exports.HeightInput = HeightInput;
1521
1248
  // Re-export from V1 to follow DRY principles
1522
- var inputs_3 = require("./inputs");
1523
- Object.defineProperty(exports, "RedirectInput", { enumerable: true, get: function () { return inputs_3.RedirectInput; } });
1249
+ var inputs_4 = require("./inputs");
1250
+ Object.defineProperty(exports, "RedirectInput", { enumerable: true, get: function () { return inputs_4.RedirectInput; } });
1524
1251
  var HiddenValueInput = function (_a) {
1525
1252
  var goToNextField = _a.goToNextField, goToPreviousField = _a.goToPreviousField, field = _a.field, value = _a.value, onChange = _a.onChange, isSinglePage = _a.isSinglePage, groupFields = _a.groupFields;
1526
1253
  var lastRef = (0, react_1.useRef)(0);