From 34456c37e6e93f15606a601a84a85bed009bb7af Mon Sep 17 00:00:00 2001
From: Thomas Kranitsas
\r\nOnce signed, you will be automatically added to the NDA terms of use and notified by email. \r\n
',agreed:!1,docusignTemplateId:"fake-template-id",serverInformation:{serverName:"TopCoder API",apiVersion:"0.0.1",requestDuration:4,currentTime:1504891122158},requesterInformation:{id:"d9994de712597c11d1caad64996d9fa0d9b4aa2c-w2VCwwGwnN6EeyhK",remoteIP:"12.34.56.789",receivedParams:{apiVersion:"v2",termsOfUseId:"21153",action:"getTermsOfUse"}}}},function(e){e.exports={terms:[{termsOfUseId:21193,title:"Standard Terms for Topcoder Competitions v2.1",url:"",agreeabilityType:"Electronically-agreeable",templateId:null},{termsOfUseId:21153,title:"Appirio NDA v2.0",url:"http://community.topcoder.com/tc?module=Terms&tuid=21153",agreeabilityType:"DocuSignable",templateId:"fake-template-id"}],serverInformation:{serverName:"Topcoder API",apiVersion:"0.0.1",requestDuration:11471,currentTime:1504879510947},requesterInformation:{id:"456f987dee6e9823179c8184fd3509ffdf9c613a-FyefLdEpb8UHgFQF",remoteIP:"12.34.567.890",receivedParams:{role:"Submitter",noauth:"true",apiVersion:"v2",challengeId:"30059255",action:"getChallengeTerms"}}}},function(e){e.exports={terms:[{termsOfUseId:21153,title:"Appirio NDA v2.0",url:"http://community.topcoder.com/tc?module=Terms&tuid=21153",agreeabilityType:"DocuSignable",agreed:!1,templateId:"fake-template-id"},{termsOfUseId:20704,title:"Standard Reviewer Terms v1.0",url:"",agreeabilityType:"Electronically-agreeable",agreed:!1,templateId:null}],serverInformation:{serverName:"Topcoder API",apiVersion:"0.0.1",requestDuration:29,currentTime:1504878884618},requesterInformation:{id:"1b37607c519c318194ce6da08c519c0a3f7c9855-7FSFCyd6oSX2mV6Z",remoteIP:"12.34.567.890",receivedParams:{role:"Submitter",apiVersion:"v2",challengeId:"30059255",action:"getChallengeTerms"}}}},function(e){e.exports={termsOfUseId:20704,title:"Standard Reviewer Terms v1.0",url:"",text:'THESE ARE THE TERMS AND CONDITIONS ("TERMS") UNDER WHICH YOU AGREE TO WORK UNDER AS A TOPCODER REVIEW BOARD MEMBER. THESE TERMS AND CONDITIONS AFFECT YOUR RIGHTS AND YOU SHOULD READ THEM CAREFULLY BEFORE AGREEING TO THEM. IN THESE TERMS AND CONDITIONS, "WE," "US," "ITS" AND "OUR" REFER TO TOPCODER, INC. AND "YOU" AND "YOUR" REFER TO YOU.
\r\n\r\nIt is understood that We need, and You have, expertise in evaluating and critiquing software designs and/or software development solutions. Furthermore, You agree that You are ready, willing, and able to undertake the performance of evaluating and critiquing such software designs and/or software development solutions submitted to Us, and You agree to assign and transfer your rights as a result of performing such services.
\r\n\r\nIn consideration of the premises and the mutual promises and covenants set forth herein, and for other good and valuable consideration, the receipt and sufficiency of which are hereby acknowledged, the parties agree as follows:
\r\n\r\nAs used in these Terms, the following capitalized terms shall have the following meanings unless otherwise indicated:
\r\n\r\n1.1.\t"Development(s)" shall mean any idea, design, concept, development, component, algorithm, process, method, formula, code, software, technique, technology, discovery or improvement, whether or not patentable, made, conceived, created, discovered, invented or reduced to practice by You in connection with the performance of services hereunder.
\r\n\r\n1.2.\t"Intellectual Property Rights" shall mean all intellectual property rights worldwide arising under statutory or common law or by contract and whether or not perfected, now existing or hereafter filed, issued or acquired, including all patent rights; all rights associated with works of authorship including copyrights and moral rights; rights relating to the protection of trade secrets and confidential information; and any right analogous to those set forth herein and any other proprietary rights relating to intangible property, other than Trademarks.
\r\n\r\n1.3.\t"TopCoder Information" shall mean TopCoder\'s and TopCoder Software\'s specifications, descriptions, architecture, plans, interfaces, and code for TopCoder\'s and TopCoder Software\'s hardware, software, and web site; TopCoder\'s competitions and competition operation procedures; TopCoder\'s and TopCoder Software\'s business and operational plans; and derivatives of the foregoing. The TopCoder Information shall be Confidential Information hereunder.
\r\n\r\n1.4.\t"Software Component" shall mean all software and related materials, technology and documentation (including without limitation design documents, source code and object code) to be evaluated and assessed by You for Us hereunder in accordance with our requirements, as set forth herein and in other documents provided by Us. The Software Component shall be Confidential Information hereunder.
\r\n\r\n2.1\tYou hereby agree to provide services relating to the evaluation and assessment of the Software Component. You agree to perform such services according to and in conformity with the following specifications, in addition to any specifications and/or scheduled provided by Us in our sole discretion (the "Services"):
\r\n\r\n2.2\tYou agree to commit sufficient time and resources to perform the Services according to the schedule set forth by Us. You shall promptly notify Us of any circumstances, as such circumstances arise, that may reasonably be anticipated to lead to a material deviation from the schedule.
\r\n\r\n2.3\tYou agree to keep Us updated, promptly upon our request, of any progress, problems, and/or developments of which You are aware regarding the Services. We shall have the right to require such updates in writing from You in a format specified by Us or acceptable to Us in our sole discretion. You shall conduct and conclude the Services in a professional manner.
\r\n\r\n3.1\tFee. In consideration for performance of the Services required by You, We shall pay You the fee set forth on TopCoder\'s website and/or in other correspondence from Us to You (the "Fee"). The Fee shall be in U.S. Dollars and may be paid in installments, as set forth on our website or in other correspondence from Us. The Fee shall be paid upon the conclusion of the review period, and once completed scorecards have been received, provided the completed scorecards are submitted to Us by the deadline as set forth on the website and/or in the correspondence from Us.
\r\n\r\n3.2\tRoyalty Payments.
\r\n \r\n(a)\tDefinitions. As used in this Section 3, the following capitalized terms shall have the following meanings unless otherwise indicated:
\r\n(b)\tIn consideration of Your evaluation of the Software Components and performance of Your obligations hereunder, We may pay to You a royalty (the "Royalty Payment"). The Royalty Payment to be paid shall be a portion of the Royalty Pool. The Royalty Pool shall be distributed as follows:
\r\n\r\n3.3\tTotal Payment. The sum of the Fee and the Royalty Payments shall be the total payment due to You. Any and all out-of-pocket expenses incurred by You in connection with performing the obligations hereunder are your sole responsibility. We will not reimburse You for any expenses incurred.
\r\n\r\n3.4\tYou shall not be entitled to receive any other compensation or any benefits from Us in connection with the Services. Except as otherwise required by law, We shall not withhold any sums or payments made to You for social security or other federal, state or local tax liabilities or contributions, and all withholdings, liabilities, and contributions shall be solely your responsibility. Further, You understand and agree that the Services are not covered under the unemployment compensation laws and are not intended to be covered by workers\' compensation laws.
\r\n\r\n4.1\tYou hereby acknowledge and agree that We own, solely and exclusively, all right, title and interest, including all Intellectual Property Rights, in and to the TopCoder Information. In addition, You hereby irrevocably and unconditionally transfer and assign to Us all right, title and interest You had, have, may have or acquire in or to all Developments and Software Components, and You agree to execute and deliver such documents, certificates, assignments and other writings, and take such other actions as may be necessary or desirable to vest in Us the ownership rights granted to Us hereunder.
\r\n\r\n4.2\tYou further agree that any and all works of authorship created, authored or developed by You hereunder shall be deemed to be "works made for hire" within the meaning of the United States Copyright Law and, as such, all rights therein including copyright shall belong solely and exclusively to Us from the time of their creation. To the extent any such work of authorship may not be deemed to be a work made for hire, You agree to, and do hereby, irrevocably and unconditionally transfer and assign to Us all right, title and interest including copyright in and to such work.
\r\n\r\n4.3\tYou agree that if We are unable, because of your unavailability, or for any other reason, to secure your signature to apply for or to pursue any application for any United States or foreign patents, mask work, copyright or trademark registrations covering the assignments to Us above, then You hereby irrevocably designates and appoints Us and your duly authorized officers and agents as your agent and attorney in fact, to act for and in your behalf and stead to execute and file any such applications and to do all other lawfully permitted acts to further the prosecution and issuance of patents, copyright, mask work and trademark registrations thereon with the same legal force and effect as if executed by your authorized agent.
\r\n\r\n4.4\tAll Intellectual Property Rights owned by a party as of the date You agree to these Terms shall remain the property of such party and no licenses or other rights with respect to such intellectual property are granted to the other party except as expressly set forth herein.
\r\n\r\n4.5\tNothing in these terms shall be construed as granting You any right or license under any of our Intellectual Property Right (including any rights We may have in any patents, copyrights, trademarks, service marks or any trade secrets), by implication, estoppel or otherwise, except as expressly set forth herein.
\r\n\r\n5.1\t"Confidential Information" shall mean any information, in whatever form, provided by Us to You with obligation of confidentiality, or designated by Us in writing as confidential, proprietary or marked with words of like import when provided to You, and information orally conveyed if We state at the time of oral conveyance or promptly thereafter that such information is confidential. Notwithstanding anything to the contrary contained herein, information about or relating to our software, our system interfaces, our hardware and software architecture, our business, operational and marketing plans, our member lists and database, all information and technology provided by Us to You to enable You to perform your obligations hereunder, TopCoder Information, and any and all Developments shall be considered Confidential Information.
\r\n\r\n5.2\tConfidential Information shall not include information which (a) was in your possession without confidentiality restriction prior to disclosure by Us hereunder; (b) at or after the time of disclosure by Us becomes generally available to the public through no act or omission on our part; (c) is developed by You independently of and without reference to any Confidential Information You receive from Us; or (d) has come into your possession without confidentiality restriction from a third party and such third party is under no obligation to Us to maintain the confidentiality of such information.
\r\n\r\n5.3\tYou acknowledge the confidential and proprietary nature of Confidential Information and agree (i) to hold Confidential Information in confidence and to take all reasonable precautions to protect such Confidential Information (including, without limitation, all precautions You employ with respect to your own confidential materials), (ii) not to divulge any such Confidential Information to any third person; and (iii) not to make any use whatsoever of such Confidential Information except as expressly authorized herein.
\r\n\r\n5.4\tIn the event You are ordered to disclose Confidential Information pursuant to a judicial or government request, requirement or order, You shall promptly notify Us and upon our request, You shall, at our expense, take reasonable steps to assist Us in contesting such request, requirement or order or in otherwise protecting our rights prior to disclosure.
\r\n\r\n5.5\tYou agree not to reproduce or copy by any means Confidential Information, except as reasonably required to perform the Services. Upon termination of your performance of the Services as a review board member, your right to use Confidential Information shall immediately terminate. In addition, upon such termination, or upon demand by Us at any time, You shall return promptly to Us or destroy, at our option, all tangible materials and computer data that disclose or embody Confidential Information.
\r\n\r\n5.6\tYou agree that any breach of these terms by You could cause irreparable damage to Us. In view of the difficulties of placing a monetary value on the Confidential Information, We shall have, in addition to any and all remedies of law, the right to an injunction or other equitable relief, and may be entitled to a preliminary and final injunction without the necessity of posting any bond or undertaking in connection therewith to prevent any further breach or further unauthorized use of Confidential Information. This remedy is separate from any other remedy We may have.
\r\n\r\n6.1\tYou represent and warrant that:\r\n
7.1\tYou shall indemnify, hold harmless and defend Us and our customers from and against any and all suits, actions, damages, costs, losses, expenses (including settlement awards and reasonable attorneys\' fees) and other liabilities arising from or in connection with any claim alleging that, to your knowledge, any Development and/or Software Component violates any trade secret right, or infringes any copyright, patent, trademark, or other intellectual property interest, in any country, and shall pay all costs and damages awarded. We shall promptly notify You of any such claim of which We are aware.
\r\n\r\n7.2\tYour obligations shall not extend to any claim for violation or infringement resulting solely from your compliance with any specific or direct written instructions from Us if such infringement would have been avoided but for such compliance.
\r\n\r\n8.1\tBoth parties expressly agree and understand that You are an independent contractor and nothing herein nor the services rendered hereunder is meant, or shall be construed in any way or manner, to create a relationship of employer and employee, principal and agent, partners or any other relationship other than that of independent parties contracting with each other solely for the purpose of carrying out the provisions of these Terms. Accordingly, You acknowledge and agree that You shall not be entitled to any benefits provided by Us to our employees. You shall be responsible for any and all out-of-pocket expenses incurred in connection with performing the Services. In addition, You shall have sole and exclusive responsibility for the payment of all federal, state and local income taxes, for all employment and disability insurance and for Social Security and other similar taxes with respect to any compensation provided by Us hereunder. You further agree that if We pay or become liable for such taxes or related civil penalties or interest as a result of your failure to pay taxes or report same, or due to our failure to withhold taxes, You shall indemnify and hold us harmless for any such liability. You shall assume and accept all responsibilities which are imposed on independent contractors by any statute, regulation, rule of law, or otherwise. You are not our agent and are not authorized and shall not have the power or authority to bind Us or incur any liability or obligation, or act on behalf of Us. At no time shall You represent that You are our agent, or that any of the views, advice, statements and/or information that may be provided while performing the Services are ours.
\r\n\r\n8.2\tWe are entitled to provide You with general guidance to assist You in completing the scope of work to our satisfaction, You are ultimately responsible for directing and controlling the performance of the task and the scope of work, in accordance with these Terms. You shall use your best efforts, energy and skill in your own name and in such manner as You see fit.
',agreeabilityType:"Electronically-agreeable",serverInformation:{serverName:"Topcoder API",apiVersion:"0.0.1",requestDuration:52,currentTime:1504892902498},requesterInformation:{id:"d8c441f8332161f71533f368c09aeead856e4366-K1RdFai7LCAgXVu5",remoteIP:"12.34.56.78",receivedParams:{apiVersion:"v2",termsOfUseId:"21193",action:"getTermsOfUse"}}}},function(e){e.exports={termsOfUseId:21193,title:"Standard Terms for Topcoder Competitions v2.1",url:"",agreeabilityType:"Electronically-agreeable",text:'\r\n\r\n\r\n\r\n\r\n\r\nBY E-MAIL: | \r\nGC@appirio.com | \r\n
BY MAIL: | \r\nDan Lascell\r\n\r\nTopcoder, Inc.\r\n\r\n760 Market Street\r\n\r\nSan Francisco, CA 94102 | \r\n
BY PHONE: | \r\n(650) 268-9911 | \r\n
\r\nOnce signed, you will be automatically added to the NDA terms of use and notified by email. \r\n
',agreed:!1,docusignTemplateId:"fake-template-id",serverInformation:{serverName:"TopCoder API",apiVersion:"0.0.1",requestDuration:4,currentTime:1504891122158},requesterInformation:{id:"d9994de712597c11d1caad64996d9fa0d9b4aa2c-w2VCwwGwnN6EeyhK",remoteIP:"12.34.56.789",receivedParams:{apiVersion:"v2",termsOfUseId:"21153",action:"getTermsOfUse"}}}},function(e){e.exports={terms:[{termsOfUseId:21193,title:"Standard Terms for Topcoder Competitions v2.1",url:"",agreeabilityType:"Electronically-agreeable",templateId:null},{termsOfUseId:21153,title:"Appirio NDA v2.0",url:"http://community.topcoder.com/tc?module=Terms&tuid=21153",agreeabilityType:"DocuSignable",templateId:"fake-template-id"}],serverInformation:{serverName:"Topcoder API",apiVersion:"0.0.1",requestDuration:11471,currentTime:1504879510947},requesterInformation:{id:"456f987dee6e9823179c8184fd3509ffdf9c613a-FyefLdEpb8UHgFQF",remoteIP:"12.34.567.890",receivedParams:{role:"Submitter",noauth:"true",apiVersion:"v2",challengeId:"30059255",action:"getChallengeTerms"}}}},function(e){e.exports={terms:[{termsOfUseId:21153,title:"Appirio NDA v2.0",url:"http://community.topcoder.com/tc?module=Terms&tuid=21153",agreeabilityType:"DocuSignable",agreed:!1,templateId:"fake-template-id"},{termsOfUseId:20704,title:"Standard Reviewer Terms v1.0",url:"",agreeabilityType:"Electronically-agreeable",agreed:!1,templateId:null}],serverInformation:{serverName:"Topcoder API",apiVersion:"0.0.1",requestDuration:29,currentTime:1504878884618},requesterInformation:{id:"1b37607c519c318194ce6da08c519c0a3f7c9855-7FSFCyd6oSX2mV6Z",remoteIP:"12.34.567.890",receivedParams:{role:"Submitter",apiVersion:"v2",challengeId:"30059255",action:"getChallengeTerms"}}}},function(e){e.exports={termsOfUseId:20704,title:"Standard Reviewer Terms v1.0",url:"",text:'THESE ARE THE TERMS AND CONDITIONS ("TERMS") UNDER WHICH YOU AGREE TO WORK UNDER AS A TOPCODER REVIEW BOARD MEMBER. THESE TERMS AND CONDITIONS AFFECT YOUR RIGHTS AND YOU SHOULD READ THEM CAREFULLY BEFORE AGREEING TO THEM. IN THESE TERMS AND CONDITIONS, "WE," "US," "ITS" AND "OUR" REFER TO TOPCODER, INC. AND "YOU" AND "YOUR" REFER TO YOU.
\r\n\r\nIt is understood that We need, and You have, expertise in evaluating and critiquing software designs and/or software development solutions. Furthermore, You agree that You are ready, willing, and able to undertake the performance of evaluating and critiquing such software designs and/or software development solutions submitted to Us, and You agree to assign and transfer your rights as a result of performing such services.
\r\n\r\nIn consideration of the premises and the mutual promises and covenants set forth herein, and for other good and valuable consideration, the receipt and sufficiency of which are hereby acknowledged, the parties agree as follows:
\r\n\r\nAs used in these Terms, the following capitalized terms shall have the following meanings unless otherwise indicated:
\r\n\r\n1.1.\t"Development(s)" shall mean any idea, design, concept, development, component, algorithm, process, method, formula, code, software, technique, technology, discovery or improvement, whether or not patentable, made, conceived, created, discovered, invented or reduced to practice by You in connection with the performance of services hereunder.
\r\n\r\n1.2.\t"Intellectual Property Rights" shall mean all intellectual property rights worldwide arising under statutory or common law or by contract and whether or not perfected, now existing or hereafter filed, issued or acquired, including all patent rights; all rights associated with works of authorship including copyrights and moral rights; rights relating to the protection of trade secrets and confidential information; and any right analogous to those set forth herein and any other proprietary rights relating to intangible property, other than Trademarks.
\r\n\r\n1.3.\t"TopCoder Information" shall mean TopCoder\'s and TopCoder Software\'s specifications, descriptions, architecture, plans, interfaces, and code for TopCoder\'s and TopCoder Software\'s hardware, software, and web site; TopCoder\'s competitions and competition operation procedures; TopCoder\'s and TopCoder Software\'s business and operational plans; and derivatives of the foregoing. The TopCoder Information shall be Confidential Information hereunder.
\r\n\r\n1.4.\t"Software Component" shall mean all software and related materials, technology and documentation (including without limitation design documents, source code and object code) to be evaluated and assessed by You for Us hereunder in accordance with our requirements, as set forth herein and in other documents provided by Us. The Software Component shall be Confidential Information hereunder.
\r\n\r\n2.1\tYou hereby agree to provide services relating to the evaluation and assessment of the Software Component. You agree to perform such services according to and in conformity with the following specifications, in addition to any specifications and/or scheduled provided by Us in our sole discretion (the "Services"):
\r\n\r\n2.2\tYou agree to commit sufficient time and resources to perform the Services according to the schedule set forth by Us. You shall promptly notify Us of any circumstances, as such circumstances arise, that may reasonably be anticipated to lead to a material deviation from the schedule.
\r\n\r\n2.3\tYou agree to keep Us updated, promptly upon our request, of any progress, problems, and/or developments of which You are aware regarding the Services. We shall have the right to require such updates in writing from You in a format specified by Us or acceptable to Us in our sole discretion. You shall conduct and conclude the Services in a professional manner.
\r\n\r\n3.1\tFee. In consideration for performance of the Services required by You, We shall pay You the fee set forth on TopCoder\'s website and/or in other correspondence from Us to You (the "Fee"). The Fee shall be in U.S. Dollars and may be paid in installments, as set forth on our website or in other correspondence from Us. The Fee shall be paid upon the conclusion of the review period, and once completed scorecards have been received, provided the completed scorecards are submitted to Us by the deadline as set forth on the website and/or in the correspondence from Us.
\r\n\r\n3.2\tRoyalty Payments.
\r\n \r\n(a)\tDefinitions. As used in this Section 3, the following capitalized terms shall have the following meanings unless otherwise indicated:
\r\n(b)\tIn consideration of Your evaluation of the Software Components and performance of Your obligations hereunder, We may pay to You a royalty (the "Royalty Payment"). The Royalty Payment to be paid shall be a portion of the Royalty Pool. The Royalty Pool shall be distributed as follows:
\r\n\r\n3.3\tTotal Payment. The sum of the Fee and the Royalty Payments shall be the total payment due to You. Any and all out-of-pocket expenses incurred by You in connection with performing the obligations hereunder are your sole responsibility. We will not reimburse You for any expenses incurred.
\r\n\r\n3.4\tYou shall not be entitled to receive any other compensation or any benefits from Us in connection with the Services. Except as otherwise required by law, We shall not withhold any sums or payments made to You for social security or other federal, state or local tax liabilities or contributions, and all withholdings, liabilities, and contributions shall be solely your responsibility. Further, You understand and agree that the Services are not covered under the unemployment compensation laws and are not intended to be covered by workers\' compensation laws.
\r\n\r\n4.1\tYou hereby acknowledge and agree that We own, solely and exclusively, all right, title and interest, including all Intellectual Property Rights, in and to the TopCoder Information. In addition, You hereby irrevocably and unconditionally transfer and assign to Us all right, title and interest You had, have, may have or acquire in or to all Developments and Software Components, and You agree to execute and deliver such documents, certificates, assignments and other writings, and take such other actions as may be necessary or desirable to vest in Us the ownership rights granted to Us hereunder.
\r\n\r\n4.2\tYou further agree that any and all works of authorship created, authored or developed by You hereunder shall be deemed to be "works made for hire" within the meaning of the United States Copyright Law and, as such, all rights therein including copyright shall belong solely and exclusively to Us from the time of their creation. To the extent any such work of authorship may not be deemed to be a work made for hire, You agree to, and do hereby, irrevocably and unconditionally transfer and assign to Us all right, title and interest including copyright in and to such work.
\r\n\r\n4.3\tYou agree that if We are unable, because of your unavailability, or for any other reason, to secure your signature to apply for or to pursue any application for any United States or foreign patents, mask work, copyright or trademark registrations covering the assignments to Us above, then You hereby irrevocably designates and appoints Us and your duly authorized officers and agents as your agent and attorney in fact, to act for and in your behalf and stead to execute and file any such applications and to do all other lawfully permitted acts to further the prosecution and issuance of patents, copyright, mask work and trademark registrations thereon with the same legal force and effect as if executed by your authorized agent.
\r\n\r\n4.4\tAll Intellectual Property Rights owned by a party as of the date You agree to these Terms shall remain the property of such party and no licenses or other rights with respect to such intellectual property are granted to the other party except as expressly set forth herein.
\r\n\r\n4.5\tNothing in these terms shall be construed as granting You any right or license under any of our Intellectual Property Right (including any rights We may have in any patents, copyrights, trademarks, service marks or any trade secrets), by implication, estoppel or otherwise, except as expressly set forth herein.
\r\n\r\n5.1\t"Confidential Information" shall mean any information, in whatever form, provided by Us to You with obligation of confidentiality, or designated by Us in writing as confidential, proprietary or marked with words of like import when provided to You, and information orally conveyed if We state at the time of oral conveyance or promptly thereafter that such information is confidential. Notwithstanding anything to the contrary contained herein, information about or relating to our software, our system interfaces, our hardware and software architecture, our business, operational and marketing plans, our member lists and database, all information and technology provided by Us to You to enable You to perform your obligations hereunder, TopCoder Information, and any and all Developments shall be considered Confidential Information.
\r\n\r\n5.2\tConfidential Information shall not include information which (a) was in your possession without confidentiality restriction prior to disclosure by Us hereunder; (b) at or after the time of disclosure by Us becomes generally available to the public through no act or omission on our part; (c) is developed by You independently of and without reference to any Confidential Information You receive from Us; or (d) has come into your possession without confidentiality restriction from a third party and such third party is under no obligation to Us to maintain the confidentiality of such information.
\r\n\r\n5.3\tYou acknowledge the confidential and proprietary nature of Confidential Information and agree (i) to hold Confidential Information in confidence and to take all reasonable precautions to protect such Confidential Information (including, without limitation, all precautions You employ with respect to your own confidential materials), (ii) not to divulge any such Confidential Information to any third person; and (iii) not to make any use whatsoever of such Confidential Information except as expressly authorized herein.
\r\n\r\n5.4\tIn the event You are ordered to disclose Confidential Information pursuant to a judicial or government request, requirement or order, You shall promptly notify Us and upon our request, You shall, at our expense, take reasonable steps to assist Us in contesting such request, requirement or order or in otherwise protecting our rights prior to disclosure.
\r\n\r\n5.5\tYou agree not to reproduce or copy by any means Confidential Information, except as reasonably required to perform the Services. Upon termination of your performance of the Services as a review board member, your right to use Confidential Information shall immediately terminate. In addition, upon such termination, or upon demand by Us at any time, You shall return promptly to Us or destroy, at our option, all tangible materials and computer data that disclose or embody Confidential Information.
\r\n\r\n5.6\tYou agree that any breach of these terms by You could cause irreparable damage to Us. In view of the difficulties of placing a monetary value on the Confidential Information, We shall have, in addition to any and all remedies of law, the right to an injunction or other equitable relief, and may be entitled to a preliminary and final injunction without the necessity of posting any bond or undertaking in connection therewith to prevent any further breach or further unauthorized use of Confidential Information. This remedy is separate from any other remedy We may have.
\r\n\r\n6.1\tYou represent and warrant that:\r\n
7.1\tYou shall indemnify, hold harmless and defend Us and our customers from and against any and all suits, actions, damages, costs, losses, expenses (including settlement awards and reasonable attorneys\' fees) and other liabilities arising from or in connection with any claim alleging that, to your knowledge, any Development and/or Software Component violates any trade secret right, or infringes any copyright, patent, trademark, or other intellectual property interest, in any country, and shall pay all costs and damages awarded. We shall promptly notify You of any such claim of which We are aware.
\r\n\r\n7.2\tYour obligations shall not extend to any claim for violation or infringement resulting solely from your compliance with any specific or direct written instructions from Us if such infringement would have been avoided but for such compliance.
\r\n\r\n8.1\tBoth parties expressly agree and understand that You are an independent contractor and nothing herein nor the services rendered hereunder is meant, or shall be construed in any way or manner, to create a relationship of employer and employee, principal and agent, partners or any other relationship other than that of independent parties contracting with each other solely for the purpose of carrying out the provisions of these Terms. Accordingly, You acknowledge and agree that You shall not be entitled to any benefits provided by Us to our employees. You shall be responsible for any and all out-of-pocket expenses incurred in connection with performing the Services. In addition, You shall have sole and exclusive responsibility for the payment of all federal, state and local income taxes, for all employment and disability insurance and for Social Security and other similar taxes with respect to any compensation provided by Us hereunder. You further agree that if We pay or become liable for such taxes or related civil penalties or interest as a result of your failure to pay taxes or report same, or due to our failure to withhold taxes, You shall indemnify and hold us harmless for any such liability. You shall assume and accept all responsibilities which are imposed on independent contractors by any statute, regulation, rule of law, or otherwise. You are not our agent and are not authorized and shall not have the power or authority to bind Us or incur any liability or obligation, or act on behalf of Us. At no time shall You represent that You are our agent, or that any of the views, advice, statements and/or information that may be provided while performing the Services are ours.
\r\n\r\n8.2\tWe are entitled to provide You with general guidance to assist You in completing the scope of work to our satisfaction, You are ultimately responsible for directing and controlling the performance of the task and the scope of work, in accordance with these Terms. You shall use your best efforts, energy and skill in your own name and in such manner as You see fit.
',agreeabilityType:"Electronically-agreeable",serverInformation:{serverName:"Topcoder API",apiVersion:"0.0.1",requestDuration:52,currentTime:1504892902498},requesterInformation:{id:"d8c441f8332161f71533f368c09aeead856e4366-K1RdFai7LCAgXVu5",remoteIP:"12.34.56.78",receivedParams:{apiVersion:"v2",termsOfUseId:"21193",action:"getTermsOfUse"}}}},function(e){e.exports={termsOfUseId:21193,title:"Standard Terms for Topcoder Competitions v2.1",url:"",agreeabilityType:"Electronically-agreeable",text:'\r\n\r\n\r\n\r\n\r\n\r\nBY E-MAIL: | \r\nGC@appirio.com | \r\n
BY MAIL: | \r\nDan Lascell\r\n\r\nTopcoder, Inc.\r\n\r\n760 Market Street\r\n\r\nSan Francisco, CA 94102 | \r\n
BY PHONE: | \r\n(650) 268-9911 | \r\n
Api
- * [.getApiV3(token)](#module_services.api.getApiV3) ⇒ Api
+ * [.getApi(version, token)](#module_services.api.getApi) ⇒ Api
* _inner_
* [~Api](#module_services.api..Api)
* [new Api(base, token)](#new_module_services.api..Api_new)
@@ -30,30 +29,19 @@ The default export from the module is
[Api](#module_services.api..Api) class.
**Kind**: static property of [services.api
](#module_services.api)
-
+
-### services.api.getApiV2(token) ⇒ Api
-Returns a new or existing Api object for Topcoder API v2.
+### services.api.getApi(version, token) ⇒ Api
+Returns a new or existing Api object for Topcoder API.
**Kind**: static method of [services.api
](#module_services.api)
-**Returns**: Api
- API v2 service object.
+**Returns**: Api
- API service object.
| Param | Type | Description |
| --- | --- | --- |
+| version | String
| The version of the API. |
| token | String
| Optional. Auth token for Topcoder API v2. |
-
-
-### services.api.getApiV3(token) ⇒ Api
-Returns a new or existing Api object for Topcoder API v3
-
-**Kind**: static method of [services.api
](#module_services.api)
-**Returns**: Api
- API v3 service object.
-
-| Param | Type | Description |
-| --- | --- | --- |
-| token | String
| Optional. Auth token for Topcoder API v3. |
-
### services.api~Api
diff --git a/src/actions/auth.js b/src/actions/auth.js
index 4a6752bb..c585ec71 100644
--- a/src/actions/auth.js
+++ b/src/actions/auth.js
@@ -5,7 +5,7 @@
import { createActions } from 'redux-actions';
import { decodeToken } from 'tc-accounts';
-import { getApiV3 } from '../services/api';
+import { getApi } from '../services/api';
/**
* @static
@@ -16,7 +16,7 @@ import { getApiV3 } from '../services/api';
function loadProfileDone(userTokenV3) {
if (!userTokenV3) return Promise.resolve(null);
const user = decodeToken(userTokenV3);
- const api = getApiV3(userTokenV3);
+ const api = getApi('V3', userTokenV3);
return Promise.all([
api.get(`/members/${user.handle}`)
.then(res => res.json()).then(res => (res.result.status === 200 ? res.result.content : {})),
diff --git a/src/actions/challenge.js b/src/actions/challenge.js
index a01d9e9b..f5dfb09b 100644
--- a/src/actions/challenge.js
+++ b/src/actions/challenge.js
@@ -7,7 +7,7 @@ import _ from 'lodash';
import { config } from 'topcoder-react-utils';
import { createActions } from 'redux-actions';
import { getService as getChallengesService } from '../services/challenges';
-import { getApiV2 } from '../services/api';
+import { getApi } from '../services/api';
/**
* @static
@@ -70,7 +70,7 @@ function getSubmissionsInit(challengeId) {
* @return {Action}
*/
function getSubmissionsDone(challengeId, tokenV2) {
- return getApiV2(tokenV2)
+ return getApi('V2', tokenV2)
.fetch(`/challenges/submissions/${challengeId}/mySubmissions`)
.then(response => response.json())
.then(response => ({
@@ -169,7 +169,7 @@ function loadResultsInit(challengeId) {
* @return {Action}
*/
function loadResultsDone(auth, challengeId, type) {
- return getApiV2(auth.tokenV2)
+ return getApi('V2', auth.tokenV2)
.fetch(`/${type}/challenges/result/${challengeId}`)
.then(response => response.json())
.then(response => ({
@@ -194,7 +194,7 @@ function fetchCheckpointsInit() {}
*/
function fetchCheckpointsDone(tokenV2, challengeId) {
const endpoint = `/design/challenges/checkpoint/${challengeId}`;
- return getApiV2(tokenV2).fetch(endpoint)
+ return getApi('V2', tokenV2).fetch(endpoint)
.then((response) => {
if (response.status !== 200) {
throw response.status;
diff --git a/src/actions/smp.js b/src/actions/smp.js
index 07370f5d..9c46f513 100644
--- a/src/actions/smp.js
+++ b/src/actions/smp.js
@@ -5,7 +5,7 @@
import _ from 'lodash';
import { createActions } from 'redux-actions';
-import { getApiV3 } from '../services/api';
+import { getApi } from '../services/api';
/**
* @static
@@ -22,7 +22,7 @@ function deleteSubmissionInit() {}
* @return {Action}
*/
function deleteSubmissionDone(tokenV3, submissionId) {
- return getApiV3(tokenV3).delete(`/submissions/${submissionId}`)
+ return getApi('V3', tokenV3).delete(`/submissions/${submissionId}`)
.then(() => submissionId);
}
diff --git a/src/services/__mocks__/api.js b/src/services/__mocks__/api.js
index 084c3a61..8b7b2a31 100644
--- a/src/services/__mocks__/api.js
+++ b/src/services/__mocks__/api.js
@@ -103,36 +103,32 @@ export default class Api {
}
}
-/**
- * Topcoder API v2.
+/*
+ * Topcoder API
*/
+const lastApiInstances = {};
/**
- * Returns a new or existing Api object for Topcoder API v2.
- * @param {String} token Optional. Auth token for Topcoder API v2.
- * @return {Api} API v2 service object.
+ * Returns a new or existing Api object for Topcoder API.
+ * @param {String} version The API version.
+ * @param {String} token Optional. Auth token for Topcoder API.
+ * @return {Api} API service object.
*/
-let lastApiV2 = null;
-export function getApiV2(token) {
- if (!lastApiV2 || lastApiV2.private.token !== token) {
- lastApiV2 = new Api(config.API.V2, token);
+export function getApi(version, token) {
+ if (!version || !config.API[version]) {
+ throw new Error(`${version} is not a valid API version`);
+ }
+ if (!lastApiInstances[version] || lastApiInstances[version].private.token !== token) {
+ lastApiInstances[version] = new Api(config.API[version], token);
}
- return lastApiV2;
+ return lastApiInstances[version];
}
/**
- * Topcoder API v3.
+ * Keep the old API factories for backwards compatibility
+ * DO NOT USE THEM FOR NEW IMPLEMENTATIONS.
+ * USE THE getApi(version, token) FACTORY.
*/
-
-/**
- * Returns a new or existing Api object for Topcoder API v3
- * @param {String} token Optional. Auth token for Topcoder API v3.
- * @return {Api} API v3 service object.
- */
-let lastApiV3 = null;
-export function getApiV3(token) {
- if (!lastApiV3 || lastApiV3.private.token !== token) {
- lastApiV3 = new Api(config.API.V3, token);
- }
- return lastApiV3;
-}
+export const getApiV2 = token => getApi('V2', token);
+export const getApiV3 = token => getApi('V3', token);
+export const getApiV4 = token => getApi('V4', token);
diff --git a/src/services/__mocks__/challenges.js b/src/services/__mocks__/challenges.js
index 4c18b67a..f881884e 100644
--- a/src/services/__mocks__/challenges.js
+++ b/src/services/__mocks__/challenges.js
@@ -5,7 +5,7 @@
import _ from 'lodash';
import { COMPETITION_TRACKS } from '../../utils/tc';
-import { getApiV2, getApiV3 } from './api';
+import { getApi } from './api';
import sampleApiV3Response from './data/challenges-v3.json';
import sampleApiV3ResponseSingle from './data/challenge-v3.json';
@@ -215,8 +215,8 @@ class ChallengesService {
};
this.private = {
- api: getApiV3(tokenV3),
- apiV2: getApiV2(tokenV2),
+ api: getApi('V3', tokenV3),
+ apiV2: getApi('V2', tokenV2),
getChallenges,
tokenV2,
tokenV3,
diff --git a/src/services/__mocks__/groups.js b/src/services/__mocks__/groups.js
index dedf041d..fdf474aa 100644
--- a/src/services/__mocks__/groups.js
+++ b/src/services/__mocks__/groups.js
@@ -17,7 +17,7 @@
import _ from 'lodash';
import { config } from 'topcoder-react-utils';
-import { getApiV3 } from './api';
+import { getApi } from './api';
import logger from '../../utils/logger';
/* The value of USER_GROUP_MAXAGE constant converted to [ms]. */
@@ -172,7 +172,7 @@ class GroupService {
*/
constructor(tokenV3) {
this.private = {
- api: getApiV3(tokenV3),
+ api: getApi('V3', tokenV3),
tokenV3,
};
}
diff --git a/src/services/api.js b/src/services/api.js
index 7f9fb8ea..7c1e3355 100644
--- a/src/services/api.js
+++ b/src/services/api.js
@@ -236,51 +236,34 @@ class Api {
export default Api;
/*
- * Topcoder API v2.
+ * Topcoder API
*/
+const lastApiInstances = {};
-let lastApiV2 = null;
/**
- * Returns a new or existing Api object for Topcoder API v2.
- * @param {String} token Optional. Auth token for Topcoder API v2.
- * @return {Api} API v2 service object.
+ * Returns a new or existing Api object for Topcoder API.
+ * @param {String} version The API version.
+ * @param {String} token Optional. Auth token for Topcoder API.
+ * @return {Api} API service object.
*/
-export function getApiV2(token) {
- if (!lastApiV2 || lastApiV2.private.token !== token) {
- lastApiV2 = new Api(config.API.V2, token);
+export function getApi(version, token) {
+ if (!version || !config.API[version]) {
+ throw new Error(`${version} is not a valid API version`);
}
- return lastApiV2;
-}
-
-/*
- * Topcoder API v3.
- */
-
-let lastApiV3 = null;
-/**
- * Returns a new or existing Api object for Topcoder API v3
- * @param {String} token Optional. Auth token for Topcoder API v3.
- * @return {Api} API v3 service object.
- */
-export function getApiV3(token) {
- if (!lastApiV3 || lastApiV3.private.token !== token) {
- lastApiV3 = new Api(config.API.V3, token);
+ if (!lastApiInstances[version] || lastApiInstances[version].private.token !== token) {
+ lastApiInstances[version] = new Api(config.API[version], token);
}
- return lastApiV3;
+ return lastApiInstances[version];
}
-let lastApiV4 = null;
/**
- * Returns a new or existing Api object for Topcoder API V4
- * @param {String} token Optional. Auth token for Topcoder API V4.
- * @return {Api} API V4 service object.
+ * Keep the old API factories for backwards compatibility
+ * DO NOT USE THEM FOR NEW IMPLEMENTATIONS.
+ * USE THE getApi(version, token) FACTORY.
*/
-export function getApiV4(token) {
- if (!lastApiV4 || lastApiV4.private.token !== token) {
- lastApiV4 = new Api(config.API.V4, token);
- }
- return lastApiV4;
-}
+export const getApiV2 = token => getApi('V2', token);
+export const getApiV3 = token => getApi('V3', token);
+export const getApiV4 = token => getApi('V4', token);
/**
* Gets a valid TC M2M token, either requesting one from TC Auth0 API, or
diff --git a/src/services/billing.js b/src/services/billing.js
index efd22020..55d974e0 100644
--- a/src/services/billing.js
+++ b/src/services/billing.js
@@ -2,7 +2,7 @@
* @module "services.billing"
* @desc Access to Topcoder billing accounts.
*/
-import { getApiV3 } from './api';
+import { getApi } from './api';
/**
* @static
@@ -21,7 +21,7 @@ class Billing {
*/
constructor(tokenV3) {
this.private = {
- api: getApiV3(tokenV3),
+ api: getApi('V3', tokenV3),
tokenV3,
};
}
diff --git a/src/services/challenges.js b/src/services/challenges.js
index 318478ad..cdf70c47 100644
--- a/src/services/challenges.js
+++ b/src/services/challenges.js
@@ -11,7 +11,7 @@ import { decodeToken } from 'tc-accounts';
import logger from '../utils/logger';
import { setErrorIcon, ERROR_ICON_TYPES } from '../utils/errors';
import { COMPETITION_TRACKS, getApiResponsePayload } from '../utils/tc';
-import { getApiV2, getApiV4 } from './api';
+import { getApi } from './api';
export const ORDER_BY = {
SUBMISSION_END_DATE: 'submissionEndDate',
@@ -19,76 +19,73 @@ export const ORDER_BY = {
/**
* Normalizes a regular challenge details object received from the backend APIs.
- * NOTE: It is possible, that this normalization is not necessary after we
- * have moved to Topcoder API v4, but it is kept for now to minimize a risk of
- * breaking anything.
* @todo Why this one is exported? It should be only used internally!
- * @param {Object} v4 Challenge object received from the /v4/challenges/{id}
+ * @param {Object} challenge Challenge object received from the /challenges/{id}
* endpoint.
- * @param {Object} v4Filtered Challenge object received from the
- * /v4/challenges?filter=id={id} endpoint.
- * @param {Object} v4User Challenge object received from the
- * /v4/members/{username}/challenges?filter=id={id} endpoint.
- * If action was fired for authenticated visitor, v4_user will contain
+ * @param {Object} filtered Challenge object received from the
+ * /challenges?filter=id={id} endpoint.
+ * @param {Object} user Challenge object received from the
+ * /members/{username}/challenges?filter=id={id} endpoint.
+ * If action was fired for authenticated visitor, `user` will contain
* details fetched specifically for the user (thus may include additional
- * data comparing to the standard API v4 response for the challenge details,
- * stored in v4_filtered).
+ * data comparing to the standard API response for the challenge details,
+ * stored in `filtered`).
* @param {String} username Optional.
* @return {Object} Normalized challenge object.
*/
-export function normalizeChallengeDetails(v4, v4Filtered, v4User, username) {
+export function normalizeChallengeDetails(challenge, filtered, user, username) {
// Normalize exising data to make it consistent with the rest of the code
- const challenge = {
- ...v4,
+ const finalChallenge = {
+ ...challenge,
- id: v4.challengeId,
- reliabilityBonus: _.get(v4Filtered, 'reliabilityBonus', 0),
- status: (v4.currentStatus || '').toUpperCase(),
+ id: challenge.challengeId,
+ reliabilityBonus: _.get(filtered, 'reliabilityBonus', 0),
+ status: (challenge.currentStatus || '').toUpperCase(),
allPhases: [],
currentPhases: [],
- name: v4.challengeName || v4.challengeTitle,
- projectId: Number(v4.projectId),
- forumId: Number(v4.forumId),
- introduction: v4.introduction || '',
- detailedRequirements: v4.detailedRequirements === 'null' ? '' : v4.detailedRequirements,
- finalSubmissionGuidelines: v4.finalSubmissionGuidelines === 'null' ? '' : v4.finalSubmissionGuidelines,
- screeningScorecardId: Number(v4.screeningScorecardId),
- reviewScorecardId: Number(v4.reviewScorecardId),
- numberOfCheckpointsPrizes: v4.numberOfCheckpointsPrizes,
- topCheckPointPrize: v4.topCheckPointPrize,
- submissionsViewable: v4.submissionsViewable || 'false',
- reviewType: v4.reviewType,
- allowStockArt: v4.allowStockArt === 'true',
- fileTypes: v4.filetypes || [],
- environment: v4.environment,
- codeRepo: v4.codeRepo,
- forumLink: v4.forumLink,
- submissionLimit: Number(v4.submissionLimit) || 0,
- drPoints: v4.digitalRunPoints,
- directUrl: v4.directUrl,
- technologies: v4.technologies || v4.technology || [],
- platforms: v4.platforms || [],
- prizes: v4.prize || v4.prizes || [],
- events: _.map(v4.event, e => ({
+ name: challenge.challengeName || challenge.challengeTitle,
+ projectId: Number(challenge.projectId),
+ forumId: Number(challenge.forumId),
+ introduction: challenge.introduction || '',
+ detailedRequirements: challenge.detailedRequirements === 'null' ? '' : challenge.detailedRequirements,
+ finalSubmissionGuidelines: challenge.finalSubmissionGuidelines === 'null' ? '' : challenge.finalSubmissionGuidelines,
+ screeningScorecardId: Number(challenge.screeningScorecardId),
+ reviewScorecardId: Number(challenge.reviewScorecardId),
+ numberOfCheckpointsPrizes: challenge.numberOfCheckpointsPrizes,
+ topCheckPointPrize: challenge.topCheckPointPrize,
+ submissionsViewable: challenge.submissionsViewable || 'false',
+ reviewType: challenge.reviewType,
+ allowStockArt: challenge.allowStockArt === 'true',
+ fileTypes: challenge.filetypes || [],
+ environment: challenge.environment,
+ codeRepo: challenge.codeRepo,
+ forumLink: challenge.forumLink,
+ submissionLimit: Number(challenge.submissionLimit) || 0,
+ drPoints: challenge.digitalRunPoints,
+ directUrl: challenge.directUrl,
+ technologies: challenge.technologies || challenge.technology || [],
+ platforms: challenge.platforms || [],
+ prizes: challenge.prize || challenge.prizes || [],
+ events: _.map(challenge.event, e => ({
eventName: e.eventShortDesc,
eventId: e.id,
description: e.eventDescription,
})),
- terms: v4.terms,
- submissions: v4.submissions,
- track: _.toUpper(v4.challengeCommunity),
- subTrack: v4.subTrack,
- checkpoints: v4.checkpoints,
- documents: v4.documents || [],
- numRegistrants: v4.numberOfRegistrants,
- numberOfCheckpointSubmissions: v4.numberOfCheckpointSubmissions,
- registrants: v4.registrants || [],
+ terms: challenge.terms,
+ submissions: challenge.submissions,
+ track: _.toUpper(challenge.challengeCommunity),
+ subTrack: challenge.subTrack,
+ checkpoints: challenge.checkpoints,
+ documents: challenge.documents || [],
+ numRegistrants: challenge.numberOfRegistrants,
+ numberOfCheckpointSubmissions: challenge.numberOfCheckpointSubmissions,
+ registrants: challenge.registrants || [],
};
- // v4 Winners have different field names, needs to be normalized to match v4 filtered and v4
- challenge.winners = _.map(
- v4.winners,
+ // Winners have different field names, needs to be normalized to match `filtered` and `challenge`
+ finalChallenge.winners = _.map(
+ challenge.winners,
(winner, index) => ({
...winner,
handle: winner.submitter,
@@ -96,79 +93,79 @@ export function normalizeChallengeDetails(v4, v4Filtered, v4User, username) {
}),
);
- if (challenge.subTrack === 'MARATHON_MATCH') {
- challenge.track = 'DATA_SCIENCE';
+ if (finalChallenge.subTrack === 'MARATHON_MATCH') {
+ finalChallenge.track = 'DATA_SCIENCE';
}
// It's not clear if this will be the main event, will need to be investigated
- challenge.mainEvent = challenge.events[0] || {};
+ finalChallenge.mainEvent = finalChallenge.events[0] || {};
- /* It's unclear if these normalization steps are still required for V4 */
- // Fill missing data from v4_filtered
- if (v4Filtered) {
+ /* It's unclear if these normalization steps are still required for `challenge` */
+ // Fill missing data from filtered
+ if (filtered) {
const groups = {};
- if (v4Filtered.groupIds) {
- v4Filtered.groupIds.forEach((id) => {
+ if (filtered.groupIds) {
+ filtered.groupIds.forEach((id) => {
groups[id] = true;
});
}
- _.merge(challenge, {
- componentId: v4Filtered.componentId,
- contestId: v4Filtered.contestId,
+ _.merge(finalChallenge, {
+ componentId: filtered.componentId,
+ contestId: filtered.contestId,
- submissionEndDate: v4Filtered.submissionEndDate, // Dates are not correct in v4
- submissionEndTimestamp: v4Filtered.submissionEndDate, // Dates are not correct in v4
+ submissionEndDate: filtered.submissionEndDate, // Dates are not correct in `challenge`
+ submissionEndTimestamp: filtered.submissionEndDate, // Dates are not correct in `challenge`
- /* Taking phases from v4_filtered, because dates are not correct in v4 */
- allPhases: v4Filtered.allPhases || [],
+ /* Taking phases from filtered, because dates are not correct in `challenge` */
+ allPhases: filtered.allPhases || [],
- /* Taking phases from v4_filtered, because dates are not correct in v4 */
- currentPhases: v4Filtered.currentPhases || [],
+ /* Taking phases from filtered, because dates are not correct in `challenge` */
+ currentPhases: filtered.currentPhases || [],
- /* v4 returns incorrect value for numberOfSubmissions for some reason */
- numSubmissions: v4Filtered.numSubmissions,
+ /* `challenge` has incorrect value for numberOfSubmissions for some reason */
+ numSubmissions: filtered.numSubmissions,
groups,
});
}
- // Fill missing data from v4_user
- if (v4User) {
- _.defaults(challenge, {
- userDetails: v4User.userDetails,
+ // Fill missing data from user
+ if (user) {
+ _.defaults(finalChallenge, {
+ userDetails: user.userDetails,
});
}
// Fill some derived data
const registrationOpen = _.some(
- challenge.allPhases,
+ finalChallenge.allPhases,
phase => phase.phaseType === 'Registration' && phase.phaseStatus === 'Open',
) ? 'Yes' : 'No';
- _.defaults(challenge, {
- communities: new Set([COMPETITION_TRACKS[challenge.track]]),
+ _.defaults(finalChallenge, {
+ communities: new Set([COMPETITION_TRACKS[finalChallenge.track]]),
registrationOpen,
users: username ? { [username]: true } : {},
});
// A hot fix to show submissions for on-going challenges
- if (!challenge.submissions || !challenge.submissions.length) {
- challenge.submissions = challenge.registrants
+ if (!finalChallenge.submissions || !finalChallenge.submissions.length) {
+ finalChallenge.submissions = finalChallenge.registrants
.filter(r => r.submissionDate || '')
.sort((a, b) => (a.submissionDate || '')
.localeCompare(b.submissionDate || ''));
}
- if (!challenge.allPhases) challenge.allPhases = [];
- if (!challenge.track) challenge.track = '';
+ if (!finalChallenge.allPhases) finalChallenge.allPhases = [];
+ if (!finalChallenge.track) finalChallenge.track = '';
- return challenge;
+ return finalChallenge;
}
/**
* Normalizes a regular challenge object received from the backend.
* NOTE: This function is copied from the existing code in the challenge listing
* component. It is possible, that this normalization is not necessary after we
- * have moved to Topcoder API v4, but it is kept for now to minimize a risk of
+ * have moved to Topcoder API, but it is kept for now to minimize a risk of
* breaking anything.
* @todo Should be used only internally!
* @param {Object} challenge Challenge object received from the backend.
@@ -235,7 +232,7 @@ class ChallengesService {
/**
* Private function being re-used in all methods related to getting
* challenges. It handles query-related arguments in the uniform way:
- * @param {String} endpoint API V4 endpoint, where the request will be send.
+ * @param {String} endpoint API endpoint, where the request will be send.
* @param {Object} filters Optional. A map of filters to pass as `filter`
* query parameter (this function takes care to stringify it properly).
* @param {Object} params Optional. A map of any other parameters beside
@@ -260,8 +257,8 @@ class ChallengesService {
};
this.private = {
- api: getApiV4(tokenV3),
- apiV2: getApiV2(tokenV2),
+ api: getApi('V4', tokenV3),
+ apiV2: getApi('V2', tokenV2),
getChallenges,
tokenV2,
tokenV3,
@@ -358,34 +355,34 @@ class ChallengesService {
}
/**
- * Gets challenge details from Topcoder API v4.
- * NOTE: This function also uses API v2 and other v4 endpoints for now, due
+ * Gets challenge details from Topcoder API.
+ * NOTE: This function also uses API v2 and other endpoints for now, due
* to some information is missing or
- * incorrect in the main v4 endpoint. This may change in the future.
+ * incorrect in the main endpoint. This may change in the future.
* @param {Number|String} challengeId
* @return {Promise} Resolves to the challenge object.
*/
async getChallengeDetails(challengeId) {
- const challengeV4 = await this.private.api.get(`/challenges/${challengeId}`)
+ const challenge = await this.private.api.get(`/challenges/${challengeId}`)
.then(checkError).then(res => res.content);
- const challengeV4Filtered = await this.private.getChallenges('/challenges/', { id: challengeId })
+ const challengeFiltered = await this.private.getChallenges('/challenges/', { id: challengeId })
.then(res => res.challenges[0]);
const username = this.private.tokenV3 && decodeToken(this.private.tokenV3).handle;
- const challengeV4User = username && await this.getUserChallenges(username, { id: challengeId })
+ const challengeUser = username && await this.getUserChallenges(username, { id: challengeId })
.then(res => res.challenges[0]).catch(() => null);
- const challenge = normalizeChallengeDetails(
- challengeV4,
- challengeV4Filtered,
- challengeV4User,
+ const finalChallenge = normalizeChallengeDetails(
+ challenge,
+ challengeFiltered,
+ challengeUser,
username,
);
- challenge.fetchedWithAuth = Boolean(this.private.api.private.token);
+ finalChallenge.fetchedWithAuth = Boolean(this.private.api.private.token);
- return challenge;
+ return finalChallenge;
}
/**
diff --git a/src/services/direct.js b/src/services/direct.js
index ac3c60fc..82cda59c 100644
--- a/src/services/direct.js
+++ b/src/services/direct.js
@@ -7,7 +7,7 @@
import qs from 'qs';
-import { getApiV3 } from './api';
+import { getApi } from './api';
/**
* Direct service class.
@@ -21,7 +21,7 @@ class Direct {
*/
constructor(tokenV3) {
this.private = {
- api: getApiV3(tokenV3),
+ api: getApi('V3', tokenV3),
tokenV3,
};
}
diff --git a/src/services/groups.js b/src/services/groups.js
index 65112fa9..a5ddc2a7 100644
--- a/src/services/groups.js
+++ b/src/services/groups.js
@@ -19,7 +19,7 @@
import _ from 'lodash';
import { config } from 'topcoder-react-utils';
import logger from '../utils/logger';
-import { getApiV3 } from './api';
+import { getApi } from './api';
/* The value of USER_GROUP_MAXAGE constant converted to [ms]. */
const USER_GROUP_MAXAGE = config.USER_GROUP_MAXAGE * 1000;
@@ -193,7 +193,7 @@ class GroupService {
constructor(tokenV3) {
const now = Date.now();
this.private = {
- api: getApiV3(tokenV3),
+ api: getApi('V3', tokenV3),
cache: {
groupTreeIds: {
lastCleanUp: now,
diff --git a/src/services/looker.js b/src/services/looker.js
index d0904439..dc0b7960 100644
--- a/src/services/looker.js
+++ b/src/services/looker.js
@@ -1,22 +1,21 @@
/**
* @module "services.looker"
- * @desc This module provides a service to get look data json
- * via API V4.
+ * @desc This module provides a service to get look data json via Topcoder API.
*/
import { getLookerApiResponsePayload } from '../utils/tc';
-import { getApiV4 } from './api';
+import { getApi } from './api';
/**
* Service class.
*/
class LookerService {
/**
- * @param {String} tokenV4 Optional. Auth token for Topcoder API v4.
+ * @param {String} token Optional. Auth token for Topcoder API.
*/
- constructor(tokenV4) {
+ constructor(token) {
this.private = {
- api: getApiV4(tokenV4),
- tokenV4,
+ api: getApi('V4', token),
+ token,
};
}
@@ -34,12 +33,12 @@ class LookerService {
let lastInstance = null;
/**
* Returns a new or existing looker service.
- * @param {String} tokenV4 Optional. Auth token for Topcoder API v4.
+ * @param {String} token Optional. Auth token for Topcoder API.
* @return {LookerService} looker service object
*/
-export function getService(tokenV4) {
- if (!lastInstance || tokenV4 !== lastInstance.private.tokenV4) {
- lastInstance = new LookerService(tokenV4);
+export function getService(token) {
+ if (!lastInstance || token !== lastInstance.private.token) {
+ lastInstance = new LookerService(token);
}
return lastInstance;
}
diff --git a/src/services/lookup.js b/src/services/lookup.js
index 3236f1f8..2b98bf8b 100644
--- a/src/services/lookup.js
+++ b/src/services/lookup.js
@@ -5,7 +5,7 @@
*/
import qs from 'qs';
import { getApiResponsePayload } from '../utils/tc';
-import { getApiV3 } from './api';
+import { getApi } from './api';
class LookupService {
/**
@@ -13,7 +13,7 @@ class LookupService {
*/
constructor(tokenV3) {
this.private = {
- api: getApiV3(tokenV3),
+ api: getApi('V3', tokenV3),
tokenV3,
};
}
diff --git a/src/services/members.js b/src/services/members.js
index a9f04091..0e573dc9 100644
--- a/src/services/members.js
+++ b/src/services/members.js
@@ -9,7 +9,7 @@ import _ from 'lodash';
import qs from 'qs';
import logger from '../utils/logger';
import { getApiResponsePayload } from '../utils/tc';
-import { getApiV3 } from './api';
+import { getApi } from './api';
/**
* Service class.
@@ -20,7 +20,7 @@ class MembersService {
*/
constructor(tokenV3) {
this.private = {
- api: getApiV3(tokenV3),
+ api: getApi('V3', tokenV3),
tokenV3,
};
}
diff --git a/src/services/reviewOpportunities.js b/src/services/reviewOpportunities.js
index e4aa4260..6c37bf12 100644
--- a/src/services/reviewOpportunities.js
+++ b/src/services/reviewOpportunities.js
@@ -3,7 +3,7 @@
* @desc This module provides a service for retrieving Review Opportunities and
* submitting applications.
*/
-import { getApiV3 } from './api';
+import { getApi } from './api';
/**
* Service class.
@@ -14,7 +14,7 @@ class ReviewOpportunitiesService {
*/
constructor(tokenV3) {
this.private = {
- api: getApiV3(tokenV3),
+ api: getApi('V3', tokenV3),
tokenV3,
};
}
diff --git a/src/services/terms.js b/src/services/terms.js
index 84945a6f..b34e62e1 100644
--- a/src/services/terms.js
+++ b/src/services/terms.js
@@ -8,7 +8,7 @@ import _ from 'lodash';
import { config } from 'topcoder-react-utils';
import { getService as getCommunityService } from './communities';
-import { getApiV2 } from './api';
+import { getApi } from './api';
/**
* Service class.
@@ -19,7 +19,7 @@ class TermsService {
*/
constructor(tokenV2) {
this.private = {
- api: getApiV2(tokenV2),
+ api: getApi('V2', tokenV2),
tokenV2,
};
}
diff --git a/src/services/user-traits.js b/src/services/user-traits.js
index 693b590b..c1d71b71 100644
--- a/src/services/user-traits.js
+++ b/src/services/user-traits.js
@@ -5,7 +5,7 @@
*/
import toCapitalCase from 'to-capital-case';
import { getApiResponsePayload } from '../utils/tc';
-import { getApiV3 } from './api';
+import { getApi } from './api';
/**
* Service class.
@@ -16,7 +16,7 @@ class UserTraitsService {
*/
constructor(tokenV3) {
this.private = {
- api: getApiV3(tokenV3),
+ api: getApi('V3', tokenV3),
tokenV3,
};
}
diff --git a/src/services/user.js b/src/services/user.js
index 89a97427..13ec5948 100644
--- a/src/services/user.js
+++ b/src/services/user.js
@@ -7,7 +7,7 @@ import { config, isomorphy } from 'topcoder-react-utils';
import logger from '../utils/logger';
import { getApiResponsePayload } from '../utils/tc';
-import { getApiV2, getApiV3 } from './api';
+import { getApi } from './api';
let auth0;
@@ -112,8 +112,8 @@ class User {
*/
constructor(tokenV3, tokenV2) {
this.private = {
- api: getApiV3(tokenV3),
- apiV2: getApiV2(tokenV2),
+ api: getApi('V3', tokenV3),
+ apiV2: getApi('V2', tokenV2),
tokenV2,
tokenV3,
};