|
| 1 | +import _ from 'lodash' |
| 2 | +// import { Icons } from 'appirio-tech-react-components' |
| 3 | +import { findProduct} from '../projectWizard' |
| 4 | + |
| 5 | +const isFileRequired = (project, subSections) => { |
| 6 | + const subSection = _.find(subSections, (s) => s.type === 'questions') |
| 7 | + const fields = _.filter(subSection.questions, q => q.type.indexOf('see-attached') > -1) |
| 8 | + // iterate over all seeAttached type fields to check |
| 9 | + // if any see attached is checked. |
| 10 | + return _.some(_.map( |
| 11 | + _.map(fields, 'fieldName'), |
| 12 | + fn => _.get(project, `${fn}.seeAttached`) |
| 13 | + )) |
| 14 | +} |
| 15 | + |
| 16 | +const sections = [ |
| 17 | + { |
| 18 | + id: 'appDefinition', |
| 19 | + title: (project, showProduct) => { |
| 20 | + const product = _.get(project, 'details.products[0]') |
| 21 | + if (showProduct && product) { |
| 22 | + const prd = findProduct(product) |
| 23 | + if (prd) return prd.name |
| 24 | + } |
| 25 | + return 'Definition' |
| 26 | + }, |
| 27 | + required: true, |
| 28 | + description: 'Please answer a few basic questions about your project. You can also provide the needed information in a supporting document--add a link in the notes section or upload it below.', |
| 29 | + subSections: [ |
| 30 | + { |
| 31 | + id: 'projectName', |
| 32 | + required: true, |
| 33 | + validationError: 'Please provide a name for your project', |
| 34 | + fieldName: 'name', |
| 35 | + description: '', |
| 36 | + title: 'Project Name', |
| 37 | + type: 'project-name' |
| 38 | + }, |
| 39 | + { |
| 40 | + id: 'questions', |
| 41 | + required: true, |
| 42 | + hideTitle: true, |
| 43 | + title: 'Questions', |
| 44 | + description: '', |
| 45 | + type: 'questions', |
| 46 | + questions: [ |
| 47 | + { |
| 48 | + id: 'projectInfo', |
| 49 | + fieldName: 'description', |
| 50 | + description: 'Brief Description', |
| 51 | + title: 'Description', |
| 52 | + type: 'textbox' |
| 53 | + }, |
| 54 | + { |
| 55 | + icon: 'question', |
| 56 | + title: 'What capabilities does the chatbot need to support?', |
| 57 | + description: '', |
| 58 | + type: 'checkbox-group', |
| 59 | + fieldName: 'details.appDefinition.capabilities', |
| 60 | + options: [ |
| 61 | + {value: 'order_management', label: 'Order Management'}, |
| 62 | + {value: 'information', label: 'Information'}, |
| 63 | + {value: 'help', label: 'Help'}, |
| 64 | + {value: 'complaints', label: 'Complaints'}, |
| 65 | + {value: 'billing', label: 'Billing'}, |
| 66 | + {value: 'account_management', label: 'Account Management'}, |
| 67 | + {value: 'custom', label: 'Custom (please explain in the Notes)'} |
| 68 | + ] |
| 69 | + }, |
| 70 | + { |
| 71 | + icon: 'question', |
| 72 | + title: 'Will the chatbot need to access data from any systems to support the capabilities you listed above? If so, please list the systems below.', |
| 73 | + description: '', |
| 74 | + type: 'textbox', |
| 75 | + fieldName: 'details.appDefinition.integrationSystems' |
| 76 | + }, |
| 77 | + { |
| 78 | + icon: 'question', |
| 79 | + title: 'Do you have any example agent conversations you can provide? If so, please paste them or any links to documents below (you’ll be able to upload documents later).', |
| 80 | + description: '', |
| 81 | + type: 'textbox', |
| 82 | + fieldName: 'details.appDefinition.existingAgentScripts' |
| 83 | + }, |
| 84 | + { |
| 85 | + icon: 'question', |
| 86 | + title: 'Are you planning to transfer conversations to human agents? If so, please list the agents’ communication tools (e.g., Slack, LiveAgent, Intercom, etc.).', |
| 87 | + description: '', |
| 88 | + type: 'textbox', |
| 89 | + fieldName: 'details.appDefinition.transferToHumanAgents' |
| 90 | + } |
| 91 | + ] |
| 92 | + }, |
| 93 | + { |
| 94 | + id: 'notes', |
| 95 | + fieldName: 'details.appDefinition.notes', |
| 96 | + title: 'Notes', |
| 97 | + description: 'Add any other important information regarding your project (e.g., links to documents or existing applications, budget or timing constraints)', |
| 98 | + type: 'notes' |
| 99 | + }, |
| 100 | + { |
| 101 | + id: 'files', |
| 102 | + required: isFileRequired, |
| 103 | + title: (project) => `Project Files (${_.get(project, 'attachments', []).length})` || 'Files', |
| 104 | + description: '', |
| 105 | + type: 'files', |
| 106 | + fieldName: 'attachments' |
| 107 | + } |
| 108 | + ] |
| 109 | + } |
| 110 | +] |
| 111 | + |
| 112 | +export default sections |
| 113 | + |
| 114 | +export const basicSections = [ |
| 115 | + { |
| 116 | + id: 'appDefinition', |
| 117 | + title: '', |
| 118 | + required: true, |
| 119 | + description: 'Please answer a few basic questions about your project and, as an option, add links to supporting documents in the “Notes” section. If you have any files to upload, you’ll be able to do so later.', |
| 120 | + subSections: [ |
| 121 | + { |
| 122 | + id: 'projectName', |
| 123 | + required: true, |
| 124 | + validationError: 'Please provide a name for your project', |
| 125 | + fieldName: 'name', |
| 126 | + description: '', |
| 127 | + title: 'Project Name', |
| 128 | + type: 'project-name' |
| 129 | + }, |
| 130 | + { |
| 131 | + id: 'questions', |
| 132 | + required: true, |
| 133 | + hideTitle: true, |
| 134 | + title: 'Questions', |
| 135 | + description: '', |
| 136 | + type: 'questions', |
| 137 | + questions: [ |
| 138 | + { |
| 139 | + id: 'projectInfo', |
| 140 | + required: true, |
| 141 | + fieldName: 'description', |
| 142 | + validationError: 'Please provide a description', |
| 143 | + description: 'Brief Description', |
| 144 | + title: 'Description', |
| 145 | + type: 'textbox' |
| 146 | + }, |
| 147 | + { |
| 148 | + icon: 'question', |
| 149 | + required: true, |
| 150 | + validationError: 'Please complete this section', |
| 151 | + title: 'What capabilities does the chatbot need to support?', |
| 152 | + description: '', |
| 153 | + type: 'checkbox-group', |
| 154 | + fieldName: 'details.appDefinition.capabilities', |
| 155 | + options: [ |
| 156 | + {value: 'order_management', label: 'Order management'}, |
| 157 | + {value: 'information', label: 'Information'}, |
| 158 | + {value: 'help', label: 'Help'}, |
| 159 | + {value: 'complaints', label: 'Complaints'}, |
| 160 | + {value: 'billing', label: 'Billing'}, |
| 161 | + {value: 'account_management', label: 'Account management'}, |
| 162 | + {value: 'custom', label: 'Custom (please explain in the Notes)'} |
| 163 | + ] |
| 164 | + }, |
| 165 | + { |
| 166 | + icon: 'question', |
| 167 | + required: true, |
| 168 | + validationError: 'Please complete this section', |
| 169 | + title: 'Will the chatbot need to access data from any systems to support the capabilities you listed above? If so, please list the systems below.', |
| 170 | + description: '', |
| 171 | + type: 'textbox', |
| 172 | + fieldName: 'details.appDefinition.integrationSystems' |
| 173 | + }, |
| 174 | + { |
| 175 | + icon: 'question', |
| 176 | + required: true, |
| 177 | + validationError: 'Please complete this section', |
| 178 | + title: 'Do you have any example agent conversations you can provide? If so, please paste them or any links to documents below (you’ll be able to upload documents later).', |
| 179 | + description: '', |
| 180 | + type: 'textbox', |
| 181 | + fieldName: 'details.appDefinition.existingAgentScripts' |
| 182 | + }, |
| 183 | + { |
| 184 | + icon: 'question', |
| 185 | + required: true, |
| 186 | + validationError: 'Please complete this section', |
| 187 | + title: 'Are you planning to transfer conversations to human agents? If so, please list the agents’ communication tools (e.g., Slack, LiveAgent, Intercom, etc.).', |
| 188 | + description: '', |
| 189 | + type: 'textbox', |
| 190 | + fieldName: 'details.appDefinition.transferToHumanAgents' |
| 191 | + } |
| 192 | + ] |
| 193 | + }, |
| 194 | + { |
| 195 | + id: 'notes', |
| 196 | + fieldName: 'details.appDefinition.notes', |
| 197 | + title: 'Notes', |
| 198 | + description: 'Add any other important information regarding your project (e.g., links to documents or existing applications, budget or timing constraints)', |
| 199 | + type: 'notes' |
| 200 | + } |
| 201 | + ] |
| 202 | + } |
| 203 | +] |
0 commit comments