@esri/solution-form 3.0.0 → 3.1.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.
- package/package.json +9 -9
- package/dist/node/convert-item-to-template.d.ts +0 -32
- package/dist/node/convert-item-to-template.js +0 -35
- package/dist/node/convert-item-to-template.js.map +0 -1
- package/dist/node/create-item-from-template.d.ts +0 -31
- package/dist/node/create-item-from-template.js +0 -40
- package/dist/node/create-item-from-template.js.map +0 -1
- package/dist/node/helpers/build-create-params.d.ts +0 -30
- package/dist/node/helpers/build-create-params.js +0 -78
- package/dist/node/helpers/build-create-params.js.map +0 -1
- package/dist/node/helpers/create-item-from-hub-template.d.ts +0 -32
- package/dist/node/helpers/create-item-from-hub-template.js +0 -80
- package/dist/node/helpers/create-item-from-hub-template.js.map +0 -1
- package/dist/node/helpers/create-survey.d.ts +0 -30
- package/dist/node/helpers/create-survey.js +0 -60
- package/dist/node/helpers/create-survey.js.map +0 -1
- package/dist/node/helpers/encode-survey-form.d.ts +0 -28
- package/dist/node/helpers/encode-survey-form.js +0 -59
- package/dist/node/helpers/encode-survey-form.js.map +0 -1
- package/dist/node/helpers/is-hub-form-template.d.ts +0 -24
- package/dist/node/helpers/is-hub-form-template.js +0 -33
- package/dist/node/helpers/is-hub-form-template.js.map +0 -1
- package/dist/node/helpers/post-process-survey.d.ts +0 -33
- package/dist/node/helpers/post-process-survey.js +0 -82
- package/dist/node/helpers/post-process-survey.js.map +0 -1
- package/dist/node/index.d.ts +0 -23
- package/dist/node/index.js +0 -27
- package/dist/node/index.js.map +0 -1
- package/dist/node/post-process.d.ts +0 -32
- package/dist/node/post-process.js +0 -44
- package/dist/node/post-process.js.map +0 -1
- package/dist/umd/form/src/convert-item-to-template.d.ts +0 -32
- package/dist/umd/form/src/create-item-from-template.d.ts +0 -31
- package/dist/umd/form/src/helpers/build-create-params.d.ts +0 -30
- package/dist/umd/form/src/helpers/create-item-from-hub-template.d.ts +0 -32
- package/dist/umd/form/src/helpers/create-survey.d.ts +0 -30
- package/dist/umd/form/src/helpers/encode-survey-form.d.ts +0 -28
- package/dist/umd/form/src/helpers/is-hub-form-template.d.ts +0 -24
- package/dist/umd/form/src/helpers/post-process-survey.d.ts +0 -33
- package/dist/umd/form/src/index.d.ts +0 -23
- package/dist/umd/form/src/post-process.d.ts +0 -32
- package/dist/umd/form.umd.js +0 -503
- package/dist/umd/form.umd.js.map +0 -1
- package/dist/umd/form.umd.min.js +0 -19
- package/dist/umd/form.umd.min.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-form",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.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",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"@esri/arcgis-rest-portal": "~3.5.0",
|
|
19
19
|
"@esri/arcgis-rest-request": "~3.5.0",
|
|
20
20
|
"@esri/arcgis-rest-service-admin": "~3.5.0",
|
|
21
|
-
"@esri/solution-common": "^3.
|
|
22
|
-
"@esri/solution-feature-layer": "^3.
|
|
23
|
-
"@esri/solution-file": "^3.
|
|
24
|
-
"@esri/solution-group": "^3.
|
|
25
|
-
"@esri/solution-simple-types": "^3.
|
|
26
|
-
"@esri/solution-storymap": "^3.
|
|
21
|
+
"@esri/solution-common": "^3.1.0",
|
|
22
|
+
"@esri/solution-feature-layer": "^3.1.0",
|
|
23
|
+
"@esri/solution-file": "^3.1.0",
|
|
24
|
+
"@esri/solution-group": "^3.1.0",
|
|
25
|
+
"@esri/solution-simple-types": "^3.1.0",
|
|
26
|
+
"@esri/solution-storymap": "^3.1.0",
|
|
27
27
|
"rollup": "2.79.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@esri/arcgis-rest-service-admin": "~3.5.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@esri/hub-common": "^12.
|
|
37
|
+
"@esri/hub-common": "^12.37.1",
|
|
38
38
|
"@esri/hub-initiatives": "^12.4.1",
|
|
39
39
|
"@esri/hub-sites": "^12.6.0",
|
|
40
40
|
"@esri/hub-teams": "^12.4.1",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"esri",
|
|
72
72
|
"ES6"
|
|
73
73
|
],
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "d7bddb4b7c7b98ef00eac060c639a22d0654a03f"
|
|
75
75
|
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Manages the creation of Form templates
|
|
18
|
-
*
|
|
19
|
-
* @module convert-item-to-template
|
|
20
|
-
*/
|
|
21
|
-
import { UserSession, IItemTemplate } from "@esri/solution-common";
|
|
22
|
-
/**
|
|
23
|
-
* Creates a template from a Form item
|
|
24
|
-
*
|
|
25
|
-
* @param {string} solutionItemId The solution item ID
|
|
26
|
-
* @param {any} itemInfo: The base item info
|
|
27
|
-
* @param {UserSession} destAuthentication Credentials for requests to the destination organization
|
|
28
|
-
* @param {UserSession} srcAuthentication Credentials for requests to source items
|
|
29
|
-
* @param {any} templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
30
|
-
* @returns {Promise<IItemTemplate>}
|
|
31
|
-
*/
|
|
32
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession, templateDictionary: any): Promise<IItemTemplate>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2018 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.convertItemToTemplate = void 0;
|
|
19
|
-
const solution_simple_types_1 = require("@esri/solution-simple-types");
|
|
20
|
-
/**
|
|
21
|
-
* Creates a template from a Form item
|
|
22
|
-
*
|
|
23
|
-
* @param {string} solutionItemId The solution item ID
|
|
24
|
-
* @param {any} itemInfo: The base item info
|
|
25
|
-
* @param {UserSession} destAuthentication Credentials for requests to the destination organization
|
|
26
|
-
* @param {UserSession} srcAuthentication Credentials for requests to source items
|
|
27
|
-
* @param {any} templateDictionary Hash of facts: folder id, org URL, adlib replacements
|
|
28
|
-
* @returns {Promise<IItemTemplate>}
|
|
29
|
-
*/
|
|
30
|
-
function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
|
|
31
|
-
// Delegate to simple types
|
|
32
|
-
return solution_simple_types_1.simpleTypes.convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary);
|
|
33
|
-
}
|
|
34
|
-
exports.convertItemToTemplate = convertItemToTemplate;
|
|
35
|
-
//# sourceMappingURL=convert-item-to-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert-item-to-template.js","sourceRoot":"","sources":["../../src/convert-item-to-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AASH,uEAA0D;AAE1D;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAA+B,EAC/B,iBAA8B,EAC9B,kBAAuB;IAEvB,2BAA2B;IAC3B,OAAO,mCAAW,CAAC,qBAAqB,CACtC,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,CACnB,CAAC;AACJ,CAAC;AAfD,sDAeC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Manages the deployment items from Form templates.
|
|
18
|
-
*
|
|
19
|
-
* @module create-item-from-template
|
|
20
|
-
*/
|
|
21
|
-
import { UserSession, IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse } from "@esri/solution-common";
|
|
22
|
-
/**
|
|
23
|
-
* Creates a Form item from a template
|
|
24
|
-
*
|
|
25
|
-
* @param {IItemTemplate} template The template
|
|
26
|
-
* @param {any} templateDictionary The template dictionary
|
|
27
|
-
* @param {UserSession} destinationAuthentication The destination user session info
|
|
28
|
-
* @param itemProgressCallback An item progress callback
|
|
29
|
-
* @returns {Promise<ICreateItemFromTemplateResponse>}
|
|
30
|
-
*/
|
|
31
|
-
export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2018 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createItemFromTemplate = void 0;
|
|
19
|
-
const solution_simple_types_1 = require("@esri/solution-simple-types");
|
|
20
|
-
const is_hub_form_template_1 = require("./helpers/is-hub-form-template");
|
|
21
|
-
const create_item_from_hub_template_1 = require("./helpers/create-item-from-hub-template");
|
|
22
|
-
/**
|
|
23
|
-
* Creates a Form item from a template
|
|
24
|
-
*
|
|
25
|
-
* @param {IItemTemplate} template The template
|
|
26
|
-
* @param {any} templateDictionary The template dictionary
|
|
27
|
-
* @param {UserSession} destinationAuthentication The destination user session info
|
|
28
|
-
* @param itemProgressCallback An item progress callback
|
|
29
|
-
* @returns {Promise<ICreateItemFromTemplateResponse>}
|
|
30
|
-
*/
|
|
31
|
-
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
32
|
-
// Hub Form template custom processing
|
|
33
|
-
if ((0, is_hub_form_template_1.isHubFormTemplate)(template)) {
|
|
34
|
-
return (0, create_item_from_hub_template_1.createItemFromHubTemplate)(template, templateDictionary, destinationAuthentication, itemProgressCallback);
|
|
35
|
-
}
|
|
36
|
-
// otherwise delegate to simple types
|
|
37
|
-
return solution_simple_types_1.simpleTypes.createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback);
|
|
38
|
-
}
|
|
39
|
-
exports.createItemFromTemplate = createItemFromTemplate;
|
|
40
|
-
//# sourceMappingURL=create-item-from-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-item-from-template.js","sourceRoot":"","sources":["../../src/create-item-from-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAcH,uEAA0D;AAC1D,yEAAmE;AACnE,2FAAoF;AAEpF;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CACpC,QAAuB,EACvB,kBAAuB,EACvB,yBAAsC,EACtC,oBAA2C;IAE3C,sCAAsC;IACtC,IAAI,IAAA,wCAAiB,EAAC,QAAQ,CAAC,EAAE;QAC/B,OAAO,IAAA,yDAAyB,EAC9B,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,CACrB,CAAC;KACH;IAED,qCAAqC;IACrC,OAAO,mCAAW,CAAC,sBAAsB,CACvC,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,CACrB,CAAC;AACJ,CAAC;AAvBD,wDAuBC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { IItemTemplate, UserSession, ISurvey123CreateParams } from "@esri/solution-common";
|
|
17
|
-
/**
|
|
18
|
-
* Utility method for creating Survey123 parameters
|
|
19
|
-
*
|
|
20
|
-
* @module build-create-params
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Builds the Survey123 create API parameters
|
|
24
|
-
*
|
|
25
|
-
* @param {IItemTemplate} template The template
|
|
26
|
-
* @param {any} templateDictionary The template dictionary
|
|
27
|
-
* @param {UserSession} destinationAuthentication The destination session info
|
|
28
|
-
* @returns {Promise<ISurvey123CreateParams>}
|
|
29
|
-
*/
|
|
30
|
-
export declare function buildCreateParams(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession): Promise<ISurvey123CreateParams>;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2020 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.buildCreateParams = void 0;
|
|
19
|
-
const solution_common_1 = require("@esri/solution-common");
|
|
20
|
-
const encode_survey_form_1 = require("./encode-survey-form");
|
|
21
|
-
/**
|
|
22
|
-
* Utility method for creating Survey123 parameters
|
|
23
|
-
*
|
|
24
|
-
* @module build-create-params
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Builds the Survey123 create API parameters
|
|
28
|
-
*
|
|
29
|
-
* @param {IItemTemplate} template The template
|
|
30
|
-
* @param {any} templateDictionary The template dictionary
|
|
31
|
-
* @param {UserSession} destinationAuthentication The destination session info
|
|
32
|
-
* @returns {Promise<ISurvey123CreateParams>}
|
|
33
|
-
*/
|
|
34
|
-
function buildCreateParams(template, templateDictionary, destinationAuthentication) {
|
|
35
|
-
const { item: { title: originalTitle, description, tags, typeKeywords }, properties: { form: unencodedForm } } = template;
|
|
36
|
-
const { user: { username }, portalBaseUrl: portalUrl, organization: { basemapGalleryGroupQuery, defaultBasemap: { title: basemapTitle } } } = templateDictionary;
|
|
37
|
-
const { token } = destinationAuthentication.toCredential();
|
|
38
|
-
return (0, solution_common_1.getPortalDefaultBasemap)(basemapGalleryGroupQuery, basemapTitle, destinationAuthentication).then(defaultBasemap => {
|
|
39
|
-
// The S123 API appends "Survey-" to the survey title when computing
|
|
40
|
-
// the folder name. We need to use the same prefix to successfully
|
|
41
|
-
// calculate a unique folder name. Afterwards, we can safely remove the
|
|
42
|
-
// prefix from the title
|
|
43
|
-
const folderPrefix = "Survey-";
|
|
44
|
-
const title = (0, solution_common_1.getUniqueTitle)(`${folderPrefix}${originalTitle}`, templateDictionary, "user.folders").replace(folderPrefix, "");
|
|
45
|
-
// set any map question's basemaps to default org basemap
|
|
46
|
-
if (unencodedForm.questions) {
|
|
47
|
-
const updateBasemap = (question) => {
|
|
48
|
-
if (question.maps) {
|
|
49
|
-
question.maps = question.maps.map((map) => ({
|
|
50
|
-
...map,
|
|
51
|
-
itemId: defaultBasemap.id
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
return question;
|
|
55
|
-
};
|
|
56
|
-
unencodedForm.questions = unencodedForm.questions.map((question) => !question.questions
|
|
57
|
-
? updateBasemap(question)
|
|
58
|
-
: {
|
|
59
|
-
...question,
|
|
60
|
-
questions: question.questions.map(updateBasemap)
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
const form = (0, encode_survey_form_1.encodeSurveyForm)(unencodedForm);
|
|
64
|
-
// intentionally undefined, handled downstream by core logic now
|
|
65
|
-
return {
|
|
66
|
-
description,
|
|
67
|
-
form,
|
|
68
|
-
portalUrl,
|
|
69
|
-
tags,
|
|
70
|
-
title,
|
|
71
|
-
token,
|
|
72
|
-
typeKeywords,
|
|
73
|
-
username
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
exports.buildCreateParams = buildCreateParams;
|
|
78
|
-
//# sourceMappingURL=build-create-params.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-create-params.js","sourceRoot":"","sources":["../../../src/helpers/build-create-params.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAM+B;AAC/B,6DAAwD;AAExD;;;;GAIG;AAEH;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,QAAuB,EACvB,kBAAuB,EACvB,yBAAsC;IAEtC,MAAM,EACJ,IAAI,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,EAC/D,UAAU,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EACpC,GAAG,QAAQ,CAAC;IACb,MAAM,EACJ,IAAI,EAAE,EAAE,QAAQ,EAAE,EAClB,aAAa,EAAE,SAAS,EACxB,YAAY,EAAE,EACZ,wBAAwB,EACxB,cAAc,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,EACxC,EACF,GAAG,kBAAkB,CAAC;IACvB,MAAM,EAAE,KAAK,EAAE,GAAG,yBAAyB,CAAC,YAAY,EAAE,CAAC;IAC3D,OAAO,IAAA,yCAAuB,EAC5B,wBAAwB,EACxB,YAAY,EACZ,yBAAyB,CAC1B,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;QACtB,oEAAoE;QACpE,kEAAkE;QAClE,uEAAuE;QACvE,wBAAwB;QACxB,MAAM,YAAY,GAAG,SAAS,CAAC;QAC/B,MAAM,KAAK,GAAG,IAAA,gCAAc,EAC1B,GAAG,YAAY,GAAG,aAAa,EAAE,EACjC,kBAAkB,EAClB,cAAc,CACf,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAC5B,yDAAyD;QACzD,IAAI,aAAa,CAAC,SAAS,EAAE;YAC3B,MAAM,aAAa,GAAG,CAAC,QAAa,EAAE,EAAE;gBACtC,IAAI,QAAQ,CAAC,IAAI,EAAE;oBACjB,QAAQ,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC;wBAC/C,GAAG,GAAG;wBACN,MAAM,EAAE,cAAc,CAAC,EAAE;qBAC1B,CAAC,CAAC,CAAC;iBACL;gBACD,OAAO,QAAQ,CAAC;YAClB,CAAC,CAAC;YACF,aAAa,CAAC,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE,CACtE,CAAC,QAAQ,CAAC,SAAS;gBACjB,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC;gBACzB,CAAC,CAAC;oBACA,GAAG,QAAQ;oBACX,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC;iBACjD,CACJ,CAAC;SACH;QACD,MAAM,IAAI,GAAG,IAAA,qCAAgB,EAAC,aAAa,CAAC,CAAC;QAC7C,gEAAgE;QAChE,OAAO;YACL,WAAW;YACX,IAAI;YACJ,SAAS;YACT,IAAI;YACJ,KAAK;YACL,KAAK;YACL,YAAY;YACZ,QAAQ;SACT,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAlED,8CAkEC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { IItemTemplate, UserSession, IItemProgressCallback, ICreateItemFromTemplateResponse } from "@esri/solution-common";
|
|
17
|
-
/**
|
|
18
|
-
* Manages the creation of Surveys from Hub Templates
|
|
19
|
-
* via the Survey123 API
|
|
20
|
-
*
|
|
21
|
-
* @module create-item-from-hub-template
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* Orchestrates creation of Surveys from Hub templates
|
|
25
|
-
*
|
|
26
|
-
* @param {IItemTemplate} template The template
|
|
27
|
-
* @param {any} templateDictionary The template dictionary
|
|
28
|
-
* @param {UserSession} destinationAuthentication The destination session info
|
|
29
|
-
* @param {Function} itemProgressCallback A progress callback
|
|
30
|
-
* @returns {Promise<ICreateItemFromTemplateResponse>}
|
|
31
|
-
*/
|
|
32
|
-
export declare function createItemFromHubTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2020 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createItemFromHubTemplate = void 0;
|
|
19
|
-
const solution_common_1 = require("@esri/solution-common");
|
|
20
|
-
const create_survey_1 = require("./create-survey");
|
|
21
|
-
const build_create_params_1 = require("./build-create-params");
|
|
22
|
-
/**
|
|
23
|
-
* Manages the creation of Surveys from Hub Templates
|
|
24
|
-
* via the Survey123 API
|
|
25
|
-
*
|
|
26
|
-
* @module create-item-from-hub-template
|
|
27
|
-
*/
|
|
28
|
-
/**
|
|
29
|
-
* Orchestrates creation of Surveys from Hub templates
|
|
30
|
-
*
|
|
31
|
-
* @param {IItemTemplate} template The template
|
|
32
|
-
* @param {any} templateDictionary The template dictionary
|
|
33
|
-
* @param {UserSession} destinationAuthentication The destination session info
|
|
34
|
-
* @param {Function} itemProgressCallback A progress callback
|
|
35
|
-
* @returns {Promise<ICreateItemFromTemplateResponse>}
|
|
36
|
-
*/
|
|
37
|
-
function createItemFromHubTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
38
|
-
const interpolatedTemplate = (0, solution_common_1.replaceInTemplate)(template, templateDictionary);
|
|
39
|
-
const { survey123Url } = templateDictionary;
|
|
40
|
-
return (0, build_create_params_1.buildCreateParams)(interpolatedTemplate, templateDictionary, destinationAuthentication)
|
|
41
|
-
.then((params) => {
|
|
42
|
-
return (0, create_survey_1.createSurvey)(params, survey123Url);
|
|
43
|
-
})
|
|
44
|
-
.then((createSurveyResponse) => {
|
|
45
|
-
const { formId, featureServiceId } = createSurveyResponse;
|
|
46
|
-
// Update the item with its thumbnail
|
|
47
|
-
let thumbDef = Promise.resolve(null);
|
|
48
|
-
/* istanbul ignore else */
|
|
49
|
-
if (template.item.thumbnail) {
|
|
50
|
-
thumbDef = (0, solution_common_1.updateItemExtended)({ id: formId }, null, destinationAuthentication, template.item.thumbnail);
|
|
51
|
-
}
|
|
52
|
-
return thumbDef
|
|
53
|
-
.then(() => (0, solution_common_1.getItemBase)(formId, destinationAuthentication))
|
|
54
|
-
.then(item => {
|
|
55
|
-
templateDictionary[interpolatedTemplate.itemId] = {
|
|
56
|
-
itemId: formId
|
|
57
|
-
};
|
|
58
|
-
templateDictionary[interpolatedTemplate.properties.info.serviceInfo.itemId] = {
|
|
59
|
-
itemId: featureServiceId
|
|
60
|
-
};
|
|
61
|
-
itemProgressCallback(interpolatedTemplate.itemId, solution_common_1.EItemProgressStatus.Finished, interpolatedTemplate.estimatedDeploymentCostFactor, formId);
|
|
62
|
-
return {
|
|
63
|
-
item: {
|
|
64
|
-
...template,
|
|
65
|
-
item,
|
|
66
|
-
itemId: formId
|
|
67
|
-
},
|
|
68
|
-
id: formId,
|
|
69
|
-
type: "Form",
|
|
70
|
-
postProcess: true
|
|
71
|
-
};
|
|
72
|
-
});
|
|
73
|
-
})
|
|
74
|
-
.catch(e => {
|
|
75
|
-
itemProgressCallback(interpolatedTemplate.itemId, solution_common_1.EItemProgressStatus.Failed, 0);
|
|
76
|
-
throw e;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
exports.createItemFromHubTemplate = createItemFromHubTemplate;
|
|
80
|
-
//# sourceMappingURL=create-item-from-hub-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-item-from-hub-template.js","sourceRoot":"","sources":["../../../src/helpers/create-item-from-hub-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAW+B;AAC/B,mDAA+C;AAC/C,+DAA0D;AAE1D;;;;;GAKG;AAEH;;;;;;;;GAQG;AACH,SAAgB,yBAAyB,CACvC,QAAuB,EACvB,kBAAuB,EACvB,yBAAsC,EACtC,oBAA2C;IAE3C,MAAM,oBAAoB,GAAG,IAAA,mCAAiB,EAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IAC7E,MAAM,EAAE,YAAY,EAAE,GAAG,kBAAkB,CAAC;IAE5C,OAAO,IAAA,uCAAiB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,yBAAyB,CAC1B;SACE,IAAI,CAAC,CAAC,MAA8B,EAAE,EAAE;QACvC,OAAO,IAAA,4BAAY,EAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC5C,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,oBAA4C,EAAE,EAAE;QACrD,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,oBAAoB,CAAC;QAE1D,qCAAqC;QACrC,IAAI,QAAQ,GAAiB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnD,0BAA0B;QAC1B,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE;YAC3B,QAAQ,GAAG,IAAA,oCAAkB,EAC3B,EAAE,EAAE,EAAE,MAAM,EAAE,EACd,IAAI,EACJ,yBAAyB,EACzB,QAAQ,CAAC,IAAI,CAAC,SAAS,CACxB,CAAC;SACH;QAED,OAAO,QAAQ;aACZ,IAAI,CAAC,GAAG,EAAE,CAAC,IAAA,6BAAW,EAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;aAC1D,IAAI,CAAC,IAAI,CAAC,EAAE;YACX,kBAAkB,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG;gBAChD,MAAM,EAAE,MAAM;aACf,CAAC;YACF,kBAAkB,CAChB,oBAAoB,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CACxD,GAAG;gBACF,MAAM,EAAE,gBAAgB;aACzB,CAAC;YACF,oBAAoB,CAClB,oBAAoB,CAAC,MAAM,EAC3B,qCAAmB,CAAC,QAAQ,EAC5B,oBAAoB,CAAC,6BAA6B,EAClD,MAAM,CACP,CAAC;YACF,OAAO;gBACL,IAAI,EAAE;oBACJ,GAAG,QAAQ;oBACX,IAAI;oBACJ,MAAM,EAAE,MAAM;iBACf;gBACD,EAAE,EAAE,MAAM;gBACV,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,IAAI;aAClB,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE;QACT,oBAAoB,CAClB,oBAAoB,CAAC,MAAM,EAC3B,qCAAmB,CAAC,MAAM,EAC1B,CAAC,CACF,CAAC;QACF,MAAM,CAAC,CAAC;IACV,CAAC,CAAC,CAAC;AACP,CAAC;AArED,8DAqEC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { ISurvey123CreateParams, ISurvey123CreateResult } from "@esri/solution-common";
|
|
17
|
-
/**
|
|
18
|
-
* Provides utility method to call Survey123 create endpoint
|
|
19
|
-
*
|
|
20
|
-
* @module create-survey
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Calls the Survey123 create API with the given parameters
|
|
24
|
-
*
|
|
25
|
-
* @param {ISurvey123CreateParams} params
|
|
26
|
-
* @param {string} [survey123Url=https://survey123.arcgis.com] An optional, Survey123 base URL override
|
|
27
|
-
* @throws Will throw if the Survey123 API returns an error response
|
|
28
|
-
* @returns {Promise<ISurvey123CreateResult>}
|
|
29
|
-
*/
|
|
30
|
-
export declare function createSurvey(params: ISurvey123CreateParams, survey123Url?: string): Promise<ISurvey123CreateResult>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2020 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createSurvey = void 0;
|
|
19
|
-
const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
|
|
20
|
-
/**
|
|
21
|
-
* Provides utility method to call Survey123 create endpoint
|
|
22
|
-
*
|
|
23
|
-
* @module create-survey
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Calls the Survey123 create API with the given parameters
|
|
27
|
-
*
|
|
28
|
-
* @param {ISurvey123CreateParams} params
|
|
29
|
-
* @param {string} [survey123Url=https://survey123.arcgis.com] An optional, Survey123 base URL override
|
|
30
|
-
* @throws Will throw if the Survey123 API returns an error response
|
|
31
|
-
* @returns {Promise<ISurvey123CreateResult>}
|
|
32
|
-
*/
|
|
33
|
-
function createSurvey(params, survey123Url = "https://survey123.arcgis.com") {
|
|
34
|
-
const createUrl = `${survey123Url}/api/survey/create`;
|
|
35
|
-
const ro = {
|
|
36
|
-
credentials: "same-origin",
|
|
37
|
-
method: "POST",
|
|
38
|
-
body: (0, arcgis_rest_request_1.encodeFormData)({
|
|
39
|
-
f: "json",
|
|
40
|
-
...params
|
|
41
|
-
}, true)
|
|
42
|
-
};
|
|
43
|
-
// Using @esri/arcgis-request "request" method was resulting in a 404 for
|
|
44
|
-
// a CORS preflight request related to this request, but calling fetch directly
|
|
45
|
-
// circumvents the issue.
|
|
46
|
-
return fetch(createUrl, ro)
|
|
47
|
-
.then(response => response.json())
|
|
48
|
-
.then(response => {
|
|
49
|
-
if (!response.success) {
|
|
50
|
-
throw new Error(`Failed to create survey: ${response.error.message}`);
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
formId: response.id,
|
|
54
|
-
featureServiceId: response.featureService.source.itemId,
|
|
55
|
-
folderId: response.formItemInfo.ownerFolder
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
exports.createSurvey = createSurvey;
|
|
60
|
-
//# sourceMappingURL=create-survey.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-survey.js","sourceRoot":"","sources":["../../../src/helpers/create-survey.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAMH,mEAA2D;AAE3D;;;;GAIG;AAEH;;;;;;;GAOG;AACH,SAAgB,YAAY,CAC1B,MAA8B,EAC9B,YAAY,GAAG,8BAA8B;IAE7C,MAAM,SAAS,GAAG,GAAG,YAAY,oBAAoB,CAAC;IACtD,MAAM,EAAE,GAAG;QACT,WAAW,EAAE,aAAmC;QAChD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAA,oCAAc,EAClB;YACE,CAAC,EAAE,MAAM;YACT,GAAG,MAAM;SACV,EACD,IAAI,CACL;KACF,CAAC;IACF,yEAAyE;IACzE,+EAA+E;IAC/E,yBAAyB;IACzB,OAAO,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC;SACxB,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;SACjC,IAAI,CAAC,QAAQ,CAAC,EAAE;QACf,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,4BAA4B,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;SACvE;QACD,OAAO;YACL,MAAM,EAAE,QAAQ,CAAC,EAAE;YACnB,gBAAgB,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM;YACvD,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC,WAAW;SAC5C,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC;AA/BD,oCA+BC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Manages Survey123 parameter encoding
|
|
18
|
-
*
|
|
19
|
-
* @module encode-survey-form
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* URI Encodes Survey123 form content parameter
|
|
23
|
-
* values
|
|
24
|
-
*
|
|
25
|
-
* @param {any} form Unencoded form data
|
|
26
|
-
* @returns {any} Encoded form data
|
|
27
|
-
*/
|
|
28
|
-
export declare const encodeSurveyForm: (form: any) => any;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2020 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.encodeSurveyForm = void 0;
|
|
19
|
-
const solution_common_1 = require("@esri/solution-common");
|
|
20
|
-
/**
|
|
21
|
-
* Manages Survey123 parameter encoding
|
|
22
|
-
*
|
|
23
|
-
* @module encode-survey-form
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* URI Encodes Survey123 form content parameter
|
|
27
|
-
* values
|
|
28
|
-
*
|
|
29
|
-
* @param {any} form Unencoded form data
|
|
30
|
-
* @returns {any} Encoded form data
|
|
31
|
-
*/
|
|
32
|
-
const encodeSurveyForm = function encodeForm(form) {
|
|
33
|
-
const clone = (0, solution_common_1.cloneObject)(form);
|
|
34
|
-
const props = [
|
|
35
|
-
["header", "content"],
|
|
36
|
-
["subHeader", "content"],
|
|
37
|
-
["footer", "content"],
|
|
38
|
-
["settings", "thankYouScreenContent"]
|
|
39
|
-
];
|
|
40
|
-
const encode = (obj, key) => {
|
|
41
|
-
if (obj && obj[key]) {
|
|
42
|
-
obj[key] = encodeURIComponent(obj[key]);
|
|
43
|
-
}
|
|
44
|
-
return obj;
|
|
45
|
-
};
|
|
46
|
-
// encode props from array above
|
|
47
|
-
props.forEach(([objKey, propKey]) => encode(clone[objKey], propKey));
|
|
48
|
-
const encodeQuestion = (question) => encode(question, "description");
|
|
49
|
-
// encode question descriptions
|
|
50
|
-
clone.questions = (clone.questions || []).map((question) => !question.questions
|
|
51
|
-
? encodeQuestion(question)
|
|
52
|
-
: {
|
|
53
|
-
...question,
|
|
54
|
-
questions: question.questions.map(encodeQuestion)
|
|
55
|
-
});
|
|
56
|
-
return clone;
|
|
57
|
-
};
|
|
58
|
-
exports.encodeSurveyForm = encodeSurveyForm;
|
|
59
|
-
//# sourceMappingURL=encode-survey-form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encode-survey-form.js","sourceRoot":"","sources":["../../../src/helpers/encode-survey-form.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAAoD;AAEpD;;;;GAIG;AAEH;;;;;;GAMG;AACI,MAAM,gBAAgB,GAAG,SAAS,UAAU,CAAC,IAAS;IAC3D,MAAM,KAAK,GAAG,IAAA,6BAAW,EAAC,IAAI,CAAC,CAAC;IAChC,MAAM,KAAK,GAAG;QACZ,CAAC,QAAQ,EAAE,SAAS,CAAC;QACrB,CAAC,WAAW,EAAE,SAAS,CAAC;QACxB,CAAC,QAAQ,EAAE,SAAS,CAAC;QACrB,CAAC,UAAU,EAAE,uBAAuB,CAAC;KACtC,CAAC;IACF,MAAM,MAAM,GAAG,CACb,GAA8B,EAC9B,GAAW,EACgB,EAAE;QAC7B,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,EAAE;YACnB,GAAG,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;SACzC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;IAEF,gCAAgC;IAChC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAErE,MAAM,cAAc,GAAG,CAAC,QAAa,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAE1E,+BAA+B;IAC/B,KAAK,CAAC,SAAS,GAAG,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,QAAa,EAAE,EAAE,CAC9D,CAAC,QAAQ,CAAC,SAAS;QACjB,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC;QAC1B,CAAC,CAAC;YACA,GAAG,QAAQ;YACX,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;SAClD,CACJ,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAlCW,QAAA,gBAAgB,oBAkC3B"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import * as common from "@esri/solution-common";
|
|
17
|
-
/**
|
|
18
|
-
* Determines if the given template is a Hub Survey
|
|
19
|
-
* template vs Solutions.js Survey template.
|
|
20
|
-
*
|
|
21
|
-
* @param {IITemTemplate} template A template
|
|
22
|
-
* @returns {boolean}
|
|
23
|
-
*/
|
|
24
|
-
export declare function isHubFormTemplate(template: common.IItemTemplate): boolean;
|