@tellescope/react-components 1.126.0 → 1.128.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/form_responses.d.ts +3 -1
- package/lib/cjs/Forms/form_responses.d.ts.map +1 -1
- package/lib/cjs/Forms/form_responses.js +22 -4
- package/lib/cjs/Forms/form_responses.js.map +1 -1
- package/lib/cjs/Forms/forms.js +1 -1
- package/lib/cjs/Forms/forms.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +7 -1
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/inputs_shared.d.ts +7 -1
- package/lib/cjs/inputs_shared.d.ts.map +1 -1
- package/lib/cjs/inputs_shared.js +14 -1
- package/lib/cjs/inputs_shared.js.map +1 -1
- package/lib/cjs/state.d.ts +36 -0
- package/lib/cjs/state.d.ts.map +1 -1
- package/lib/cjs/state.js +19 -3
- package/lib/cjs/state.js.map +1 -1
- package/lib/esm/Forms/form_responses.d.ts +3 -1
- package/lib/esm/Forms/form_responses.d.ts.map +1 -1
- package/lib/esm/Forms/form_responses.js +22 -4
- package/lib/esm/Forms/form_responses.js.map +1 -1
- package/lib/esm/Forms/forms.js +1 -1
- package/lib/esm/Forms/forms.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +7 -1
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/inputs_shared.d.ts +7 -1
- package/lib/esm/inputs_shared.d.ts.map +1 -1
- package/lib/esm/inputs_shared.js +12 -1
- package/lib/esm/inputs_shared.js.map +1 -1
- package/lib/esm/state.d.ts +36 -0
- package/lib/esm/state.d.ts.map +1 -1
- package/lib/esm/state.js +15 -0
- package/lib/esm/state.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/Forms/form_responses.tsx +20 -5
- package/src/Forms/forms.tsx +1 -1
- package/src/Forms/inputs.tsx +7 -1
- package/src/inputs_shared.tsx +24 -2
- package/src/state.tsx +22 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.128.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"@reduxjs/toolkit": "^1.6.2",
|
|
48
48
|
"@stripe/react-stripe-js": "^2.1.0",
|
|
49
49
|
"@stripe/stripe-js": "^1.52.1",
|
|
50
|
-
"@tellescope/constants": "^1.
|
|
51
|
-
"@tellescope/sdk": "^1.
|
|
52
|
-
"@tellescope/types-client": "^1.
|
|
53
|
-
"@tellescope/types-models": "^1.
|
|
50
|
+
"@tellescope/constants": "^1.128.0",
|
|
51
|
+
"@tellescope/sdk": "^1.128.0",
|
|
52
|
+
"@tellescope/types-client": "^1.128.0",
|
|
53
|
+
"@tellescope/types-models": "^1.128.0",
|
|
54
54
|
"@tellescope/types-utilities": "^1.69.3",
|
|
55
|
-
"@tellescope/utilities": "^1.
|
|
55
|
+
"@tellescope/utilities": "^1.128.0",
|
|
56
56
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
57
57
|
"@typescript-eslint/parser": "^4.33.0",
|
|
58
58
|
"css-to-react-native": "^3.0.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
80
80
|
"react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "d2593988ef94f2bfe138a03554653ef11811e68f",
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
}
|
|
@@ -23,13 +23,15 @@ export const AddressDisplay = ({ value } : { value: Required<FormResponseAnswerA
|
|
|
23
23
|
</Grid>
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
-
export const ResponseAnswer = ({ isHTML, answer: a, printing, onImageClick } : {
|
|
26
|
+
export const ResponseAnswer = ({ formResponse, fieldId, isHTML, answer: a, printing, onImageClick } : {
|
|
27
27
|
answer: FormResponseValueAnswer,
|
|
28
|
+
formResponse: FormResponse,
|
|
29
|
+
fieldId: string,
|
|
28
30
|
printing?: boolean,
|
|
29
31
|
onImageClick?: (args: { src: string }) => void,
|
|
30
32
|
isHTML?: boolean,
|
|
31
33
|
}) => (
|
|
32
|
-
(isHTML
|
|
34
|
+
(isHTML && typeof a.value === 'string')
|
|
33
35
|
? <div dangerouslySetInnerHTML={{ __html: remove_script_tags(a.value) }} />
|
|
34
36
|
: a.value
|
|
35
37
|
? (
|
|
@@ -139,8 +141,21 @@ export const ResponseAnswer = ({ isHTML, answer: a, printing, onImageClick } : {
|
|
|
139
141
|
</Grid>
|
|
140
142
|
))}
|
|
141
143
|
</Grid>
|
|
142
|
-
|
|
143
144
|
)
|
|
145
|
+
: (a.type === 'Emotii') ? (() => {
|
|
146
|
+
if (!a.value) return null
|
|
147
|
+
const scoring = formResponse?.emotii?.find(s => s.id === fieldId)
|
|
148
|
+
if (!scoring) return null
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<>
|
|
152
|
+
{[{ label: 'Average', ...scoring.scores.total }, ...scoring.scores.byAnswer].map((s, i) => (
|
|
153
|
+
<Typography>{s.label}: {s.score}</Typography>
|
|
154
|
+
))}
|
|
155
|
+
</>
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
})()
|
|
144
159
|
: (
|
|
145
160
|
<Typography style={answerStyles}>
|
|
146
161
|
{form_response_value_to_string(a.value)}
|
|
@@ -297,7 +312,7 @@ export const FormResponseView = ({ enduser, onClose, hideHeader, response, id, p
|
|
|
297
312
|
&& (
|
|
298
313
|
(r.answerIsHTML && typeof r.answer.value === 'string')
|
|
299
314
|
? <div dangerouslySetInnerHTML={{ __html: remove_script_tags(r.answer.value) }} />
|
|
300
|
-
: <ResponseAnswer answer={r.answer} printing={printing} />
|
|
315
|
+
: <ResponseAnswer fieldId={r.fieldId} formResponse={response} answer={r.answer} printing={printing} />
|
|
301
316
|
)
|
|
302
317
|
}
|
|
303
318
|
</div>
|
|
@@ -318,7 +333,7 @@ export const FormResponseView = ({ enduser, onClose, hideHeader, response, id, p
|
|
|
318
333
|
}
|
|
319
334
|
|
|
320
335
|
{!showAnswerInline &&
|
|
321
|
-
<ResponseAnswer answer={r.answer} />
|
|
336
|
+
<ResponseAnswer answer={r.answer} formResponse={response} fieldId={r.fieldId} />
|
|
322
337
|
}
|
|
323
338
|
</div>
|
|
324
339
|
)
|
package/src/Forms/forms.tsx
CHANGED
|
@@ -240,7 +240,7 @@ export const QuestionForField = ({
|
|
|
240
240
|
<Address field={field} disabled={value.disabled} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<any>} form={form} />
|
|
241
241
|
)
|
|
242
242
|
: field.type === 'Emotii' ? (
|
|
243
|
-
<Emotii field={field} disabled={value.disabled} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<any>} form={form} />
|
|
243
|
+
<Emotii enduser={enduser} enduserId={enduserId} field={field} disabled={value.disabled} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<any>} form={form} />
|
|
244
244
|
)
|
|
245
245
|
: field.type === 'Height' ? (
|
|
246
246
|
<Height field={field} disabled={value.disabled} value={value.answer.value as any} onChange={onFieldChange as ChangeHandler<any>} form={form} />
|
package/src/Forms/inputs.tsx
CHANGED
|
@@ -2744,17 +2744,23 @@ export const EmotiiInput = ({ goToNextField, goToPreviousField, field, value, on
|
|
|
2744
2744
|
const [data, setData] = useState<{ surveyRequestId: string, surveyUrl: string }>()
|
|
2745
2745
|
const [loadCount, setLoadCount] = useState(0)
|
|
2746
2746
|
|
|
2747
|
+
console.log(props.enduserId, props.enduser)
|
|
2748
|
+
|
|
2749
|
+
const fetchRef = useRef(false)
|
|
2747
2750
|
useEffect(() => {
|
|
2748
2751
|
if (value) return
|
|
2752
|
+
if (fetchRef.current) return
|
|
2753
|
+
fetchRef.current = true
|
|
2749
2754
|
|
|
2750
2755
|
session.api.integrations
|
|
2751
2756
|
.proxy_read({
|
|
2752
2757
|
integration: EMOTII_TITLE,
|
|
2753
2758
|
type: 'get_survey',
|
|
2759
|
+
id: props?.enduserId, // defaults to session id when not defined
|
|
2754
2760
|
query: requestIdRef.current,
|
|
2755
2761
|
})
|
|
2756
2762
|
.then(r => setData(r.data))
|
|
2757
|
-
}, [session, value])
|
|
2763
|
+
}, [session, value, props?.enduserId])
|
|
2758
2764
|
|
|
2759
2765
|
const loadAnswerRef = useRef(false)
|
|
2760
2766
|
useEffect(() => {
|
package/src/inputs_shared.tsx
CHANGED
|
@@ -5,8 +5,8 @@ import { LoadFunction, LoadFunctionArguments } from "@tellescope/sdk"
|
|
|
5
5
|
import { ALL_ACCESS, UNSEARCHABLE_FIELDS } from "@tellescope/constants"
|
|
6
6
|
import { SearchAPIProps, useSearchAPI } from "./hooks"
|
|
7
7
|
import { TextFieldProps } from "./mui"
|
|
8
|
-
import { AppointmentBookingPage, AutomationTrigger, CalendarEventTemplate, ChatRoom, Database, DatabaseRecord, Enduser, File, Form, FormGroup, Forum, Journey, ManagedContentRecord, Organization, PrescriptionRoute, Template, Ticket, User, UserNotification } from "@tellescope/types-client"
|
|
9
|
-
import { Button, Checkbox, Flex, HoverPaper, LoadingButton, LoadingData, LoadingLinear, ScrollingList, SearchTextInput, Typography, useAppointmentBookingPages, useAutomationTriggers, useCalendarEventTemplates, useChatRooms, useDatabaseRecords, useDatabases, useEndusers, useFiles, useFormGroups, useForms, useForums, useJourneys, useManagedContentRecords, useNotifications, useOrganization, useOrganizations, usePrescriptionRoutes, useResolvedSession, useSession, useTemplates, useTickets, useUsers, value_is_loaded } from "."
|
|
8
|
+
import { AppointmentBookingPage, AppointmentLocation, AutomationTrigger, CalendarEventTemplate, ChatRoom, Database, DatabaseRecord, Enduser, File, Form, FormGroup, Forum, Journey, ManagedContentRecord, MessageTemplateSnippet, Organization, PrescriptionRoute, Template, Ticket, User, UserNotification } from "@tellescope/types-client"
|
|
9
|
+
import { Button, Checkbox, Flex, HoverPaper, LoadingButton, LoadingData, LoadingLinear, ScrollingList, SearchTextInput, Typography, useAppointmentBookingPages, useAppointmentLocations, useAutomationTriggers, useCalendarEventTemplates, useChatRooms, useDatabaseRecords, useDatabases, useEndusers, useFiles, useFormGroups, useForms, useForums, useJourneys, useManagedContentRecords, useMessageTemplateSnippets, useNotifications, useOrganization, useOrganizations, usePrescriptionRoutes, useResolvedSession, useSession, useTemplates, useTickets, useUsers, value_is_loaded } from "."
|
|
10
10
|
import { SxProps } from "@mui/material"
|
|
11
11
|
import { AccessPermissions } from "@tellescope/types-models"
|
|
12
12
|
|
|
@@ -661,6 +661,17 @@ export const EnduserOrUserSearch = (props: Omit<GenericSearchProps<Enduser | Use
|
|
|
661
661
|
)
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
+
export const MessageTemplateSnippetSearch = ({ dontFetch, ...props }: Omit<GenericSearchProps<MessageTemplateSnippet>, 'filterKey'> & { filterKey?: string }) => {
|
|
665
|
+
const session = useSession()
|
|
666
|
+
const [, { addLocalElements }] = useMessageTemplateSnippets({ dontFetch })
|
|
667
|
+
return (
|
|
668
|
+
<ModelSearchInput filterKey="message_template_snippets" {...props}
|
|
669
|
+
searchAPI={session.api.message_template_snippets.getSome}
|
|
670
|
+
onLoad={addLocalElements}
|
|
671
|
+
/>
|
|
672
|
+
)
|
|
673
|
+
}
|
|
674
|
+
|
|
664
675
|
export const ContentSearch = ({ dontFetch, ...props }: Omit<GenericSearchProps<ManagedContentRecord>, 'filterKey'> & { filterKey?: string }) => {
|
|
665
676
|
const session = useResolvedSession()
|
|
666
677
|
const [, { addLocalElements }] = useManagedContentRecords({ dontFetch })
|
|
@@ -683,6 +694,17 @@ export const CalendarEventTemplatesSearch = (props: Omit<GenericSearchProps<Cale
|
|
|
683
694
|
)
|
|
684
695
|
}
|
|
685
696
|
|
|
697
|
+
export const AppointmentLocationSearch = (props: Omit<GenericSearchProps<AppointmentLocation>, 'filterKey'> & { filterKey?: string }) => {
|
|
698
|
+
const session = useSession()
|
|
699
|
+
const [, { addLocalElements }] = useAppointmentLocations()
|
|
700
|
+
return (
|
|
701
|
+
<ModelSearchInput filterKey="appointment_locations" {...props}
|
|
702
|
+
searchAPI={session.api.appointment_locations.getSome}
|
|
703
|
+
onLoad={addLocalElements}
|
|
704
|
+
/>
|
|
705
|
+
)
|
|
706
|
+
}
|
|
707
|
+
|
|
686
708
|
export const AppointmentBookingPagesSearch = (props: Omit<GenericSearchProps<AppointmentBookingPage>, 'filterKey'> & { filterKey?: string }) => {
|
|
687
709
|
const session = useSession()
|
|
688
710
|
const [, { addLocalElements }] = useAppointmentBookingPages()
|
package/src/state.tsx
CHANGED
|
@@ -89,6 +89,7 @@ import {
|
|
|
89
89
|
WebhookLog,
|
|
90
90
|
FormGroup,
|
|
91
91
|
PortalBranding,
|
|
92
|
+
MessageTemplateSnippet,
|
|
92
93
|
} from "@tellescope/types-client"
|
|
93
94
|
|
|
94
95
|
import {
|
|
@@ -103,7 +104,7 @@ import {
|
|
|
103
104
|
} from '@tellescope/sdk'
|
|
104
105
|
import { value_is_loaded } from './loading'
|
|
105
106
|
import { matches_organization, object_is_empty, objects_equivalent } from '@tellescope/utilities'
|
|
106
|
-
import {
|
|
107
|
+
import { ModelName, ReadFilter, SortBy } from '@tellescope/types-models'
|
|
107
108
|
|
|
108
109
|
const RESET_CACHE_TYPE = "cache/reset" as const
|
|
109
110
|
export const resetStateAction = createAction(RESET_CACHE_TYPE)
|
|
@@ -345,6 +346,7 @@ const flowchartNotesSlice = createSliceForList<FlowchartNote, 'flowchart_notes'>
|
|
|
345
346
|
const webhookLogsSlice = createSliceForList<WebhookLog, 'webhook_logs'>('webhook_logs')
|
|
346
347
|
const formGroupsSlice = createSliceForList<FormGroup, 'form_groups'>('form_groups')
|
|
347
348
|
const portalBrandingsSlice = createSliceForList<PortalBranding, 'portal_brandings'>('portal_brandings')
|
|
349
|
+
const messageTemplateSnippetsSlice = createSliceForList<MessageTemplateSnippet, 'message_template_snippets'>('message_template_snippets')
|
|
348
350
|
|
|
349
351
|
const roleBasedAccessPermissionsSlice = createSliceForList<RoleBasedAccessPermission, 'role_based_access_permissions'>('role_based_access_permissions')
|
|
350
352
|
|
|
@@ -428,6 +430,7 @@ export const sharedConfig = {
|
|
|
428
430
|
webhook_logs: webhookLogsSlice.reducer,
|
|
429
431
|
form_groups: formGroupsSlice.reducer,
|
|
430
432
|
portal_brandings: portalBrandingsSlice.reducer,
|
|
433
|
+
message_template_snippets: messageTemplateSnippetsSlice.reducer,
|
|
431
434
|
},
|
|
432
435
|
}
|
|
433
436
|
|
|
@@ -1171,6 +1174,24 @@ export const useUserAndEnduserDisplayInfo = () => {
|
|
|
1171
1174
|
return displayInfo
|
|
1172
1175
|
}
|
|
1173
1176
|
|
|
1177
|
+
export const useMessageTemplateSnippets = (options={} as HookOptions<MessageTemplateSnippet>) => {
|
|
1178
|
+
const session = useSession()
|
|
1179
|
+
|
|
1180
|
+
return useListStateHook('message_template_snippets', useTypedSelector(s => s.message_template_snippets), session, messageTemplateSnippetsSlice,
|
|
1181
|
+
{
|
|
1182
|
+
loadQuery: session.api.message_template_snippets.getSome,
|
|
1183
|
+
findOne: session.api.message_template_snippets.getOne,
|
|
1184
|
+
findByIds: session.api.message_template_snippets.getByIds,
|
|
1185
|
+
addOne: session.api.message_template_snippets.createOne,
|
|
1186
|
+
addSome: session.api.message_template_snippets.createSome,
|
|
1187
|
+
deleteOne: session.api.message_template_snippets.deleteOne,
|
|
1188
|
+
updateOne: session.api.message_template_snippets.updateOne,
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
...options,
|
|
1192
|
+
},
|
|
1193
|
+
)
|
|
1194
|
+
}
|
|
1174
1195
|
export const usePortalBrandings = (options={} as HookOptions<PortalBranding>) => {
|
|
1175
1196
|
const session = useSession()
|
|
1176
1197
|
|