Skip to content

Commit

Permalink
feat: add autoProgress param to the conversational form from branding…
Browse files Browse the repository at this point in the history
… settings
  • Loading branch information
mohsinht committed Jul 27, 2023
1 parent 83bc7a2 commit 0bfca3b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@apollo/client": "^3.7.2",
"@awell_health/ui-library": "0.1.19",
"@awell_health/ui-library": "0.1.21",
"@formsort/react-embed": "^3.1.1",
"@sentry/nextjs": "^7.59.3",
"date-fns": "^2.29.3",
Expand Down
4 changes: 4 additions & 0 deletions src/components/Form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ErrorPage } from '../ErrorPage'
import { addSentryBreadcrumb } from '../../services/ErrorReporter'
import { BreadcrumbCategory } from '../../services/ErrorReporter/addSentryBreadcrumb'
import useLocalStorage from 'use-local-storage'
import { useHostedSession } from '../../hooks/useHostedSession'

interface FormProps {
activity: Activity
Expand All @@ -25,6 +26,7 @@ export const Form: FC<FormProps> = ({ activity }) => {
const { t } = useTranslation()
const [evaluateFormRules] = useEvaluateFormRules(activity.object.id)
const { onSubmit } = useSubmitForm({ activity })
const { branding } = useHostedSession()

const [formProgress, setFormProgress] = useLocalStorage(activity.id, '')

Expand Down Expand Up @@ -103,6 +105,8 @@ export const Form: FC<FormProps> = ({ activity }) => {
evaluateDisplayConditions={handleEvaluateFormRules}
storedAnswers={formProgress}
onAnswersChange={handleOnAnswersChange}
/** uncomment the following when UI library is updated */
// autoProgress={branding?.hosted_page_auto_progress ?? false}
/>
) : (
<ConversationalForm
Expand Down
21 changes: 11 additions & 10 deletions src/hooks/useHostedSession/graphql/getHostedSession.graphql
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# import 'HostedSession'
query GetHostedSession {
hostedSession {
session {
...HostedSession
}
branding {
logo_url
hosted_page_title
accent_color
}
hostedSession {
session {
...HostedSession
}
}
branding {
logo_url
hosted_page_title
accent_color
hosted_page_auto_progress
}
}
}
6 changes: 5 additions & 1 deletion src/types/generated/types-orchestration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ export enum BooleanOperator {
export type BrandingSettings = {
__typename?: 'BrandingSettings';
accent_color?: Maybe<Scalars['String']>;
/** Auto advance in radio questions in conversational display mode. */
hosted_page_auto_progress?: Maybe<Scalars['Boolean']>;
hosted_page_title?: Maybe<Scalars['String']>;
logo_url?: Maybe<Scalars['String']>;
};
Expand Down Expand Up @@ -690,6 +692,7 @@ export type FilterActivitiesParams = {
activity_status?: InputMaybe<StringArrayFilter>;
activity_type?: InputMaybe<StringArrayFilter>;
pathway_definition_id?: InputMaybe<StringArrayFilter>;
pathway_status?: InputMaybe<StringArrayFilter>;
patient_id?: InputMaybe<TextFilterEquals>;
stakeholders?: InputMaybe<StringArrayFilter>;
};
Expand Down Expand Up @@ -2219,7 +2222,7 @@ export type OnHostedSessionExpiredSubscription = { __typename?: 'Subscription',
export type GetHostedSessionQueryVariables = Exact<{ [key: string]: never; }>;


export type GetHostedSessionQuery = { __typename?: 'Query', hostedSession: { __typename?: 'HostedSessionPayload', session: { __typename?: 'HostedSession', id: string, pathway_id: string, status: HostedSessionStatus, success_url?: string | null, cancel_url?: string | null, stakeholder: { __typename?: 'HostedSessionStakeholder', id: string, type: HostedSessionStakeholderType, name: string } }, branding?: { __typename?: 'BrandingSettings', logo_url?: string | null, hosted_page_title?: string | null, accent_color?: string | null } | null } };
export type GetHostedSessionQuery = { __typename?: 'Query', hostedSession: { __typename?: 'HostedSessionPayload', session: { __typename?: 'HostedSession', id: string, pathway_id: string, status: HostedSessionStatus, success_url?: string | null, cancel_url?: string | null, stakeholder: { __typename?: 'HostedSessionStakeholder', id: string, type: HostedSessionStakeholderType, name: string } }, branding?: { __typename?: 'BrandingSettings', logo_url?: string | null, hosted_page_title?: string | null, accent_color?: string | null, hosted_page_auto_progress?: boolean | null } | null } };

export type GetMessageQueryVariables = Exact<{
id: Scalars['String'];
Expand Down Expand Up @@ -2707,6 +2710,7 @@ export const GetHostedSessionDocument = gql`
logo_url
hosted_page_title
accent_color
hosted_page_auto_progress
}
}
}
Expand Down

0 comments on commit 0bfca3b

Please sign in to comment.