@tellescope/react-components 1.252.3 → 1.253.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 (41) hide show
  1. package/lib/cjs/Forms/inputs.d.ts.map +1 -1
  2. package/lib/cjs/Forms/inputs.js +28 -103
  3. package/lib/cjs/Forms/inputs.js.map +1 -1
  4. package/lib/cjs/TwilioVideo/TwilioControls.d.ts.map +1 -1
  5. package/lib/cjs/TwilioVideo/TwilioControls.js +60 -43
  6. package/lib/cjs/TwilioVideo/TwilioControls.js.map +1 -1
  7. package/lib/cjs/TwilioVideo/TwilioParticipant.d.ts.map +1 -1
  8. package/lib/cjs/TwilioVideo/TwilioParticipant.js +33 -18
  9. package/lib/cjs/TwilioVideo/TwilioParticipant.js.map +1 -1
  10. package/lib/cjs/TwilioVideo/TwilioVideoContext.d.ts +4 -1
  11. package/lib/cjs/TwilioVideo/TwilioVideoContext.d.ts.map +1 -1
  12. package/lib/cjs/TwilioVideo/TwilioVideoContext.js +45 -9
  13. package/lib/cjs/TwilioVideo/TwilioVideoContext.js.map +1 -1
  14. package/lib/cjs/TwilioVideo/index.d.ts +1 -1
  15. package/lib/cjs/TwilioVideo/index.d.ts.map +1 -1
  16. package/lib/cjs/TwilioVideo/index.js +2 -1
  17. package/lib/cjs/TwilioVideo/index.js.map +1 -1
  18. package/lib/esm/Forms/inputs.d.ts.map +1 -1
  19. package/lib/esm/Forms/inputs.js +28 -103
  20. package/lib/esm/Forms/inputs.js.map +1 -1
  21. package/lib/esm/TwilioVideo/TwilioControls.d.ts.map +1 -1
  22. package/lib/esm/TwilioVideo/TwilioControls.js +62 -45
  23. package/lib/esm/TwilioVideo/TwilioControls.js.map +1 -1
  24. package/lib/esm/TwilioVideo/TwilioParticipant.d.ts.map +1 -1
  25. package/lib/esm/TwilioVideo/TwilioParticipant.js +33 -18
  26. package/lib/esm/TwilioVideo/TwilioParticipant.js.map +1 -1
  27. package/lib/esm/TwilioVideo/TwilioVideoContext.d.ts +4 -1
  28. package/lib/esm/TwilioVideo/TwilioVideoContext.d.ts.map +1 -1
  29. package/lib/esm/TwilioVideo/TwilioVideoContext.js +45 -9
  30. package/lib/esm/TwilioVideo/TwilioVideoContext.js.map +1 -1
  31. package/lib/esm/TwilioVideo/index.d.ts +1 -1
  32. package/lib/esm/TwilioVideo/index.d.ts.map +1 -1
  33. package/lib/esm/TwilioVideo/index.js +1 -1
  34. package/lib/esm/TwilioVideo/index.js.map +1 -1
  35. package/lib/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +9 -9
  37. package/src/Forms/inputs.tsx +22 -101
  38. package/src/TwilioVideo/TwilioControls.tsx +53 -3
  39. package/src/TwilioVideo/TwilioParticipant.tsx +27 -16
  40. package/src/TwilioVideo/TwilioVideoContext.tsx +39 -3
  41. package/src/TwilioVideo/index.ts +1 -0
@@ -846,19 +846,10 @@ export var CandidEligibilityInput = function (_a) {
846
846
  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"]);
847
847
  var session = useResolvedSession();
848
848
  var _e = useState(false), loading = _e[0], setLoading = _e[1];
849
- var _f = useState(false), polling = _f[0], setPolling = _f[1];
850
- var _g = useState(), error = _g[0], setError = _g[1];
849
+ var _f = useState(), error = _f[0], setError = _f[1];
851
850
  var isEnduserSession = session.type === 'enduser';
852
- var pollTimeoutRef = useRef();
853
- // Clean up polling timeout on unmount
854
- useEffect(function () {
855
- return function () {
856
- if (pollTimeoutRef.current)
857
- clearTimeout(pollTimeoutRef.current);
858
- };
859
- }, []);
860
851
  // Extract payerId from Insurance question response
861
- var _h = useMemo(function () {
852
+ var _g = useMemo(function () {
862
853
  var _a, _b, _d, _e;
863
854
  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); });
864
855
  if (((_a = insuranceResponse === null || insuranceResponse === void 0 ? void 0 : insuranceResponse.answer) === null || _a === void 0 ? void 0 : _a.type) === 'Insurance') {
@@ -869,9 +860,9 @@ export var CandidEligibilityInput = function (_a) {
869
860
  ];
870
861
  }
871
862
  return [];
872
- }, [responses]), payerId = _h[0], memberId = _h[1], payerName = _h[2];
863
+ }, [responses]), payerId = _g[0], memberId = _g[1], payerName = _g[2];
873
864
  var checkEligibility = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
874
- var data, coverageId_1, checkId_1, initialStatus, maxAttempts_1, attempts_1, pollForResult_1, err_6;
865
+ var data, err_6;
875
866
  var _a, _b;
876
867
  return __generator(this, function (_d) {
877
868
  switch (_d.label) {
@@ -895,82 +886,19 @@ export var CandidEligibilityInput = function (_a) {
895
886
  })];
896
887
  case 2:
897
888
  data = (_d.sent()).data;
898
- coverageId_1 = data === null || data === void 0 ? void 0 : data.coverageId;
899
- checkId_1 = data === null || data === void 0 ? void 0 : data.checkId;
900
- initialStatus = data === null || data === void 0 ? void 0 : data.status;
901
- if (!coverageId_1 || !checkId_1) {
902
- throw new Error('No coverage ID or check ID returned from eligibility check');
903
- }
904
- // If already completed, update answer immediately
905
- if (initialStatus === 'COMPLETED' || initialStatus === 'FAILED' || initialStatus === 'UNKNOWN') {
906
- onChange({
907
- payerId: payerId,
908
- status: initialStatus,
909
- coverageId: coverageId_1,
910
- }, field.id);
911
- setLoading(false);
912
- return [2 /*return*/];
913
- }
914
- // Step 2: Poll for results
889
+ onChange({
890
+ payerId: payerId,
891
+ status: data === null || data === void 0 ? void 0 : data.status,
892
+ benefits: data === null || data === void 0 ? void 0 : data.benefits,
893
+ planMetadata: data === null || data === void 0 ? void 0 : data.planMetadata,
894
+ }, field.id);
915
895
  setLoading(false);
916
- setPolling(true);
917
- maxAttempts_1 = 60 // 2 minutes at 2s intervals
918
- ;
919
- attempts_1 = 0;
920
- pollForResult_1 = function () { return __awaiter(void 0, void 0, void 0, function () {
921
- var pollData, status_2, err_7;
922
- return __generator(this, function (_a) {
923
- switch (_a.label) {
924
- case 0:
925
- if (attempts_1 >= maxAttempts_1) {
926
- setError('Eligibility check timed out. Please try again.');
927
- setPolling(false);
928
- return [2 /*return*/];
929
- }
930
- attempts_1++;
931
- _a.label = 1;
932
- case 1:
933
- _a.trys.push([1, 3, , 4]);
934
- return [4 /*yield*/, session.api.integrations.proxy_read({
935
- id: coverageId_1,
936
- integration: CANDID_TITLE,
937
- type: 'candid-eligibility-poll',
938
- query: JSON.stringify({ checkId: checkId_1 }),
939
- })];
940
- case 2:
941
- pollData = (_a.sent()).data;
942
- status_2 = pollData === null || pollData === void 0 ? void 0 : pollData.status;
943
- // Terminal statuses: COMPLETED, FAILED, or UNKNOWN (Candid returns UNKNOWN when eligibility cannot be determined)
944
- if (status_2 === 'COMPLETED' || status_2 === 'FAILED' || status_2 === 'UNKNOWN') {
945
- onChange({
946
- payerId: payerId,
947
- status: status_2,
948
- coverageId: coverageId_1,
949
- benefits: pollData === null || pollData === void 0 ? void 0 : pollData.benefits,
950
- }, field.id);
951
- setPolling(false);
952
- return [2 /*return*/];
953
- }
954
- // Still pending, poll again
955
- pollTimeoutRef.current = setTimeout(pollForResult_1, 2000);
956
- return [3 /*break*/, 4];
957
- case 3:
958
- err_7 = _a.sent();
959
- setError((err_7 === null || err_7 === void 0 ? void 0 : err_7.message) || 'Failed to check eligibility status');
960
- setPolling(false);
961
- return [3 /*break*/, 4];
962
- case 4: return [2 /*return*/];
963
- }
964
- });
965
- }); };
966
- pollForResult_1();
967
896
  return [3 /*break*/, 4];
968
897
  case 3:
969
898
  err_6 = _d.sent();
970
899
  setError((err_6 === null || err_6 === void 0 ? void 0 : err_6.message) || 'Failed to check eligibility');
971
900
  console.error('Candid eligibility check failed:', err_6);
972
901
  setLoading(false);
973
- setPolling(false);
974
902
  return [3 /*break*/, 4];
975
903
  case 4: return [2 /*return*/];
976
904
  }
@@ -995,23 +923,20 @@ export var CandidEligibilityInput = function (_a) {
995
923
  backgroundColor: '#ffebee',
996
924
  border: '2px solid #f44336'
997
925
  } }, { 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: "!" })) })), _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]);
998
- 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]);
926
+ 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: "Checking eligibility..." })) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: "This may take a few moments" })) }))] }))); }, []);
999
927
  var resultsComponent = useMemo(function () {
1000
- var isCompleted = (value === null || value === void 0 ? void 0 : value.status) === 'COMPLETED';
1001
- var isFailed = (value === null || value === void 0 ? void 0 : value.status) === 'FAILED';
928
+ var isActive = (value === null || value === void 0 ? void 0 : value.status) === 'ACTIVE';
1002
929
  return (_jsx(Grid, __assign({ container: true, spacing: 2, direction: "column" }, { children: _jsx(Grid, __assign({ item: true }, { children: _jsx(Paper, __assign({ style: {
1003
930
  padding: 16,
1004
- backgroundColor: isCompleted ? '#e8f5e9' : '#ffebee',
1005
- border: "2px solid ".concat(isCompleted ? '#4caf50' : '#f44336')
1006
- } }, { children: _jsxs(Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center" }, { children: [_jsx(Grid, __assign({ item: true }, { children: isCompleted ? (_jsx(CheckCircleOutline, { style: { fontSize: 48, color: '#4caf50' } })) : (_jsx(Typography, __assign({ variant: "h2", style: { color: '#f44336' } }, { children: "!" }))) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "h6", align: "center" }, { children: isCompleted
931
+ backgroundColor: isActive ? '#e8f5e9' : '#fff8e1',
932
+ border: "2px solid ".concat(isActive ? '#4caf50' : '#ffa000')
933
+ } }, { children: _jsxs(Grid, __assign({ container: true, spacing: 2, direction: "column", alignItems: "center" }, { children: [_jsx(Grid, __assign({ item: true }, { children: isActive ? (_jsx(CheckCircleOutline, { style: { fontSize: 48, color: '#4caf50' } })) : (_jsx(Typography, __assign({ variant: "h2", style: { color: '#ffa000' } }, { children: "!" }))) })), _jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "h6", align: "center" }, { children: isActive
1007
934
  ? "".concat(payerName || 'Insurance', " eligibility verified")
1008
- : isFailed
1009
- ? 'Eligibility check failed'
1010
- : 'Eligibility Status: ' + first_letter_capitalized(((value === null || value === void 0 ? void 0 : value.status) || 'Unknown').toLowerCase()) })) }))] })) })) })) })));
935
+ : 'Eligibility Status: ' + first_letter_capitalized(((value === null || value === void 0 ? void 0 : value.status) || 'Unknown').toLowerCase()) })) }))] })) })) })) })));
1011
936
  }, [value, payerName]);
1012
- // Loading/polling state for enduser sessions
937
+ // Loading state for enduser sessions
1013
938
  if (isEnduserSession) {
1014
- if (loading || polling) {
939
+ if (loading) {
1015
940
  return checkingEligibilityComponent;
1016
941
  }
1017
942
  if (error) {
@@ -1023,7 +948,7 @@ export var CandidEligibilityInput = function (_a) {
1023
948
  return errorComponent;
1024
949
  }
1025
950
  // User/admin interface (non-enduser sessions)
1026
- 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: ["Service Code: ", ((_b = field.options) === null || _b === void 0 ? void 0 : _b.candidServiceCode) || 'Not configured'] })), _jsxs(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: ["Provider NPI: ", ((_d = field.options) === null || _d === void 0 ? void 0 : _d.candidNPI) || 'Not configured'] })), payerId && _jsxs(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: ["Payer ID: ", payerId] })), memberId && _jsxs(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: ["Member ID: ", memberId] }))] })), error && (_jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "body2", color: "error" }, { children: error })) }))), polling && (_jsx(Grid, __assign({ item: true }, { children: _jsx(Typography, __assign({ variant: "body2", color: "primary" }, { children: form_display_text_for_language(form, "Polling for results... (this may take 15-30 seconds)") })) }))), _jsx(Grid, __assign({ item: true, container: true, spacing: 2 }, { children: _jsx(Grid, __assign({ item: true }, { children: _jsx(LoadingButton, { variant: "outlined", onClick: checkEligibility, submitText: form_display_text_for_language(form, "Check Eligibility"), submittingText: polling ? form_display_text_for_language(form, "Polling...") : form_display_text_for_language(form, "Checking..."), submitting: loading || polling, disabled: 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) }))] })))] })));
951
+ 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: ["Service Code: ", ((_b = field.options) === null || _b === void 0 ? void 0 : _b.candidServiceCode) || 'Not configured'] })), _jsxs(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: ["Provider NPI: ", ((_d = field.options) === null || _d === void 0 ? void 0 : _d.candidNPI) || 'Not configured'] })), 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 })) }))), _jsx(Grid, __assign({ item: true, container: true, spacing: 2 }, { children: _jsx(Grid, __assign({ item: true }, { children: _jsx(LoadingButton, { variant: "outlined", onClick: checkEligibility, submitText: form_display_text_for_language(form, "Check Eligibility"), submittingText: form_display_text_for_language(form, "Checking..."), submitting: loading, disabled: loading }) })) })), 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) }))] })))] })));
1027
952
  };
1028
953
  export var PharmacySearchInput = function (_a) {
1029
954
  var field = _a.field, rawValue = _a.value, onChange = _a.onChange, responses = _a.responses, enduser = _a.enduser, form = _a.form, props = __rest(_a, ["field", "value", "onChange", "responses", "enduser", "form"]);
@@ -1049,7 +974,7 @@ export var PharmacySearchInput = function (_a) {
1049
974
  var _f = useState([]), pharmacies = _f[0], setPharmacies = _f[1];
1050
975
  var _g = useState(false), hasSearched = _g[0], setHasSearched = _g[1];
1051
976
  var searchPharmacies = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
1052
- var data, err_8;
977
+ var data, err_7;
1053
978
  return __generator(this, function (_a) {
1054
979
  switch (_a.label) {
1055
980
  case 0:
@@ -1076,8 +1001,8 @@ export var PharmacySearchInput = function (_a) {
1076
1001
  }
1077
1002
  return [3 /*break*/, 5];
1078
1003
  case 3:
1079
- err_8 = _a.sent();
1080
- setError((err_8 === null || err_8 === void 0 ? void 0 : err_8.message) || form_display_text_for_language(form, 'Failed to search pharmacies'));
1004
+ err_7 = _a.sent();
1005
+ setError((err_7 === null || err_7 === void 0 ? void 0 : err_7.message) || form_display_text_for_language(form, 'Failed to search pharmacies'));
1081
1006
  setPharmacies([]);
1082
1007
  return [3 /*break*/, 5];
1083
1008
  case 4:
@@ -2567,7 +2492,7 @@ export var AppointmentBookingInput = function (_a) {
2567
2492
  var _s = useState(false), confirming = _s[0], setConfirming = _s[1];
2568
2493
  var bookingPageId = (_b = field === null || field === void 0 ? void 0 : field.options) === null || _b === void 0 ? void 0 : _b.bookingPageId;
2569
2494
  var downloadICS = useCallback(function (event) { return __awaiter(void 0, void 0, void 0, function () {
2570
- var _a, err_9;
2495
+ var _a, err_8;
2571
2496
  return __generator(this, function (_b) {
2572
2497
  switch (_b.label) {
2573
2498
  case 0:
@@ -2579,8 +2504,8 @@ export var AppointmentBookingInput = function (_a) {
2579
2504
  { name: "event.ics", dataIsURL: true, type: 'text/calendar' }]);
2580
2505
  return [3 /*break*/, 3];
2581
2506
  case 2:
2582
- err_9 = _b.sent();
2583
- console.error(err_9);
2507
+ err_8 = _b.sent();
2508
+ console.error(err_8);
2584
2509
  return [3 /*break*/, 3];
2585
2510
  case 3: return [2 /*return*/];
2586
2511
  }
@@ -3100,7 +3025,7 @@ export var ChargeebeeInput = function (_a) {
3100
3025
  onChange({ url: url }, field.id);
3101
3026
  }, [loadCount, url]);
3102
3027
  var handleVerify = function () { return __awaiter(void 0, void 0, void 0, function () {
3103
- var hasPaymentMethod, err_10;
3028
+ var hasPaymentMethod, err_9;
3104
3029
  var _a;
3105
3030
  return __generator(this, function (_b) {
3106
3031
  switch (_b.label) {
@@ -3121,8 +3046,8 @@ export var ChargeebeeInput = function (_a) {
3121
3046
  }
3122
3047
  return [3 /*break*/, 5];
3123
3048
  case 3:
3124
- err_10 = _b.sent();
3125
- setError((_a = err_10 === null || err_10 === void 0 ? void 0 : err_10.message) !== null && _a !== void 0 ? _a : 'Failed to verify payment method');
3049
+ err_9 = _b.sent();
3050
+ setError((_a = err_9 === null || err_9 === void 0 ? void 0 : err_9.message) !== null && _a !== void 0 ? _a : 'Failed to verify payment method');
3126
3051
  return [3 /*break*/, 5];
3127
3052
  case 4:
3128
3053
  setVerifying(false);