@esri/solution-form 1.7.0 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-form - v1.7.0 - Apache-2.0
3
- * Copyright (c) 2018-2022 Esri, Inc.
4
- * Fri Nov 18 2022 08:35:17 GMT-0800 (Pacific Standard Time)
2
+ * @esri/solution-form - v2.0.0-alpha.0 - Apache-2.0
3
+ * Copyright (c) 2018-2023 Esri, Inc.
4
+ * Mon Apr 03 2023 14:01:52 GMT-0700 (Pacific Daylight Time)
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-form - v1.7.0 - Apache-2.0
3
- * Copyright (c) 2018-2022 Esri, Inc.
4
- * Fri Nov 18 2022 08:35:21 GMT-0800 (Pacific Standard Time)
2
+ * @esri/solution-form - v2.0.0-alpha.0 - Apache-2.0
3
+ * Copyright (c) 2018-2023 Esri, Inc.
4
+ * Mon Apr 03 2023 14:01:58 GMT-0700 (Pacific Daylight Time)
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -15,5 +15,5 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-simple-types"),require("@esri/solution-common"),require("@esri/arcgis-rest-request"),require("@esri/arcgis-rest-portal")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-simple-types","@esri/solution-common","@esri/arcgis-rest-request","@esri/arcgis-rest-portal"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution,e.arcgisSolution,e.arcgisRest,e.arcgisRest)}(this,(function(e,t,r,o,n){"use strict";function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=s(r);function u(e){return!!i.getProp(e,"properties.services")}function a(e,t,o){const{item:{title:n,description:s,tags:i,typeKeywords:u},properties:{form:a}}=e,{user:{username:c},portalBaseUrl:m,organization:{basemapGalleryGroupQuery:l,defaultBasemap:{title:p}}}=t,{token:d}=o.toCredential();return r.getPortalDefaultBasemap(l,p,o).then((e=>{const o="Survey-",l=r.getUniqueTitle(`Survey-${n}`,t,"user.folders").replace(o,"");if(a.questions){const t=t=>(t.maps&&(t.maps=t.maps.map((t=>({...t,itemId:e.id})))),t);a.questions=a.questions.map((e=>e.questions?{...e,questions:e.questions.map(t)}:t(e)))}const p=function(e){const t=r.cloneObject(e),o=(e,t)=>(e&&e[t]&&(e[t]=encodeURIComponent(e[t])),e);[["header","content"],["subHeader","content"],["footer","content"],["settings","thankYouScreenContent"]].forEach((([e,r])=>o(t[e],r)));const n=e=>o(e,"description");return t.questions=(t.questions||[]).map((e=>e.questions?{...e,questions:e.questions.map(n)}:n(e))),t}(a);return{description:s,form:p,portalUrl:m,tags:i,title:l,token:d,typeKeywords:u,username:c}}))}function c(e,t,n,s){const i=r.replaceInTemplate(e,t),{survey123Url:u}=t;return a(i,t,n).then((e=>function(e,t="https://survey123.arcgis.com"){const r=`${t}/api/survey/create`,n={credentials:"same-origin",method:"POST",body:o.encodeFormData({f:"json",...e},!0)};return fetch(r,n).then((e=>e.json())).then((e=>{if(!e.success)throw new Error(`Failed to create survey: ${e.error.message}`);return{formId:e.id,featureServiceId:e.featureService.source.itemId,folderId:e.formItemInfo.ownerFolder}}))}(e,u))).then((o=>{const{formId:u,featureServiceId:a}=o;let c=Promise.resolve(null);return e.item.thumbnail&&(c=r.updateItemExtended({id:u},null,n,e.item.thumbnail)),c.then((()=>r.getItemBase(u,n))).then((o=>(t[i.itemId]={itemId:u},t[i.properties.info.serviceInfo.itemId]={itemId:a},s(i.itemId,r.EItemProgressStatus.Finished,i.estimatedDeploymentCostFactor,u),{item:{...e,item:o,itemId:u},id:u,type:"Form",postProcess:!0})))})).catch((e=>{throw s(i.itemId,r.EItemProgressStatus.Failed,0),e}))}e.convertItemToTemplate=function(e,r,o,n,s){return t.simpleTypes.convertItemToTemplate(e,r,o,n,s)},e.createItemFromTemplate=function(e,r,o,n){return u(e)?c(e,r,o,n):t.simpleTypes.createItemFromTemplate(e,r,o,n)},e.postProcess=function(e,t,o,s,i,a,c){return u(s)?function(e,t,o,s,i,u,a){const c=s.properties.info.serviceInfo.itemId,{itemId:m}=u[c],l=r.replaceInTemplate(s,u);return r.getItemBase(m,a).then((t=>{const o=[{id:e,title:l.item.title,snippet:l.item.snippet,extent:l.item.extent,culture:l.item.culture},{id:m,extent:l.item.extent,typeKeywords:[`source-${c}`].concat(t.typeKeywords)}].map((e=>r.updateItem(e,a)));return Promise.all(o).then((()=>{const t=[e,m].map((e=>n.moveItem({itemId:e,folderId:u.folderId,authentication:a})));return Promise.all(t)})).then((()=>r.removeFolder(t.ownerFolder,a))).then((()=>{const e=r.createInitializedItemTemplate(t);return i.push(e),s.dependencies.push(t.id),!0}))}))}(e,0,0,s,i,a,c):r.updateItemTemplateFromDictionary(e,a,c)},Object.defineProperty(e,"__esModule",{value:!0})}));
18
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-simple-types"),require("@esri/solution-common"),require("@esri/arcgis-rest-request"),require("@esri/arcgis-rest-portal")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-simple-types","@esri/solution-common","@esri/arcgis-rest-request","@esri/arcgis-rest-portal"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution,e.arcgisSolution,e.arcgisRest,e.arcgisRest)}(this,(function(e,t,r,o,n){"use strict";function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=s(r);function u(e){return!!i.getProp(e,"properties.services")}function a(e,t,o){const{item:{title:n,description:s,tags:i,typeKeywords:u},properties:{form:a}}=e,{user:{username:c},portalBaseUrl:m,organization:{basemapGalleryGroupQuery:l,defaultBasemap:{title:p}}}=t,{token:d}=o.toCredential();return r.getPortalDefaultBasemap(l,p,o).then((e=>{const o="Survey-",l=r.getUniqueTitle(`${o}${n}`,t,"user.folders").replace(o,"");if(a.questions){const t=t=>(t.maps&&(t.maps=t.maps.map((t=>({...t,itemId:e.id})))),t);a.questions=a.questions.map((e=>e.questions?{...e,questions:e.questions.map(t)}:t(e)))}const p=function(e){const t=r.cloneObject(e),o=(e,t)=>(e&&e[t]&&(e[t]=encodeURIComponent(e[t])),e);[["header","content"],["subHeader","content"],["footer","content"],["settings","thankYouScreenContent"]].forEach((([e,r])=>o(t[e],r)));const n=e=>o(e,"description");return t.questions=(t.questions||[]).map((e=>e.questions?{...e,questions:e.questions.map(n)}:n(e))),t}(a);return{description:s,form:p,portalUrl:m,tags:i,title:l,token:d,typeKeywords:u,username:c}}))}function c(e,t,n,s){const i=r.replaceInTemplate(e,t),{survey123Url:u}=t;return a(i,t,n).then((e=>function(e,t="https://survey123.arcgis.com"){const r=`${t}/api/survey/create`,n={credentials:"same-origin",method:"POST",body:o.encodeFormData({f:"json",...e},!0)};return fetch(r,n).then((e=>e.json())).then((e=>{if(!e.success)throw new Error(`Failed to create survey: ${e.error.message}`);return{formId:e.id,featureServiceId:e.featureService.source.itemId,folderId:e.formItemInfo.ownerFolder}}))}(e,u))).then((o=>{const{formId:u,featureServiceId:a}=o;let c=Promise.resolve(null);return e.item.thumbnail&&(c=r.updateItemExtended({id:u},null,n,e.item.thumbnail)),c.then((()=>r.getItemBase(u,n))).then((o=>(t[i.itemId]={itemId:u},t[i.properties.info.serviceInfo.itemId]={itemId:a},s(i.itemId,r.EItemProgressStatus.Finished,i.estimatedDeploymentCostFactor,u),{item:{...e,item:o,itemId:u},id:u,type:"Form",postProcess:!0})))})).catch((e=>{throw s(i.itemId,r.EItemProgressStatus.Failed,0),e}))}e.convertItemToTemplate=function(e,r,o,n,s){return t.simpleTypes.convertItemToTemplate(e,r,o,n,s)},e.createItemFromTemplate=function(e,r,o,n){return u(e)?c(e,r,o,n):t.simpleTypes.createItemFromTemplate(e,r,o,n)},e.postProcess=function(e,t,o,s,i,a,c){return u(s)?function(e,t,o,s,i,u,a){const c=s.properties.info.serviceInfo.itemId,{itemId:m}=u[c],l=r.replaceInTemplate(s,u);return r.getItemBase(m,a).then((t=>{const o=[{id:e,title:l.item.title,snippet:l.item.snippet,extent:l.item.extent,culture:l.item.culture},{id:m,extent:l.item.extent,typeKeywords:[`source-${c}`].concat(t.typeKeywords)}].map((e=>r.updateItem(e,a)));return Promise.all(o).then((()=>{const t=[e,m].map((e=>n.moveItem({itemId:e,folderId:u.folderId,authentication:a})));return Promise.all(t)})).then((()=>r.removeFolder(t.ownerFolder,a))).then((()=>{const e=r.createInitializedItemTemplate(t);return i.push(e),s.dependencies.push(t.id),!0}))}))}(e,0,0,s,i,a,c):r.updateItemTemplateFromDictionary(e,a,c)},Object.defineProperty(e,"__esModule",{value:!0})}));
19
19
  //# sourceMappingURL=form.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.umd.min.js","sources":["../../src/helpers/is-hub-form-template.ts","../../src/helpers/build-create-params.ts","../../src/helpers/encode-survey-form.ts","../../src/helpers/create-item-from-hub-template.ts","../../src/helpers/create-survey.ts","../../src/convert-item-to-template.ts","../../src/create-item-from-template.ts","../../src/post-process.ts","../../src/helpers/post-process-survey.ts"],"sourcesContent":["/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n/**\r\n * Determines if the given template is a Hub Survey\r\n * template vs Solutions.js Survey template.\r\n *\r\n * @param {IITemTemplate} template A template\r\n * @returns {boolean}\r\n */\r\nexport function isHubFormTemplate(template: common.IItemTemplate): boolean {\r\n // relying on basic duck typing vs adding extraneous props during migration\r\n return !!common.getProp(template, \"properties.services\");\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n UserSession,\r\n getUniqueTitle,\r\n ISurvey123CreateParams,\r\n getPortalDefaultBasemap\r\n} from \"@esri/solution-common\";\r\nimport { encodeSurveyForm } from \"./encode-survey-form\";\r\n\r\n/**\r\n * Utility method for creating Survey123 parameters\r\n *\r\n * @module build-create-params\r\n */\r\n\r\n/**\r\n * Builds the Survey123 create API parameters\r\n *\r\n * @param {IItemTemplate} template The template\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} destinationAuthentication The destination session info\r\n * @returns {Promise<ISurvey123CreateParams>}\r\n */\r\nexport function buildCreateParams(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession\r\n): Promise<ISurvey123CreateParams> {\r\n const {\r\n item: { title: originalTitle, description, tags, typeKeywords },\r\n properties: { form: unencodedForm }\r\n } = template;\r\n const {\r\n user: { username },\r\n portalBaseUrl: portalUrl,\r\n organization: {\r\n basemapGalleryGroupQuery,\r\n defaultBasemap: { title: basemapTitle }\r\n }\r\n } = templateDictionary;\r\n const { token } = destinationAuthentication.toCredential();\r\n return getPortalDefaultBasemap(\r\n basemapGalleryGroupQuery,\r\n basemapTitle,\r\n destinationAuthentication\r\n ).then(defaultBasemap => {\r\n // The S123 API appends \"Survey-\" to the survey title when computing\r\n // the folder name. We need to use the same prefix to successfully\r\n // calculate a unique folder name. Afterwards, we can safely remove the\r\n // prefix from the title\r\n const folderPrefix = \"Survey-\";\r\n const title = getUniqueTitle(\r\n `${folderPrefix}${originalTitle}`,\r\n templateDictionary,\r\n \"user.folders\"\r\n ).replace(folderPrefix, \"\");\r\n // set any map question's basemaps to default org basemap\r\n if (unencodedForm.questions) {\r\n const updateBasemap = (question: any) => {\r\n if (question.maps) {\r\n question.maps = question.maps.map((map: any) => ({\r\n ...map,\r\n itemId: defaultBasemap.id\r\n }));\r\n }\r\n return question;\r\n };\r\n unencodedForm.questions = unencodedForm.questions.map((question: any) =>\r\n !question.questions\r\n ? updateBasemap(question)\r\n : {\r\n ...question,\r\n questions: question.questions.map(updateBasemap)\r\n }\r\n );\r\n }\r\n const form = encodeSurveyForm(unencodedForm);\r\n // intentionally undefined, handled downstream by core logic now\r\n return {\r\n description,\r\n form,\r\n portalUrl,\r\n tags,\r\n title,\r\n token,\r\n typeKeywords,\r\n username\r\n };\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { cloneObject } from \"@esri/solution-common\";\r\n\r\n/**\r\n * Manages Survey123 parameter encoding\r\n *\r\n * @module encode-survey-form\r\n */\r\n\r\n/**\r\n * URI Encodes Survey123 form content parameter\r\n * values\r\n *\r\n * @param {any} form Unencoded form data\r\n * @returns {any} Encoded form data\r\n */\r\nexport const encodeSurveyForm = function encodeForm(form: any) {\r\n const clone = cloneObject(form);\r\n const props = [\r\n [\"header\", \"content\"],\r\n [\"subHeader\", \"content\"],\r\n [\"footer\", \"content\"],\r\n [\"settings\", \"thankYouScreenContent\"]\r\n ];\r\n const encode = (\r\n obj: { [key: string]: string },\r\n key: string\r\n ): { [key: string]: string } => {\r\n if (obj && obj[key]) {\r\n obj[key] = encodeURIComponent(obj[key]);\r\n }\r\n return obj;\r\n };\r\n\r\n // encode props from array above\r\n props.forEach(([objKey, propKey]) => encode(clone[objKey], propKey));\r\n\r\n const encodeQuestion = (question: any) => encode(question, \"description\");\r\n\r\n // encode question descriptions\r\n clone.questions = (clone.questions || []).map((question: any) =>\r\n !question.questions\r\n ? encodeQuestion(question)\r\n : {\r\n ...question,\r\n questions: question.questions.map(encodeQuestion)\r\n }\r\n );\r\n\r\n return clone;\r\n};\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n UserSession,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse,\r\n EItemProgressStatus,\r\n replaceInTemplate,\r\n updateItemExtended,\r\n ISurvey123CreateParams,\r\n ISurvey123CreateResult,\r\n getItemBase\r\n} from \"@esri/solution-common\";\r\nimport { createSurvey } from \"./create-survey\";\r\nimport { buildCreateParams } from \"./build-create-params\";\r\n\r\n/**\r\n * Manages the creation of Surveys from Hub Templates\r\n * via the Survey123 API\r\n *\r\n * @module create-item-from-hub-template\r\n */\r\n\r\n/**\r\n * Orchestrates creation of Surveys from Hub templates\r\n *\r\n * @param {IItemTemplate} template The template\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} destinationAuthentication The destination session info\r\n * @param {Function} itemProgressCallback A progress callback\r\n * @returns {Promise<ICreateItemFromTemplateResponse>}\r\n */\r\nexport function createItemFromHubTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n const interpolatedTemplate = replaceInTemplate(template, templateDictionary);\r\n const { survey123Url } = templateDictionary;\r\n\r\n return buildCreateParams(\r\n interpolatedTemplate,\r\n templateDictionary,\r\n destinationAuthentication\r\n )\r\n .then((params: ISurvey123CreateParams) => {\r\n return createSurvey(params, survey123Url);\r\n })\r\n .then((createSurveyResponse: ISurvey123CreateResult) => {\r\n const { formId, featureServiceId } = createSurveyResponse;\r\n\r\n // Update the item with its thumbnail\r\n let thumbDef: Promise<any> = Promise.resolve(null);\r\n /* istanbul ignore else */\r\n if (template.item.thumbnail) {\r\n thumbDef = updateItemExtended(\r\n { id: formId },\r\n null,\r\n destinationAuthentication,\r\n template.item.thumbnail\r\n );\r\n }\r\n\r\n return thumbDef\r\n .then(() => getItemBase(formId, destinationAuthentication))\r\n .then(item => {\r\n templateDictionary[interpolatedTemplate.itemId] = {\r\n itemId: formId\r\n };\r\n templateDictionary[\r\n interpolatedTemplate.properties.info.serviceInfo.itemId\r\n ] = {\r\n itemId: featureServiceId\r\n };\r\n itemProgressCallback(\r\n interpolatedTemplate.itemId,\r\n EItemProgressStatus.Finished,\r\n interpolatedTemplate.estimatedDeploymentCostFactor,\r\n formId\r\n );\r\n return {\r\n item: {\r\n ...template,\r\n item,\r\n itemId: formId\r\n },\r\n id: formId,\r\n type: \"Form\",\r\n postProcess: true\r\n };\r\n });\r\n })\r\n .catch(e => {\r\n itemProgressCallback(\r\n interpolatedTemplate.itemId,\r\n EItemProgressStatus.Failed,\r\n 0\r\n );\r\n throw e;\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n ISurvey123CreateParams,\r\n ISurvey123CreateResult\r\n} from \"@esri/solution-common\";\r\nimport { encodeFormData } from \"@esri/arcgis-rest-request\";\r\n\r\n/**\r\n * Provides utility method to call Survey123 create endpoint\r\n *\r\n * @module create-survey\r\n */\r\n\r\n/**\r\n * Calls the Survey123 create API with the given parameters\r\n *\r\n * @param {ISurvey123CreateParams} params\r\n * @param {string} [survey123Url=https://survey123.arcgis.com] An optional, Survey123 base URL override\r\n * @throws Will throw if the Survey123 API returns an error response\r\n * @returns {Promise<ISurvey123CreateResult>}\r\n */\r\nexport function createSurvey(\r\n params: ISurvey123CreateParams,\r\n survey123Url = \"https://survey123.arcgis.com\"\r\n): Promise<ISurvey123CreateResult> {\r\n const createUrl = `${survey123Url}/api/survey/create`;\r\n const ro = {\r\n credentials: \"same-origin\" as RequestCredentials,\r\n method: \"POST\",\r\n body: encodeFormData(\r\n {\r\n f: \"json\",\r\n ...params\r\n },\r\n true\r\n )\r\n };\r\n // Using @esri/arcgis-request \"request\" method was resulting in a 404 for\r\n // a CORS preflight request related to this request, but calling fetch directly\r\n // circumvents the issue.\r\n return fetch(createUrl, ro)\r\n .then(response => response.json())\r\n .then(response => {\r\n if (!response.success) {\r\n throw new Error(`Failed to create survey: ${response.error.message}`);\r\n }\r\n return {\r\n formId: response.id,\r\n featureServiceId: response.featureService.source.itemId,\r\n folderId: response.formItemInfo.ownerFolder\r\n };\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation of Form templates\r\n *\r\n * @module convert-item-to-template\r\n */\r\n\r\nimport { UserSession, IItemTemplate } from \"@esri/solution-common\";\r\nimport { simpleTypes } from \"@esri/solution-simple-types\";\r\n\r\n/**\r\n * Creates a template from a Form item\r\n *\r\n * @param {string} solutionItemId The solution item ID\r\n * @param {any} itemInfo: The base item info\r\n * @param {UserSession} destAuthentication Credentials for requests to the destination organization\r\n * @param {UserSession} srcAuthentication Credentials for requests to source items\r\n * @param {any} templateDictionary Hash of facts: folder id, org URL, adlib replacements\r\n * @returns {Promise<IItemTemplate>}\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: UserSession,\r\n srcAuthentication: UserSession,\r\n templateDictionary: any\r\n): Promise<IItemTemplate> {\r\n // Delegate to simple types\r\n return simpleTypes.convertItemToTemplate(\r\n solutionItemId,\r\n itemInfo,\r\n destAuthentication,\r\n srcAuthentication,\r\n templateDictionary\r\n );\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the deployment items from Form templates.\r\n *\r\n * @module create-item-from-template\r\n */\r\n\r\nimport {\r\n UserSession,\r\n IItemTemplate,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse\r\n} from \"@esri/solution-common\";\r\nimport { simpleTypes } from \"@esri/solution-simple-types\";\r\nimport { isHubFormTemplate } from \"./helpers/is-hub-form-template\";\r\nimport { createItemFromHubTemplate } from \"./helpers/create-item-from-hub-template\";\r\n\r\n/**\r\n * Creates a Form item from a template\r\n *\r\n * @param {IItemTemplate} template The template\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} destinationAuthentication The destination user session info\r\n * @param itemProgressCallback An item progress callback\r\n * @returns {Promise<ICreateItemFromTemplateResponse>}\r\n */\r\nexport function createItemFromTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n // Hub Form template custom processing\r\n if (isHubFormTemplate(template)) {\r\n return createItemFromHubTemplate(\r\n template,\r\n templateDictionary,\r\n destinationAuthentication,\r\n itemProgressCallback\r\n );\r\n }\r\n\r\n // otherwise delegate to simple types\r\n return simpleTypes.createItemFromTemplate(\r\n template,\r\n templateDictionary,\r\n destinationAuthentication,\r\n itemProgressCallback\r\n );\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of form item types.\r\n *\r\n * @module post-process\r\n */\r\n\r\nimport {\r\n UserSession,\r\n IItemTemplate,\r\n updateItemTemplateFromDictionary\r\n} from \"@esri/solution-common\";\r\nimport { isHubFormTemplate } from \"./helpers/is-hub-form-template\";\r\nimport { postProcessHubSurvey } from \"./helpers/post-process-survey\";\r\n\r\n/**\r\n * Form post-processing actions\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template type\r\n * @param {any[]} itemInfos Array of \\{id: 'ef3', type: 'Web Map'\\} objects\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns Promise resolving to successfulness of update\r\n */\r\nexport function postProcess(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: IItemTemplate,\r\n templates: IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n if (isHubFormTemplate(template)) {\r\n return postProcessHubSurvey(\r\n itemId,\r\n type,\r\n itemInfos,\r\n template,\r\n templates,\r\n templateDictionary,\r\n authentication\r\n );\r\n }\r\n\r\n return updateItemTemplateFromDictionary(\r\n itemId,\r\n templateDictionary,\r\n authentication\r\n );\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n UserSession,\r\n IItemTemplate,\r\n updateItem,\r\n replaceInTemplate,\r\n getItemBase,\r\n createInitializedItemTemplate,\r\n removeFolder,\r\n IItemUpdate\r\n} from \"@esri/solution-common\";\r\nimport { moveItem } from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Provides utility method to post process Hub surveys\r\n *\r\n * @module post-process-survey\r\n */\r\n\r\n/**\r\n * Performs Survey post processing actions\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template/item type\r\n * @param {any[]} itemInfos An Array of item details\r\n * @param {IItemTemplate} template The template\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns {Promise<any>}\r\n */\r\nexport function postProcessHubSurvey(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: IItemTemplate,\r\n templates: IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n const featureServiceSourceId = template.properties.info.serviceInfo.itemId;\r\n const { itemId: featureServiceResultId } = templateDictionary[\r\n featureServiceSourceId\r\n ];\r\n const interpolated = replaceInTemplate(template, templateDictionary);\r\n return getItemBase(featureServiceResultId, authentication).then(\r\n featureServiceResultBase => {\r\n const itemUpdates = [\r\n // fix/update form properties we couldn't control via the API\r\n {\r\n id: itemId,\r\n title: interpolated.item.title,\r\n snippet: interpolated.item.snippet,\r\n extent: interpolated.item.extent,\r\n culture: interpolated.item.culture\r\n },\r\n // fix/update feature service properties we couldn't control via the API\r\n {\r\n id: featureServiceResultId,\r\n extent: interpolated.item.extent,\r\n typeKeywords: [`source-${featureServiceSourceId}`].concat(\r\n featureServiceResultBase.typeKeywords\r\n )\r\n }\r\n ];\r\n const toUpdatePromise = (updatedItem: IItemUpdate) =>\r\n updateItem(updatedItem, authentication);\r\n const updatePromises = itemUpdates.map(toUpdatePromise);\r\n return Promise.all(updatePromises)\r\n .then(() => {\r\n const itemIdsToMove = [itemId, featureServiceResultId];\r\n const toMovePromise = (id: string) =>\r\n moveItem({\r\n itemId: id,\r\n folderId: templateDictionary.folderId as string,\r\n authentication: authentication\r\n });\r\n const movePromises = itemIdsToMove.map(toMovePromise);\r\n return Promise.all(movePromises);\r\n })\r\n .then(() =>\r\n removeFolder(featureServiceResultBase.ownerFolder, authentication)\r\n )\r\n .then(() => {\r\n // Create a template item for the Feature Service that was created by the API\r\n const featureServiceTemplate = createInitializedItemTemplate(\r\n featureServiceResultBase\r\n );\r\n templates.push(featureServiceTemplate);\r\n template.dependencies.push(featureServiceResultBase.id);\r\n return true;\r\n });\r\n }\r\n );\r\n}\r\n"],"names":["isHubFormTemplate","template","common","getProp","buildCreateParams","templateDictionary","destinationAuthentication","item","title","originalTitle","description","tags","typeKeywords","properties","form","unencodedForm","user","username","portalBaseUrl","portalUrl","organization","basemapGalleryGroupQuery","defaultBasemap","basemapTitle","token","toCredential","getPortalDefaultBasemap","then","folderPrefix","getUniqueTitle","replace","questions","updateBasemap","question","maps","map","itemId","id","clone","cloneObject","encode","obj","key","encodeURIComponent","forEach","objKey","propKey","encodeQuestion","encodeSurveyForm","createItemFromHubTemplate","itemProgressCallback","interpolatedTemplate","replaceInTemplate","survey123Url","params","createUrl","ro","credentials","method","body","encodeFormData","f","fetch","response","json","success","Error","error","message","formId","featureServiceId","featureService","source","folderId","formItemInfo","ownerFolder","createSurvey","createSurveyResponse","thumbDef","Promise","resolve","thumbnail","updateItemExtended","getItemBase","info","serviceInfo","EItemProgressStatus","Finished","estimatedDeploymentCostFactor","type","postProcess","catch","e","Failed","solutionItemId","itemInfo","destAuthentication","srcAuthentication","simpleTypes","convertItemToTemplate","createItemFromTemplate","itemInfos","templates","authentication","featureServiceSourceId","featureServiceResultId","interpolated","featureServiceResultBase","updatePromises","snippet","extent","culture","concat","updatedItem","updateItem","all","movePromises","moveItem","removeFolder","featureServiceTemplate","createInitializedItemTemplate","push","dependencies","postProcessHubSurvey","updateItemTemplateFromDictionary"],"mappings":";;;;;;;;;;;;;;;;;o3BAyBM,SAAUA,EAAkBC,GAEhC,QAASC,EAAOC,QAAQF,EAAU,sBACpC,UCWgBG,EACdH,EACAI,EACAC,GAEA,MACEC,MAAQC,MAAOC,EAAaC,YAAEA,EAAWC,KAAEA,EAAIC,aAAEA,GACjDC,YAAcC,KAAMC,IAClBd,GAEFe,MAAMC,SAAEA,GACRC,cAAeC,EACfC,cAAcC,yBACZA,EACAC,gBAAkBd,MAAOe,KAEzBlB,GACEmB,MAAEA,GAAUlB,EAA0BmB,eAC5C,OAAOC,EAAAA,wBACLL,EACAE,EACAjB,GACAqB,MAAKL,IAKL,MAAMM,EAAe,UACfpB,EAAQqB,EAAcA,eAC1B,UAAkBpB,IAClBJ,EACA,gBACAyB,QAAQF,EAAc,IAExB,GAAIb,EAAcgB,UAAW,CAC3B,MAAMC,EAAiBC,IACjBA,EAASC,OACXD,EAASC,KAAOD,EAASC,KAAKC,KAAKA,IAAc,IAC5CA,EACHC,OAAQd,EAAee,QAGpBJ,GAETlB,EAAcgB,UAAYhB,EAAcgB,UAAUI,KAAKF,GACpDA,EAASF,UAEN,IACGE,EACHF,UAAWE,EAASF,UAAUI,IAAIH,IAHlCA,EAAcC,IAMrB,CACD,MAAMnB,EC7DsB,SAAoBA,GAClD,MAAMwB,EAAQC,cAAYzB,GAOpB0B,EAAS,CACbC,EACAC,KAEID,GAAOA,EAAIC,KACbD,EAAIC,GAAOC,mBAAmBF,EAAIC,KAE7BD,GAbK,CACZ,CAAC,SAAU,WACX,CAAC,YAAa,WACd,CAAC,SAAU,WACX,CAAC,WAAY,0BAaTG,SAAQ,EAAEC,EAAQC,KAAaN,EAAOF,EAAMO,GAASC,KAE3D,MAAMC,EAAkBd,GAAkBO,EAAOP,EAAU,eAY3D,OATA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,CACPjF,OAAQC,EACRoC,SAAUpE,EAAmBoE,SAC7B8B,eAAgBA,MAGpB,OAAOxB,QAAQoC,IAAIC,EAAa,IAEjCzF,MAAK,IACJ2F,EAAYA,aAACX,EAAyBhC,YAAa4B,KAEpD5E,MAAK,KAEJ,MAAM4F,EAAyBC,gCAC7Bb,GAIF,OAFAL,EAAUmB,KAAKF,GACftH,EAASyH,aAAaD,KAAKd,EAAyBtE,KAC7C,CAAI,GACX,GAGV,CD1DWsF,CACLvF,EACAqD,EACAY,EACApG,EACAqG,EACAjG,EACAkG,GAIGqB,mCACLxF,EACA/B,EACAkG,EAEJ"}
1
+ {"version":3,"file":"form.umd.min.js","sources":["../../src/helpers/is-hub-form-template.ts","../../src/helpers/build-create-params.ts","../../src/helpers/encode-survey-form.ts","../../src/helpers/create-item-from-hub-template.ts","../../src/helpers/create-survey.ts","../../src/convert-item-to-template.ts","../../src/create-item-from-template.ts","../../src/post-process.ts","../../src/helpers/post-process-survey.ts"],"sourcesContent":["/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n/**\r\n * Determines if the given template is a Hub Survey\r\n * template vs Solutions.js Survey template.\r\n *\r\n * @param {IITemTemplate} template A template\r\n * @returns {boolean}\r\n */\r\nexport function isHubFormTemplate(template: common.IItemTemplate): boolean {\r\n // relying on basic duck typing vs adding extraneous props during migration\r\n return !!common.getProp(template, \"properties.services\");\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n UserSession,\r\n getUniqueTitle,\r\n ISurvey123CreateParams,\r\n getPortalDefaultBasemap\r\n} from \"@esri/solution-common\";\r\nimport { encodeSurveyForm } from \"./encode-survey-form\";\r\n\r\n/**\r\n * Utility method for creating Survey123 parameters\r\n *\r\n * @module build-create-params\r\n */\r\n\r\n/**\r\n * Builds the Survey123 create API parameters\r\n *\r\n * @param {IItemTemplate} template The template\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} destinationAuthentication The destination session info\r\n * @returns {Promise<ISurvey123CreateParams>}\r\n */\r\nexport function buildCreateParams(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession\r\n): Promise<ISurvey123CreateParams> {\r\n const {\r\n item: { title: originalTitle, description, tags, typeKeywords },\r\n properties: { form: unencodedForm }\r\n } = template;\r\n const {\r\n user: { username },\r\n portalBaseUrl: portalUrl,\r\n organization: {\r\n basemapGalleryGroupQuery,\r\n defaultBasemap: { title: basemapTitle }\r\n }\r\n } = templateDictionary;\r\n const { token } = destinationAuthentication.toCredential();\r\n return getPortalDefaultBasemap(\r\n basemapGalleryGroupQuery,\r\n basemapTitle,\r\n destinationAuthentication\r\n ).then(defaultBasemap => {\r\n // The S123 API appends \"Survey-\" to the survey title when computing\r\n // the folder name. We need to use the same prefix to successfully\r\n // calculate a unique folder name. Afterwards, we can safely remove the\r\n // prefix from the title\r\n const folderPrefix = \"Survey-\";\r\n const title = getUniqueTitle(\r\n `${folderPrefix}${originalTitle}`,\r\n templateDictionary,\r\n \"user.folders\"\r\n ).replace(folderPrefix, \"\");\r\n // set any map question's basemaps to default org basemap\r\n if (unencodedForm.questions) {\r\n const updateBasemap = (question: any) => {\r\n if (question.maps) {\r\n question.maps = question.maps.map((map: any) => ({\r\n ...map,\r\n itemId: defaultBasemap.id\r\n }));\r\n }\r\n return question;\r\n };\r\n unencodedForm.questions = unencodedForm.questions.map((question: any) =>\r\n !question.questions\r\n ? updateBasemap(question)\r\n : {\r\n ...question,\r\n questions: question.questions.map(updateBasemap)\r\n }\r\n );\r\n }\r\n const form = encodeSurveyForm(unencodedForm);\r\n // intentionally undefined, handled downstream by core logic now\r\n return {\r\n description,\r\n form,\r\n portalUrl,\r\n tags,\r\n title,\r\n token,\r\n typeKeywords,\r\n username\r\n };\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { cloneObject } from \"@esri/solution-common\";\r\n\r\n/**\r\n * Manages Survey123 parameter encoding\r\n *\r\n * @module encode-survey-form\r\n */\r\n\r\n/**\r\n * URI Encodes Survey123 form content parameter\r\n * values\r\n *\r\n * @param {any} form Unencoded form data\r\n * @returns {any} Encoded form data\r\n */\r\nexport const encodeSurveyForm = function encodeForm(form: any) {\r\n const clone = cloneObject(form);\r\n const props = [\r\n [\"header\", \"content\"],\r\n [\"subHeader\", \"content\"],\r\n [\"footer\", \"content\"],\r\n [\"settings\", \"thankYouScreenContent\"]\r\n ];\r\n const encode = (\r\n obj: { [key: string]: string },\r\n key: string\r\n ): { [key: string]: string } => {\r\n if (obj && obj[key]) {\r\n obj[key] = encodeURIComponent(obj[key]);\r\n }\r\n return obj;\r\n };\r\n\r\n // encode props from array above\r\n props.forEach(([objKey, propKey]) => encode(clone[objKey], propKey));\r\n\r\n const encodeQuestion = (question: any) => encode(question, \"description\");\r\n\r\n // encode question descriptions\r\n clone.questions = (clone.questions || []).map((question: any) =>\r\n !question.questions\r\n ? encodeQuestion(question)\r\n : {\r\n ...question,\r\n questions: question.questions.map(encodeQuestion)\r\n }\r\n );\r\n\r\n return clone;\r\n};\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n UserSession,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse,\r\n EItemProgressStatus,\r\n replaceInTemplate,\r\n updateItemExtended,\r\n ISurvey123CreateParams,\r\n ISurvey123CreateResult,\r\n getItemBase\r\n} from \"@esri/solution-common\";\r\nimport { createSurvey } from \"./create-survey\";\r\nimport { buildCreateParams } from \"./build-create-params\";\r\n\r\n/**\r\n * Manages the creation of Surveys from Hub Templates\r\n * via the Survey123 API\r\n *\r\n * @module create-item-from-hub-template\r\n */\r\n\r\n/**\r\n * Orchestrates creation of Surveys from Hub templates\r\n *\r\n * @param {IItemTemplate} template The template\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} destinationAuthentication The destination session info\r\n * @param {Function} itemProgressCallback A progress callback\r\n * @returns {Promise<ICreateItemFromTemplateResponse>}\r\n */\r\nexport function createItemFromHubTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n const interpolatedTemplate = replaceInTemplate(template, templateDictionary);\r\n const { survey123Url } = templateDictionary;\r\n\r\n return buildCreateParams(\r\n interpolatedTemplate,\r\n templateDictionary,\r\n destinationAuthentication\r\n )\r\n .then((params: ISurvey123CreateParams) => {\r\n return createSurvey(params, survey123Url);\r\n })\r\n .then((createSurveyResponse: ISurvey123CreateResult) => {\r\n const { formId, featureServiceId } = createSurveyResponse;\r\n\r\n // Update the item with its thumbnail\r\n let thumbDef: Promise<any> = Promise.resolve(null);\r\n /* istanbul ignore else */\r\n if (template.item.thumbnail) {\r\n thumbDef = updateItemExtended(\r\n { id: formId },\r\n null,\r\n destinationAuthentication,\r\n template.item.thumbnail\r\n );\r\n }\r\n\r\n return thumbDef\r\n .then(() => getItemBase(formId, destinationAuthentication))\r\n .then(item => {\r\n templateDictionary[interpolatedTemplate.itemId] = {\r\n itemId: formId\r\n };\r\n templateDictionary[\r\n interpolatedTemplate.properties.info.serviceInfo.itemId\r\n ] = {\r\n itemId: featureServiceId\r\n };\r\n itemProgressCallback(\r\n interpolatedTemplate.itemId,\r\n EItemProgressStatus.Finished,\r\n interpolatedTemplate.estimatedDeploymentCostFactor,\r\n formId\r\n );\r\n return {\r\n item: {\r\n ...template,\r\n item,\r\n itemId: formId\r\n },\r\n id: formId,\r\n type: \"Form\",\r\n postProcess: true\r\n };\r\n });\r\n })\r\n .catch(e => {\r\n itemProgressCallback(\r\n interpolatedTemplate.itemId,\r\n EItemProgressStatus.Failed,\r\n 0\r\n );\r\n throw e;\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n ISurvey123CreateParams,\r\n ISurvey123CreateResult\r\n} from \"@esri/solution-common\";\r\nimport { encodeFormData } from \"@esri/arcgis-rest-request\";\r\n\r\n/**\r\n * Provides utility method to call Survey123 create endpoint\r\n *\r\n * @module create-survey\r\n */\r\n\r\n/**\r\n * Calls the Survey123 create API with the given parameters\r\n *\r\n * @param {ISurvey123CreateParams} params\r\n * @param {string} [survey123Url=https://survey123.arcgis.com] An optional, Survey123 base URL override\r\n * @throws Will throw if the Survey123 API returns an error response\r\n * @returns {Promise<ISurvey123CreateResult>}\r\n */\r\nexport function createSurvey(\r\n params: ISurvey123CreateParams,\r\n survey123Url = \"https://survey123.arcgis.com\"\r\n): Promise<ISurvey123CreateResult> {\r\n const createUrl = `${survey123Url}/api/survey/create`;\r\n const ro = {\r\n credentials: \"same-origin\" as RequestCredentials,\r\n method: \"POST\",\r\n body: encodeFormData(\r\n {\r\n f: \"json\",\r\n ...params\r\n },\r\n true\r\n )\r\n };\r\n // Using @esri/arcgis-request \"request\" method was resulting in a 404 for\r\n // a CORS preflight request related to this request, but calling fetch directly\r\n // circumvents the issue.\r\n return fetch(createUrl, ro)\r\n .then(response => response.json())\r\n .then(response => {\r\n if (!response.success) {\r\n throw new Error(`Failed to create survey: ${response.error.message}`);\r\n }\r\n return {\r\n formId: response.id,\r\n featureServiceId: response.featureService.source.itemId,\r\n folderId: response.formItemInfo.ownerFolder\r\n };\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation of Form templates\r\n *\r\n * @module convert-item-to-template\r\n */\r\n\r\nimport { UserSession, IItemTemplate } from \"@esri/solution-common\";\r\nimport { simpleTypes } from \"@esri/solution-simple-types\";\r\n\r\n/**\r\n * Creates a template from a Form item\r\n *\r\n * @param {string} solutionItemId The solution item ID\r\n * @param {any} itemInfo: The base item info\r\n * @param {UserSession} destAuthentication Credentials for requests to the destination organization\r\n * @param {UserSession} srcAuthentication Credentials for requests to source items\r\n * @param {any} templateDictionary Hash of facts: folder id, org URL, adlib replacements\r\n * @returns {Promise<IItemTemplate>}\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: UserSession,\r\n srcAuthentication: UserSession,\r\n templateDictionary: any\r\n): Promise<IItemTemplate> {\r\n // Delegate to simple types\r\n return simpleTypes.convertItemToTemplate(\r\n solutionItemId,\r\n itemInfo,\r\n destAuthentication,\r\n srcAuthentication,\r\n templateDictionary\r\n );\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the deployment items from Form templates.\r\n *\r\n * @module create-item-from-template\r\n */\r\n\r\nimport {\r\n UserSession,\r\n IItemTemplate,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse\r\n} from \"@esri/solution-common\";\r\nimport { simpleTypes } from \"@esri/solution-simple-types\";\r\nimport { isHubFormTemplate } from \"./helpers/is-hub-form-template\";\r\nimport { createItemFromHubTemplate } from \"./helpers/create-item-from-hub-template\";\r\n\r\n/**\r\n * Creates a Form item from a template\r\n *\r\n * @param {IItemTemplate} template The template\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} destinationAuthentication The destination user session info\r\n * @param itemProgressCallback An item progress callback\r\n * @returns {Promise<ICreateItemFromTemplateResponse>}\r\n */\r\nexport function createItemFromTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n // Hub Form template custom processing\r\n if (isHubFormTemplate(template)) {\r\n return createItemFromHubTemplate(\r\n template,\r\n templateDictionary,\r\n destinationAuthentication,\r\n itemProgressCallback\r\n );\r\n }\r\n\r\n // otherwise delegate to simple types\r\n return simpleTypes.createItemFromTemplate(\r\n template,\r\n templateDictionary,\r\n destinationAuthentication,\r\n itemProgressCallback\r\n );\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of form item types.\r\n *\r\n * @module post-process\r\n */\r\n\r\nimport {\r\n UserSession,\r\n IItemTemplate,\r\n updateItemTemplateFromDictionary\r\n} from \"@esri/solution-common\";\r\nimport { isHubFormTemplate } from \"./helpers/is-hub-form-template\";\r\nimport { postProcessHubSurvey } from \"./helpers/post-process-survey\";\r\n\r\n/**\r\n * Form post-processing actions\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template type\r\n * @param {any[]} itemInfos Array of \\{id: 'ef3', type: 'Web Map'\\} objects\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns Promise resolving to successfulness of update\r\n */\r\nexport function postProcess(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: IItemTemplate,\r\n templates: IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n if (isHubFormTemplate(template)) {\r\n return postProcessHubSurvey(\r\n itemId,\r\n type,\r\n itemInfos,\r\n template,\r\n templates,\r\n templateDictionary,\r\n authentication\r\n );\r\n }\r\n\r\n return updateItemTemplateFromDictionary(\r\n itemId,\r\n templateDictionary,\r\n authentication\r\n );\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n UserSession,\r\n IItemTemplate,\r\n updateItem,\r\n replaceInTemplate,\r\n getItemBase,\r\n createInitializedItemTemplate,\r\n removeFolder,\r\n IItemUpdate\r\n} from \"@esri/solution-common\";\r\nimport { moveItem } from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Provides utility method to post process Hub surveys\r\n *\r\n * @module post-process-survey\r\n */\r\n\r\n/**\r\n * Performs Survey post processing actions\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template/item type\r\n * @param {any[]} itemInfos An Array of item details\r\n * @param {IItemTemplate} template The template\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns {Promise<any>}\r\n */\r\nexport function postProcessHubSurvey(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: IItemTemplate,\r\n templates: IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n const featureServiceSourceId = template.properties.info.serviceInfo.itemId;\r\n const { itemId: featureServiceResultId } = templateDictionary[\r\n featureServiceSourceId\r\n ];\r\n const interpolated = replaceInTemplate(template, templateDictionary);\r\n return getItemBase(featureServiceResultId, authentication).then(\r\n featureServiceResultBase => {\r\n const itemUpdates = [\r\n // fix/update form properties we couldn't control via the API\r\n {\r\n id: itemId,\r\n title: interpolated.item.title,\r\n snippet: interpolated.item.snippet,\r\n extent: interpolated.item.extent,\r\n culture: interpolated.item.culture\r\n },\r\n // fix/update feature service properties we couldn't control via the API\r\n {\r\n id: featureServiceResultId,\r\n extent: interpolated.item.extent,\r\n typeKeywords: [`source-${featureServiceSourceId}`].concat(\r\n featureServiceResultBase.typeKeywords\r\n )\r\n }\r\n ];\r\n const toUpdatePromise = (updatedItem: IItemUpdate) =>\r\n updateItem(updatedItem, authentication);\r\n const updatePromises = itemUpdates.map(toUpdatePromise);\r\n return Promise.all(updatePromises)\r\n .then(() => {\r\n const itemIdsToMove = [itemId, featureServiceResultId];\r\n const toMovePromise = (id: string) =>\r\n moveItem({\r\n itemId: id,\r\n folderId: templateDictionary.folderId as string,\r\n authentication: authentication\r\n });\r\n const movePromises = itemIdsToMove.map(toMovePromise);\r\n return Promise.all(movePromises);\r\n })\r\n .then(() =>\r\n removeFolder(featureServiceResultBase.ownerFolder, authentication)\r\n )\r\n .then(() => {\r\n // Create a template item for the Feature Service that was created by the API\r\n const featureServiceTemplate = createInitializedItemTemplate(\r\n featureServiceResultBase\r\n );\r\n templates.push(featureServiceTemplate);\r\n template.dependencies.push(featureServiceResultBase.id);\r\n return true;\r\n });\r\n }\r\n );\r\n}\r\n"],"names":["isHubFormTemplate","template","common","getProp","buildCreateParams","templateDictionary","destinationAuthentication","item","title","originalTitle","description","tags","typeKeywords","properties","form","unencodedForm","user","username","portalBaseUrl","portalUrl","organization","basemapGalleryGroupQuery","defaultBasemap","basemapTitle","token","toCredential","getPortalDefaultBasemap","then","folderPrefix","getUniqueTitle","replace","questions","updateBasemap","question","maps","map","itemId","id","clone","cloneObject","encode","obj","key","encodeURIComponent","forEach","objKey","propKey","encodeQuestion","encodeSurveyForm","createItemFromHubTemplate","itemProgressCallback","interpolatedTemplate","replaceInTemplate","survey123Url","params","createUrl","ro","credentials","method","body","encodeFormData","f","fetch","response","json","success","Error","error","message","formId","featureServiceId","featureService","source","folderId","formItemInfo","ownerFolder","createSurvey","createSurveyResponse","thumbDef","Promise","resolve","thumbnail","updateItemExtended","getItemBase","info","serviceInfo","EItemProgressStatus","Finished","estimatedDeploymentCostFactor","type","postProcess","catch","e","Failed","solutionItemId","itemInfo","destAuthentication","srcAuthentication","simpleTypes","convertItemToTemplate","createItemFromTemplate","itemInfos","templates","authentication","featureServiceSourceId","featureServiceResultId","interpolated","featureServiceResultBase","updatePromises","snippet","extent","culture","concat","updatedItem","updateItem","all","movePromises","moveItem","removeFolder","featureServiceTemplate","createInitializedItemTemplate","push","dependencies","postProcessHubSurvey","updateItemTemplateFromDictionary"],"mappings":";;;;;;;;;;;;;;;;;o3BAyBM,SAAUA,EAAkBC,GAEhC,QAASC,EAAOC,QAAQF,EAAU,sBACpC,UCWgBG,EACdH,EACAI,EACAC,GAEA,MACEC,MAAQC,MAAOC,EAAaC,YAAEA,EAAWC,KAAEA,EAAIC,aAAEA,GACjDC,YAAcC,KAAMC,IAClBd,GAEFe,MAAMC,SAAEA,GACRC,cAAeC,EACfC,cAAcC,yBACZA,EACAC,gBAAkBd,MAAOe,KAEzBlB,GACEmB,MAAEA,GAAUlB,EAA0BmB,eAC5C,OAAOC,EAAAA,wBACLL,EACAE,EACAjB,GACAqB,MAAKL,IAKL,MAAMM,EAA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AjG,EACAkG,GAEA,OAAIvG,EAAkBC,GCJR,SACdmC,EACAqD,EACAY,EACApG,EACAqG,EACAjG,EACAkG,GAEA,MAAMC,EAAyBvG,EAASY,WAAWuE,KAAKC,YAAYjD,QAC5DA,OAAQqE,GAA2BpG,EACzCmG,GAEIE,EAAetD,EAAAA,kBAAkBnD,EAAUI,GACjD,OAAO8E,EAAWA,YAACsB,EAAwBF,GAAgB5E,MACzDgF,IACE,MAoBMC,EApBc,CAElB,CACEvE,GAAID,EACJ5B,MAAOkG,EAAanG,KAAKC,MACzBqG,QAASH,EAAanG,KAAKsG,QAC3BC,OAAQJ,EAAanG,KAAKuG,OAC1BC,QAASL,EAAanG,KAAKwG,SAG7B,CACE1E,GAAIoE,EACJK,OAAQJ,EAAanG,KAAKuG,OAC1BlG,aAAc,CAAC,UAAU4F,KAA0BQ,OACjDL,EAAyB/F,gBAMIuB,KAFV8E,GACvBC,EAAUA,WAACD,EAAaV,KAE1B,OAAOxB,QAAQoC,IAAIP,GAChBjF,MAAK,KACJ,MAOMyF,EAPgB,CAAChF,EAAQqE,GAOItE,KANZE,GACrBgF,WAAS,CACPjF,OAAQC,EACRoC,SAAUpE,EAAmBoE,SAC7B8B,eAAgBA,MAGpB,OAAOxB,QAAQoC,IAAIC,EAAa,IAEjCzF,MAAK,IACJ2F,EAAYA,aAACX,EAAyBhC,YAAa4B,KAEpD5E,MAAK,KAEJ,MAAM4F,EAAyBC,gCAC7Bb,GAIF,OAFAL,EAAUmB,KAAKF,GACftH,EAASyH,aAAaD,KAAKd,EAAyBtE,KAC7C,CAAI,GACX,GAGV,CD1DWsF,CACLvF,EACAqD,EACAY,EACApG,EACAqG,EACAjG,EACAkG,GAIGqB,mCACLxF,EACA/B,EACAkG,EAEJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-form",
3
- "version": "1.7.0",
3
+ "version": "2.0.0-alpha.0",
4
4
  "description": "Manages the creation and deployment of form item types for @esri/solution.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "unpkg": "dist/umd/file.umd.min.js",
@@ -15,33 +15,33 @@
15
15
  "devDependencies": {
16
16
  "@esri/arcgis-rest-auth": "3.5.0",
17
17
  "@esri/arcgis-rest-feature-layer": "3.5.0",
18
- "@esri/arcgis-rest-portal": "3.5.0",
18
+ "@esri/arcgis-rest-portal": "3.5.1",
19
19
  "@esri/arcgis-rest-request": "3.5.0",
20
20
  "@esri/arcgis-rest-service-admin": "3.5.0",
21
- "@esri/hub-common": "9.29.0",
22
- "@esri/hub-initiatives": "9.29.0",
23
- "@esri/hub-sites": "9.29.0",
24
- "@esri/hub-teams": "9.29.0",
25
- "rollup": "2.79.0"
21
+ "@esri/hub-common": "^12.14.0",
22
+ "@esri/hub-initiatives": "^12.4.1",
23
+ "@esri/hub-sites": "^12.5.0",
24
+ "@esri/hub-teams": "^12.4.1",
25
+ "@esri/solution-common": "^2.0.0-alpha.0",
26
+ "@esri/solution-feature-layer": "^2.0.0-alpha.0",
27
+ "@esri/solution-file": "^2.0.0-alpha.0",
28
+ "@esri/solution-group": "^2.0.0-alpha.0",
29
+ "@esri/solution-simple-types": "^2.0.0-alpha.0",
30
+ "@esri/solution-storymap": "^2.0.0-alpha.0",
31
+ "rollup": "2.79.1"
26
32
  },
27
33
  "peerDependencies": {
28
34
  "@esri/arcgis-rest-auth": "3.5.0",
29
35
  "@esri/arcgis-rest-feature-layer": "3.5.0",
30
- "@esri/arcgis-rest-portal": "3.5.0",
36
+ "@esri/arcgis-rest-portal": "3.5.1",
31
37
  "@esri/arcgis-rest-request": "3.5.0",
32
38
  "@esri/arcgis-rest-service-admin": "3.5.0",
33
- "@esri/hub-common": "9.29.0",
34
- "@esri/hub-initiatives": "9.29.0",
35
- "@esri/hub-sites": "9.29.0",
36
- "@esri/hub-teams": "9.29.0"
39
+ "@esri/hub-common": "^12.14.0",
40
+ "@esri/hub-initiatives": "^12.4.1",
41
+ "@esri/hub-sites": "^12.5.0",
42
+ "@esri/hub-teams": "^12.4.1"
37
43
  },
38
44
  "dependencies": {
39
- "@esri/solution-common": "^1.7.0",
40
- "@esri/solution-feature-layer": "^1.7.0",
41
- "@esri/solution-file": "^1.7.0",
42
- "@esri/solution-group": "^1.7.0",
43
- "@esri/solution-simple-types": "^1.7.0",
44
- "@esri/solution-storymap": "^1.7.0",
45
45
  "tslib": "1.14.1"
46
46
  },
47
47
  "scripts": {
@@ -80,5 +80,5 @@
80
80
  "esri",
81
81
  "ES6"
82
82
  ],
83
- "gitHead": "90abda2458189857c45459ec57acea8453ec77f3"
83
+ "gitHead": "307c2c0acc4e556757826f20434c6ba33f8e2f9f"
84
84
  }