diff --git a/package.json b/package.json index 51230019..20d7eddc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hosted-pages", - "version": "0.0.57", + "version": "0.0.58", "private": true, "scripts": { "dev": "next dev", @@ -13,7 +13,7 @@ }, "dependencies": { "@apollo/client": "^3.7.2", - "@awell_health/ui-library": "0.1.22", + "@awell_health/ui-library": "0.1.23", "@formsort/react-embed": "^3.1.1", "@sentry/nextjs": "^7.59.3", "date-fns": "^2.29.3", diff --git a/src/components/Form/Form.tsx b/src/components/Form/Form.tsx index ceab1007..b9d42b2c 100644 --- a/src/components/Form/Form.tsx +++ b/src/components/Form/Form.tsx @@ -105,6 +105,7 @@ export const Form: FC = ({ activity }) => { evaluateDisplayConditions={handleEvaluateFormRules} storedAnswers={formProgress} onAnswersChange={handleOnAnswersChange} + autosaveAnswers={branding?.hosted_page_autosave ?? true} /> ) : ( = ({ activity }) => { storedAnswers={formProgress} onAnswersChange={handleOnAnswersChange} autoProgress={branding?.hosted_page_auto_progress ?? false} + autosaveAnswers={branding?.hosted_page_autosave ?? true} /> ) } diff --git a/src/hooks/useForm/graphql/Form.graphql b/src/hooks/useForm/graphql/Form.graphql index eb1aa13f..4c73fff0 100644 --- a/src/hooks/useForm/graphql/Form.graphql +++ b/src/hooks/useForm/graphql/Form.graphql @@ -2,6 +2,7 @@ fragment Form on Form { id title + trademark questions { ...Question } diff --git a/src/hooks/useHostedSession/graphql/getHostedSession.graphql b/src/hooks/useHostedSession/graphql/getHostedSession.graphql index f606ed2c..1b3f0576 100644 --- a/src/hooks/useHostedSession/graphql/getHostedSession.graphql +++ b/src/hooks/useHostedSession/graphql/getHostedSession.graphql @@ -9,6 +9,7 @@ query GetHostedSession { hosted_page_title accent_color hosted_page_auto_progress + hosted_page_autosave } } } diff --git a/src/types/generated/types-orchestration.tsx b/src/types/generated/types-orchestration.tsx index d3703b34..218bbfb6 100644 --- a/src/types/generated/types-orchestration.tsx +++ b/src/types/generated/types-orchestration.tsx @@ -377,8 +377,10 @@ export enum BooleanOperator { export type BrandingSettings = { __typename?: 'BrandingSettings'; accent_color?: Maybe; - /** Auto advance in radio questions in conversational display mode. */ + /** Auto progress to the next question when using the conversational display mode in Awell Hosted Pages. */ hosted_page_auto_progress?: Maybe; + /** Automatically save question answers locally in Awell Hosted Pages */ + hosted_page_autosave?: Maybe; hosted_page_title?: Maybe; logo_url?: Maybe; }; @@ -735,6 +737,7 @@ export type Form = { questions: Array; release_id: Scalars['String']; title: Scalars['String']; + trademark?: Maybe; }; export enum FormDisplayMode { @@ -2188,14 +2191,14 @@ export type GetExtensionActivityDetailsQueryVariables = Exact<{ export type GetExtensionActivityDetailsQuery = { __typename?: 'Query', extensionActivityRecord: { __typename?: 'ExtensionActivityRecordPayload', record: { __typename?: 'ExtensionActivityRecord', id: string, activity_id: string, pathway_id: string, plugin_key: string, plugin_action_key: string, date: string, data_points: Array<{ __typename?: 'ExtensionDataPoint', label: string, value: string }>, fields: Array<{ __typename?: 'ExtensionActionField', id: string, type: ExtensionActionFieldType, label: string, value: string }>, settings?: Array<{ __typename?: 'PluginActionSettingsProperty', value: string, label: string, key: string }> | null } } }; -export type FormFragment = { __typename?: 'Form', id: string, title: string, questions: Array<{ __typename?: 'Question', id: string, title: string, dataPointValueType?: DataPointValueType | null, questionType?: QuestionType | null, userQuestionType?: UserQuestionType | null, options?: Array<{ __typename?: 'Option', id: string, value: number, label: string }> | null, questionConfig?: { __typename?: 'QuestionConfig', recode_enabled?: boolean | null, mandatory: boolean, use_select?: boolean | null, slider?: { __typename?: 'SliderConfig', min: number, max: number, step_value: number, display_marks: boolean, min_label: string, max_label: string, is_value_tooltip_on: boolean, show_min_max_values: boolean } | null } | null }> }; +export type FormFragment = { __typename?: 'Form', id: string, title: string, trademark?: string | null, questions: Array<{ __typename?: 'Question', id: string, title: string, dataPointValueType?: DataPointValueType | null, questionType?: QuestionType | null, userQuestionType?: UserQuestionType | null, options?: Array<{ __typename?: 'Option', id: string, value: number, label: string }> | null, questionConfig?: { __typename?: 'QuestionConfig', recode_enabled?: boolean | null, mandatory: boolean, use_select?: boolean | null, slider?: { __typename?: 'SliderConfig', min: number, max: number, step_value: number, display_marks: boolean, min_label: string, max_label: string, is_value_tooltip_on: boolean, show_min_max_values: boolean } | null } | null }> }; export type GetFormQueryVariables = Exact<{ id: Scalars['String']; }>; -export type GetFormQuery = { __typename?: 'Query', form: { __typename?: 'FormPayload', form?: { __typename?: 'Form', id: string, title: string, questions: Array<{ __typename?: 'Question', id: string, title: string, dataPointValueType?: DataPointValueType | null, questionType?: QuestionType | null, userQuestionType?: UserQuestionType | null, options?: Array<{ __typename?: 'Option', id: string, value: number, label: string }> | null, questionConfig?: { __typename?: 'QuestionConfig', recode_enabled?: boolean | null, mandatory: boolean, use_select?: boolean | null, slider?: { __typename?: 'SliderConfig', min: number, max: number, step_value: number, display_marks: boolean, min_label: string, max_label: string, is_value_tooltip_on: boolean, show_min_max_values: boolean } | null } | null }> } | null } }; +export type GetFormQuery = { __typename?: 'Query', form: { __typename?: 'FormPayload', form?: { __typename?: 'Form', id: string, title: string, trademark?: string | null, questions: Array<{ __typename?: 'Question', id: string, title: string, dataPointValueType?: DataPointValueType | null, questionType?: QuestionType | null, userQuestionType?: UserQuestionType | null, options?: Array<{ __typename?: 'Option', id: string, value: number, label: string }> | null, questionConfig?: { __typename?: 'QuestionConfig', recode_enabled?: boolean | null, mandatory: boolean, use_select?: boolean | null, slider?: { __typename?: 'SliderConfig', min: number, max: number, step_value: number, display_marks: boolean, min_label: string, max_label: string, is_value_tooltip_on: boolean, show_min_max_values: boolean } | null } | null }> } | null } }; export type GetFormResponseQueryVariables = Exact<{ pathway_id: Scalars['String']; @@ -2222,7 +2225,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, hosted_page_auto_progress?: boolean | 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, hosted_page_autosave?: boolean | null } | null } }; export type GetMessageQueryVariables = Exact<{ id: Scalars['String']; @@ -2315,6 +2318,7 @@ export const FormFragmentDoc = gql` fragment Form on Form { id title + trademark questions { ...Question } @@ -2711,6 +2715,7 @@ export const GetHostedSessionDocument = gql` hosted_page_title accent_color hosted_page_auto_progress + hosted_page_autosave } } } diff --git a/yarn.lock b/yarn.lock index 284e1b6f..c9b4c42d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -66,16 +66,17 @@ dependencies: node-fetch "^2.6.1" -"@awell_health/ui-library@0.1.21": - version "0.1.21" - resolved "https://registry.yarnpkg.com/@awell_health/ui-library/-/ui-library-0.1.21.tgz#9561e5e93152ed81abe4278edd267f409ea1ed31" - integrity sha512-CKKuNXsbNoyyOXngVfSAOfkmQhnQgsau6b/C/SqXp6HdneIrsFVF94+1vK1vihwf2qyLg2CBhPDZ3WmY4ZAzhQ== +"@awell_health/ui-library@0.1.23": + version "0.1.23" + resolved "https://registry.yarnpkg.com/@awell_health/ui-library/-/ui-library-0.1.23.tgz#42ddd78827819acdc1a2d0ccb39a808a3afed714" + integrity sha512-FXypceEwa7S417wzWCqb7GqrwGyZhcmYR2r6BpEaCZG7WU2jdJBLqJVocww2k/oTs2iLXIqJEb9QahKkDo9n4g== dependencies: "@calcom/embed-react" "^1.0.10" "@heroicons/react" "^2.0.13" cloudinary-core "^2.13.0" date-fns "^2.29.1" dompurify "^2.4.0" + dotenv "^16.3.1" escape-html "^1.0.3" html-react-parser "^3.0.1" react-date-picker "^8.4.0" @@ -2545,6 +2546,11 @@ dotenv@^16.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.1.tgz#8f8f9d94876c35dac989876a5d3a82a267fdce1d" integrity sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ== +dotenv@^16.3.1: + version "16.3.1" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" + integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== + dset@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/dset/-/dset-3.1.2.tgz#89c436ca6450398396dc6538ea00abc0c54cd45a"