Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wizard: Populate all the environments, update content #1748

Merged
merged 9 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .ddev/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ hooks:
service: app
- exec: 'pm2 stop webpack 2> /dev/null || true && pm2 start --name webpack /usr/local/bin/npm -- run serve:watch'
service: app
- exec: 'pm2 stop storybook 2> /dev/null || true && pm2 start --name storybook /usr/local/bin/npm -- run storybook'
service: app

#hooks:
# post-start:
Expand Down
15 changes: 0 additions & 15 deletions .storybook/main.js

This file was deleted.

6 changes: 0 additions & 6 deletions .storybook/preview-head.html

This file was deleted.

18 changes: 0 additions & 18 deletions .storybook/preview.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Once you've got Ruby installed, install bundler.

## Setup (ddev)

Build/start the containers. This will run the dev-server.js and webpack in watch mode in two PM2 services. You can view the site: https://foia.gov.ddev.site/ (Storybook is at: http://foia.gov.ddev.site:6006/)
Build/start the containers. This will run the dev-server.js and webpack in watch mode in two PM2 services. You can view the site: https://foia.gov.ddev.site/

$ ddev start

Expand Down
26 changes: 13 additions & 13 deletions js/models/wizard_extra_messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
* @type {Record<string, string>}
*/
const extraMessages = {
q1: 'Are you looking for your own records?',
q2: 'Select the type of immigration or travel record you are seeking from the list below.',
q3: 'Select the type of IRS record you are seeking from the list below.',
q4: 'Select the type of social security record you are looking for:',
q1: 'Are you seeking your own records?',
q2: 'Select the type of immigration or travel record you are seeking from the list below:',
q3: 'Select the type of IRS record you are seeking from the list below:',
q4: 'Select the type of Social Security record you are seeking from the list below:',
q5: 'Are you a Veteran?',
q6: 'Are you looking for medical records of a Veteran?',
q7: 'Select the type of medical records you are seeking from the list below.',
q8: 'What kind of personnel records are you looking for?',
q9: 'Are you a current or former civilian employee?',
q10: 'Are you looking for records regarding a current or former military servicemember?',
q11: 'Are you seeking to verify the active duty status of a military service member?',
q12: 'Select the type of military record you are looking for:',
q6: 'Are you seeking medical records of a Veteran?',
q7: 'Select the type of medical records you are seeking from the list below:',
q8: 'What kind of personnel records are you seeking?',
q9: 'Are you a current or former/retired civilian federal employee?',
q10: 'Are you seeking records regarding a current or former military servicemember?',
q11: 'Are you seeking to verify the active duty status of a military servicemember?',
q12: 'Select the type of military record you are seeking from the list below:',
a1: 'Yes',
a2: 'No',
a3: 'A-File',
a4: 'A-Number',
a5: 'Naturalization Certificate',
a6: 'Records of apprehension, detention, deportation, legal international travel, illegal attempted entry, expedited removal, voluntary removal, or inspections by Customs and Border Protection (CBP)',
a7: 'Student and Exchange Visitor System Records, medical or other records while someone was detained, bond obligator and investigation records by Immigration Customs Enforcement (ICE)',
a8: 'International Travel Records, including Global Entry and travel history',
a7: 'Student and Exchange Visitor System records, medical or other records while someone was detained, bond obligator and investigation records by Immigration Customs Enforcement (ICE)',
a8: 'International travel records, including Global Entry and travel history',
a9: 'Domestic travel records',
a10: 'Passenger Name Records, which contains certain travel reservation data on individuals',
a11: 'Visa records',
Expand Down
6 changes: 3 additions & 3 deletions js/models/wizard_personnel_records.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const personnelRecordsJourney = question('q8', [
answer(
'literal:Civilian personnel or retirement service history records',
yesNoQuestion('q1', {
topicIfYes: 'Your own civilian personnel or retirement service history record',
topicIfYes: 'Your own civilian personnel or retirement service history record',
topicIfNo: 'Someone else’s civilian personnel or retirement service history record',
yes: question('q9', [
answer('literal:Current', summary('m31'), 'Your own civilian personnel or retirement service history record - current employee'),
answer('literal:Former', summary('m32'), 'Your own civilian personnel or retirement service history record - former employee'),
answer('literal:Current', summary('m31'), 'Your own current civilian personnel service history record'),
answer('literal:Former', summary('m32'), 'Your own former or retired civilian personnel service history record'),
]),
no: continueStep('m2', summary('m33')),
}),
Expand Down
5 changes: 3 additions & 2 deletions js/models/wizard_socsec_records.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ const socsecRecordsJourney = {
next: { type: 'summary', titleMid: 'm22' },
},
{
titleMid: 'startOver',
next: { type: 'start-over' },
titleMid: 'literal:All other social security records',
newDisplayedTopic: 'All other social security records',
next: { type: 'summary', titleMid: 'm48' },
},
],
},
Expand Down
13 changes: 13 additions & 0 deletions js/models/wizard_summaries.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { summary } from '../util/wizard_helpers';

/**
* Default summary that shows user their query plus resources found by the model.
*/
export const defaultSummary = summary();

/**
* Summary if the intent model returns stateOrLocalFlow.
*/
export const stateLocalSummary = summary('m49');

export const stateOrLocalFlow = 'State or Local';
1 change: 1 addition & 0 deletions js/settings/cloud-gov.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const api = {
localApiBaseURL: '/api',
jsonApiBaseURL: 'https://dev-api.foia.gov/api',
requestApiBaseURL: 'https://dev-api.foia.gov/api',
wizardApiURL: 'https://dev-api.foia.gov/doj-foia/models/ZBA2ow0/predict',
// These are not secret, refer to https://github.com/18F/beta.foia.gov/tree/develop/docs/foia-api.md
jsonApiKey: '7aT5REJTpzjKoYKFuc9YIJLalHdYaif6ZqGkDPxG',
};
Expand Down
4 changes: 3 additions & 1 deletion js/settings/ddev.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ const api = {
localApiBaseURL: '/api',
jsonApiBaseURL: 'https://foia-api.ddev.site/api',
requestApiBaseURL: 'https://foia-api.ddev.site/api',
jsonApiKey: 'x-local-key-not-used',
wizardApiURL: 'https://uat-api.foia.gov/doj-foia/models/ZBA2ow0/predict',
// These are not secret, refer to https://github.com/18F/beta.foia.gov/tree/develop/docs/foia-api.md
jsonApiKey: 'PvO2Wh2UppBQqGIxIvdKbogNRI0W0MVLFhkxjWfK',
};

export default {
Expand Down
1 change: 1 addition & 0 deletions js/settings/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const api = {
localApiBaseURL: '/api',
jsonApiBaseURL: 'https://dev-api.foia.gov/api',
requestApiBaseURL: 'https://dev-api.foia.gov/api',
wizardApiURL: 'https://dev-api.foia.gov/doj-foia/models/ZBA2ow0/predict',
// These are not secret, refer to https://github.com/18F/beta.foia.gov/tree/develop/docs/foia-api.md
jsonApiKey: '7aT5REJTpzjKoYKFuc9YIJLalHdYaif6ZqGkDPxG',
};
Expand Down
1 change: 1 addition & 0 deletions js/settings/forum-one.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const api = {
localApiBaseURL: '/api',
jsonApiBaseURL: 'https://api.main-bvxea6i-oafzps2pqxjxw.us-2.platformsh.site/api',
requestApiBaseURL: 'https://api.main-bvxea6i-oafzps2pqxjxw.us-2.platformsh.site/api',
wizardApiURL: 'https://uat-api.foia.gov/doj-foia/models/ZBA2ow0/predict',
// These are not secret, refer to https://github.com/18F/beta.foia.gov/tree/develop/docs/foia-api.md
jsonApiKey: '7aT5REJTpzjKoYKFuc9YIJLalHdYaif6ZqGkDPxG',
};
Expand Down
4 changes: 3 additions & 1 deletion js/settings/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ const api = {
localApiBaseURL: '/api',
jsonApiBaseURL: 'http://local-api.foia.doj.gov/api',
requestApiBaseURL: 'http://local-api.foia.doj.gov/api',
jsonApiKey: 'x-local-key-not-used',
wizardApiURL: 'https://uat-api.foia.gov/doj-foia/models/ZBA2ow0/predict',
// These are not secret, refer to https://github.com/18F/beta.foia.gov/tree/develop/docs/foia-api.md
jsonApiKey: 'PvO2Wh2UppBQqGIxIvdKbogNRI0W0MVLFhkxjWfK',
};

export default {
Expand Down
1 change: 1 addition & 0 deletions js/settings/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const api = {
localApiBaseURL: '/api',
jsonApiBaseURL: 'https://api.foia.gov/api',
requestApiBaseURL: 'https://api.foia.gov/api',
wizardApiURL: 'https://api.foia.gov/doj-foia/models/ZBA2ow0/predict',
// These are not secret, refer to https://github.com/18F/beta.foia.gov/tree/develop/docs/foia-api.md
jsonApiKey: 'mUPoczW5VDRQOvroK6srQIjEGc5xBP0KDHgE34fv',
};
Expand Down
1 change: 1 addition & 0 deletions js/settings/staging.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const api = {
localApiBaseURL: '/api',
jsonApiBaseURL: 'https://stg-api.foia.gov/api',
requestApiBaseURL: 'https://stg-api.foia.gov/api',
wizardApiURL: 'https://stg-api.foia.gov/doj-foia/models/ZBA2ow0/predict',
// These are not secret, refer to https://github.com/18F/beta.foia.gov/tree/develop/docs/foia-api.md
jsonApiKey: 'Ear1funbgPVsgIAvRDZQK4yHq1XrLnrgfUBJM0Su',
};
Expand Down
17 changes: 13 additions & 4 deletions js/stores/wizard_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { fetchWizardInitData, fetchWizardPredictions } from '../util/wizard_api'
import { convertSomeLinksToCards, normalizeScore, urlParams } from '../util/wizard_helpers';
import allTopics from '../models/wizard_topics';
import extraMessages from '../models/wizard_extra_messages';
import { defaultSummary, stateLocalSummary, stateOrLocalFlow } from '../models/wizard_summaries';

const DEFAULT_CONFIDENCE_THRESHOLD = Number(
urlParams().get('confidence-threshold') || 0.5,
Expand Down Expand Up @@ -215,6 +216,7 @@ const useRawWizardStore = create((
let recommendedAgencies = [];
let recommendedLinks = [];
let effectiveTopic = topic;
let isStateOrLocal = false;

if (query && !effectiveTopic) {
nudgeLoading(1);
Expand All @@ -224,9 +226,13 @@ const useRawWizardStore = create((
// the links and agencies anyway.
const { flow } = data.model_output.predefined_flow || {};
if (typeof flow === 'string') {
effectiveTopic = allTopics.find(
(el) => el.title.toUpperCase() === flow.toUpperCase(),
);
if (flow === stateOrLocalFlow) {
isStateOrLocal = true;
} else {
effectiveTopic = allTopics.find(
(el) => el.title.toUpperCase() === flow.toUpperCase(),
);
}
}

// Used to avoid agency duplicates.
Expand Down Expand Up @@ -281,8 +287,11 @@ const useRawWizardStore = create((
nudgeLoading(-1);
}

// We use this if no topic is selected/predicted.
const summary = isStateOrLocal ? stateLocalSummary : defaultSummary;

set(withCapturedHistory({
activity: effectiveTopic ? effectiveTopic.journey : { type: 'summary' },
activity: effectiveTopic ? effectiveTopic.journey : summary,
displayedTopic: effectiveTopic ? effectiveTopic.title : '',
query,
recommendedLinks,
Expand Down
16 changes: 0 additions & 16 deletions js/stories/component_back_link.stories.jsx

This file was deleted.

16 changes: 0 additions & 16 deletions js/stories/component_body_text.stories.jsx

This file was deleted.

23 changes: 0 additions & 23 deletions js/stories/component_button.stories.jsx

This file was deleted.

28 changes: 0 additions & 28 deletions js/stories/component_card.stories.jsx

This file was deleted.

57 changes: 0 additions & 57 deletions js/stories/component_card_group.stories.jsx

This file was deleted.

Loading