@@ -7,12 +7,14 @@ const products = {
77 info : 'Build a phone, tablet, wearable, or desktop app' ,
88 question : 'What do you need to develop?' ,
99 id : 'app' ,
10+ aliases : [ 'all-apps' ] ,
1011 subtypes : {
1112 App : {
1213 brief : 'Apps' ,
1314 details : 'Build apps for mobile, web, or wearables' ,
1415 icon : 'product-app-app' ,
15- id : 'application_development'
16+ id : 'application_development' ,
17+ aliases : [ 'app' , 'application_development' ]
1618 }
1719 }
1820 } ,
@@ -21,33 +23,38 @@ const products = {
2123 info : 'Design and build the high-impact pages for your blog, online store, or company' ,
2224 question : 'What do you need to develop?' ,
2325 id : 'website' ,
26+ aliases : [ 'all-websites' ] ,
2427 subtypes : {
2528 Website : {
2629 brief : 'Websites' ,
2730 details : 'Build responsive or regular websites' ,
2831 icon : 'product-website-website' ,
29- id : 'website_development'
32+ id : 'website_development' ,
33+ aliases : [ 'website' , 'website_development' ]
3034 }
3135 }
3236 } ,
3337 Chatbot : {
3438 icon : 'product-cat-chatbot' ,
3539 info : 'Build, train and test a custom conversation for your chatbot' ,
3640 question : 'What do you need to develop?' ,
37- id : 'all-chatbots' ,
41+ id : 'chatbot' ,
42+ aliases : [ 'all-chatbots' ] ,
3843 subtypes : {
3944 'Watson Chatbot' : {
4045 brief : 'Watson Chatbot' ,
4146 details : 'Build Chatbot using IBM Watson' ,
4247 icon : 'product-chatbot-watson' ,
4348 id : 'watson_chatbot' ,
49+ aliases : [ 'watson_chatbot' ] ,
4450 hidden : true
4551 } ,
4652 Chatbot : {
4753 brief : 'Chatbot' ,
4854 details : 'Build, train and test a custom conversation for your chat bot' ,
4955 icon : 'product-chatbot-chatbot' ,
50- id : 'chatbot'
56+ id : 'generic_chatbot' ,
57+ aliases : [ 'chatbot' , 'generic_chatbot' ]
5158 }
5259 }
5360 } ,
@@ -56,38 +63,44 @@ const products = {
5663 info : 'Pick the right design project for your needs - wireframes, visual, or other' ,
5764 question : 'What kind of design do you need?' ,
5865 id : 'visual_design' ,
66+ aliases : [ 'all-designs' ] ,
5967 subtypes : {
6068 Wireframes : {
6169 brief : '10-15 screens' ,
6270 details : 'Plan and explore the navigation and structure of your app' ,
6371 icon : 'product-design-wireframes' ,
64- id : 'wireframes'
72+ id : 'wireframes' ,
73+ aliases : [ 'wireframes' ]
6574 } ,
6675 'App Visual Design - Concepts' : {
6776 brief : '1-15 screens' ,
6877 details : 'Visualize and test your app requirements and ideas' ,
6978 icon : 'product-design-app-visual' ,
7079 id : 'visual_design_concepts' ,
80+ aliases : [ 'visual_design_concepts' ] ,
7181 disabled : true
7282 } ,
7383 'Visual Design' : {
7484 brief : '1-15 screens' ,
7585 details : 'Create development-ready designs' ,
7686 icon : 'product-design-app-visual' ,
77- id : 'visual_design_prod'
87+ id : 'visual_design_prod' ,
88+ aliases : [ 'visual-design' , 'visual_design_prod' ]
7889 } ,
7990 Infographic : {
8091 brief : 'Infographic' ,
8192 details : 'Present your data in an easy-to-understand and interesting way' ,
8293 icon : 'product-design-infographic' ,
8394 id : 'infographic' ,
95+ aliases : [ 'infographic' ] ,
8496 disabled : true
8597 } ,
8698 'Other Design' : {
8799 brief : 'other designs' ,
88100 details : 'Get help with other types of design' ,
89101 icon : 'product-design-other' ,
90- id : 'generic_design'
102+ id : 'generic_design' ,
103+ aliases : [ 'generic-design' , 'generic_design' ]
91104 }
92105 }
93106 } ,
@@ -96,31 +109,36 @@ const products = {
96109 info : 'Get help with any part of your development lifecycle' ,
97110 question : 'What kind of development do you need?' ,
98111 id : 'app_dev' ,
112+ aliases : [ 'all-development' ] ,
99113 subtypes : {
100114 'Front-end Prototype' : {
101115 brief : '3-20 screens' ,
102116 details : 'Translate designs to a web (HTML/CSS/JavaScript) or mobile prototype' ,
103117 icon : 'product-dev-prototype' ,
104118 id : 'visual_prototype' ,
119+ aliases : [ 'visual-prototype' , 'visual_prototype' ] ,
105120 disabled : true
106121 } ,
107122 'Front-end' : {
108123 brief : '' ,
109124 details : 'Translate your designs into Web or Mobile front-end' ,
110125 icon : 'product-dev-front-end-dev' ,
111- id : 'frontend_dev'
126+ id : 'frontend_dev' ,
127+ aliases : [ 'frontend-development' , 'frontend_dev' ]
112128 } ,
113129 'Back-end & API' : {
114130 brief : '' ,
115131 details : 'Build the server, DB, and API for your app' ,
116132 icon : 'product-dev-integration' ,
117- id : 'api_dev'
133+ id : 'api_dev' ,
134+ aliases : [ 'api-development' , 'api_dev' ]
118135 } ,
119136 'Development Integration' : {
120137 brief : 'Tasks or adhoc' ,
121138 details : 'Get help with any part of your app or software' ,
122139 icon : 'product-dev-other' ,
123- id : 'generic_dev'
140+ id : 'generic_dev' ,
141+ aliases : [ 'generic-development' , 'generic_dev' ]
124142 }
125143 }
126144 } ,
@@ -129,46 +147,53 @@ const products = {
129147 info : 'Exploratory Testing, Cross browser-device Testing' ,
130148 question : 'What kind of quality assurance (QA) do you need?' ,
131149 id : 'quality_assurance' ,
150+ aliases : [ 'all-quality-assurance' ] ,
132151 subtypes : {
133152 'Real World Testing' : {
134153 brief : 'TBD' ,
135154 details : 'Exploratory Testing, Cross browser-device Testing' ,
136155 icon : 'product-qa-crowd-testing' ,
137- id : 'real_world_testing'
156+ id : 'real_world_testing' ,
157+ aliases : [ 'real-world-testing' , 'real_world_testing' ]
138158 } ,
139159 'Mobility Testing' : {
140160 brief : 'TBD' ,
141161 details : 'App Certification, Lab on Hire, User Sentiment Analysis' ,
142162 icon : 'product-qa-mobility-testing' ,
143163 id : 'mobility_testing' ,
164+ aliases : [ 'mobility-testing' , 'mobility_testing' ] ,
144165 disabled : true
145166 } ,
146167 'Website Performance' : {
147168 brief : 'TBD' ,
148169 details : 'Webpage rendering effiency, Load, Stress and Endurance Test' ,
149170 icon : 'product-qa-website-performance' ,
150171 id : 'website_performance' ,
172+ aliases : [ 'website-performance' , 'website_performance' ] ,
151173 disabled : true
152174 } ,
153175 'Digital Accessability' : {
154176 brief : 'TBD' ,
155177 details : 'Make sure you app or website conforms to all rules and regulations' ,
156178 icon : 'product-qa-digital-accessability' ,
157179 id : 'digital_accessability' ,
180+ aliases : [ 'digital-accessability' , 'digital_accessability' ] ,
158181 disabled : true
159182 } ,
160183 'Open Source Automation' : {
161184 brief : 'TBD' ,
162185 details : 'Exploratory testing, cross browser testing' ,
163186 icon : 'product-qa-os-automation' ,
164187 id : 'open_source_automation' ,
188+ aliases : [ 'open-source-automation' , 'open_source_automation' ] ,
165189 disabled : true
166190 } ,
167191 'Consulting & Adivisory' : {
168192 brief : 'TBD' ,
169193 details : 'Expert services to get your project covered end-to-end' ,
170194 icon : 'product-qa-consulting' ,
171195 id : 'consulting_adivisory' ,
196+ aliases : [ 'consulting-adivisory' , 'consulting_adivisory' ] ,
172197 disabled : true
173198 }
174199 }
@@ -180,34 +205,54 @@ export default products
180205// exports all project types as an array
181206export const projectTypes = _ . mapValues ( products , ( p , key ) => ( { ...p , name : key } ) )
182207
183- export function findProduct ( product ) {
184- if ( product === 'generic_dev' ) {
185- return 'Development'
186- }
187- if ( product === 'generic_design' ) {
188- return 'Design'
189- }
208+ /**
209+ * Finds product for the given product id. It compares the given value against product id and aliases.
210+ *
211+ * @param {string } productId id of the product.
212+ * @param {boolean } aliasesOnly flag to limit the search to aliases only
213+ *
214+ * @return {object } product object from the catalouge
215+ */
216+ export function findProduct ( productId , aliasesOnly = false ) {
190217 for ( const pType in products ) {
191218 for ( const prd in products [ pType ] . subtypes ) {
192- if ( products [ pType ] . subtypes [ prd ] . id === product ) {
193- return prd
219+ const subType = products [ pType ] . subtypes [ prd ]
220+ if ( ( subType . id === productId && ! aliasesOnly ) || ( subType . aliases && subType . aliases . indexOf ( productId ) !== - 1 ) ) {
221+ return { ...subType , name : prd }
194222 }
195223 }
196224 }
197225}
198226
199- export function findCategory ( categoryId ) {
227+ /**
228+ * Finds project category for the given category id. It compares the given value against id and aliases.
229+ *
230+ * @param {string } categoryId id of the category.
231+ * @param {boolean } aliasesOnly flag to limit the search to aliases only
232+ *
233+ * @return {object } project category object from the catalouge
234+ */
235+ export function findCategory ( categoryId , aliasesOnly = false ) {
200236 for ( const key in products ) {
201- if ( products [ key ] . id === categoryId && ! products [ key ] . disabled ) {
202- return { ...products [ key ] , name : key }
237+ const product = products [ key ]
238+ if ( ! product . disabled && ( ( product . id === categoryId && ! aliasesOnly ) || ( product . aliases && product . aliases . indexOf ( categoryId ) !== - 1 ) ) ) {
239+ return { ...product , name : key }
203240 }
204241 }
205242 return null
206243}
207244
208- export function findProductsOfCategory ( category , fetchHidden = true ) {
245+ /**
246+ * Finds products of the given category id. Never returns disabled products
247+ *
248+ * @param {string } categoryId id of the category.
249+ * @param {boolean } fetchHidden flag to limit the hidden products
250+ *
251+ * @return {Array } non disabled products of the given category from the catalouge
252+ */
253+ export function findProductsOfCategory ( categoryId , fetchHidden = true ) {
209254 for ( const pType in products ) {
210- if ( products [ pType ] . id === category ) {
255+ if ( products [ pType ] . id === categoryId ) {
211256 const ret = [ ]
212257 for ( const prd in products [ pType ] . subtypes ) {
213258 const product = products [ pType ] . subtypes [ prd ]
@@ -220,11 +265,19 @@ export function findProductsOfCategory(category, fetchHidden = true) {
220265 }
221266}
222267
223- export function findProductCategory ( product ) {
268+ /**
269+ * Finds project category for the given product id. It compares the given value against id and aliases.
270+ *
271+ * @param {string } productId id of the category.
272+ * @param {boolean } aliasesOnly flag to limit the search to aliases only
273+ *
274+ * @return {object } project category object, from the catalouge, for the given product
275+ */
276+ export function findProductCategory ( productId , aliasesOnly = false ) {
224277 for ( const pType in products ) {
225278 for ( const prd in products [ pType ] . subtypes ) {
226279 const subType = products [ pType ] . subtypes [ prd ]
227- if ( subType . id === product && ! subType . disabled ) {
280+ if ( ! subType . disabled && ( ( subType . id === productId && ! aliasesOnly ) || ( subType . aliases && subType . aliases . indexOf ( productId ) !== - 1 ) ) ) {
228281 return { ...products [ pType ] , name : pType }
229282 }
230283 }
0 commit comments