@esri/solution-web-experience 6.1.0-alpha.0 → 6.2.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.
Files changed (49) hide show
  1. package/dist/cjs/helpers/convert-web-experience-to-template.d.ts +27 -0
  2. package/dist/cjs/helpers/convert-web-experience-to-template.js +67 -0
  3. package/dist/cjs/helpers/convert-web-experience-to-template.js.map +1 -0
  4. package/dist/cjs/helpers/create-web-experience-model-from-template.d.ts +26 -0
  5. package/dist/cjs/helpers/create-web-experience-model-from-template.js +42 -0
  6. package/dist/cjs/helpers/create-web-experience-model-from-template.js.map +1 -0
  7. package/dist/cjs/helpers/create-web-experience.d.ts +25 -0
  8. package/dist/cjs/helpers/create-web-experience.js +119 -0
  9. package/dist/cjs/helpers/create-web-experience.js.map +1 -0
  10. package/dist/cjs/helpers/get-experience-subdomain.d.ts +23 -0
  11. package/dist/cjs/helpers/get-experience-subdomain.js +26 -0
  12. package/dist/cjs/helpers/get-experience-subdomain.js.map +1 -0
  13. package/dist/cjs/helpers/get-web-experience-dependencies.d.ts +23 -0
  14. package/dist/cjs/helpers/get-web-experience-dependencies.js +33 -0
  15. package/dist/cjs/helpers/get-web-experience-dependencies.js.map +1 -0
  16. package/dist/cjs/helpers/get-web-experience-url-template.d.ts +23 -0
  17. package/dist/cjs/helpers/get-web-experience-url-template.js +26 -0
  18. package/dist/cjs/helpers/get-web-experience-url-template.js.map +1 -0
  19. package/dist/cjs/index.d.ts +17 -0
  20. package/dist/cjs/index.js +22 -0
  21. package/dist/cjs/index.js.map +1 -0
  22. package/dist/cjs/web-experience-processor.d.ts +50 -0
  23. package/dist/cjs/web-experience-processor.js +124 -0
  24. package/dist/cjs/web-experience-processor.js.map +1 -0
  25. package/dist/esm/helpers/convert-web-experience-to-template.d.ts +27 -0
  26. package/dist/esm/helpers/convert-web-experience-to-template.js +63 -0
  27. package/dist/esm/helpers/convert-web-experience-to-template.js.map +1 -0
  28. package/dist/esm/helpers/create-web-experience-model-from-template.d.ts +26 -0
  29. package/dist/esm/helpers/create-web-experience-model-from-template.js +38 -0
  30. package/dist/esm/helpers/create-web-experience-model-from-template.js.map +1 -0
  31. package/dist/esm/helpers/create-web-experience.d.ts +25 -0
  32. package/dist/esm/helpers/create-web-experience.js +115 -0
  33. package/dist/esm/helpers/create-web-experience.js.map +1 -0
  34. package/dist/esm/helpers/get-experience-subdomain.d.ts +23 -0
  35. package/dist/esm/helpers/get-experience-subdomain.js +22 -0
  36. package/dist/esm/helpers/get-experience-subdomain.js.map +1 -0
  37. package/dist/esm/helpers/get-web-experience-dependencies.d.ts +23 -0
  38. package/dist/esm/helpers/get-web-experience-dependencies.js +29 -0
  39. package/dist/esm/helpers/get-web-experience-dependencies.js.map +1 -0
  40. package/dist/esm/helpers/get-web-experience-url-template.d.ts +23 -0
  41. package/dist/esm/helpers/get-web-experience-url-template.js +22 -0
  42. package/dist/esm/helpers/get-web-experience-url-template.js.map +1 -0
  43. package/dist/esm/index.d.ts +17 -0
  44. package/dist/esm/index.js +18 -0
  45. package/dist/esm/index.js.map +1 -0
  46. package/dist/esm/web-experience-processor.d.ts +50 -0
  47. package/dist/esm/web-experience-processor.js +118 -0
  48. package/dist/esm/web-experience-processor.js.map +1 -0
  49. package/package.json +3 -3
@@ -0,0 +1,27 @@
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 { IModel } from "@esri/hub-common";
17
+ import { IItemTemplate } from "@esri/solution-common";
18
+ /**
19
+ * Convert an Experience item into a template
20
+ *
21
+ * Pretty simpler conversion - remove extra item props, extract out
22
+ * items from the data.dataSources hash.
23
+ *
24
+ * @param model
25
+ * @param authentication
26
+ */
27
+ export declare function convertWebExperienceToTemplate(model: IModel): Promise<IItemTemplate>;
@@ -0,0 +1,67 @@
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.convertWebExperienceToTemplate = void 0;
19
+ const hub_common_1 = require("@esri/hub-common");
20
+ const solution_common_1 = require("@esri/solution-common");
21
+ const get_web_experience_dependencies_1 = require("./get-web-experience-dependencies");
22
+ /**
23
+ * Convert an Experience item into a template
24
+ *
25
+ * Pretty simpler conversion - remove extra item props, extract out
26
+ * items from the data.dataSources hash.
27
+ *
28
+ * @param model
29
+ * @param authentication
30
+ */
31
+ function convertWebExperienceToTemplate(model) {
32
+ const tmpl = (0, solution_common_1.createPlaceholderTemplate)(model.item.id, model.item.type);
33
+ tmpl.key = `${(0, hub_common_1.propifyString)(model.item.title)}_${(0, hub_common_1.createId)("i")}`;
34
+ const clone = (0, hub_common_1.cloneObject)(model);
35
+ tmpl.data = clone.data;
36
+ // We need to save these properties in order to restore them after hub.js deletes them
37
+ const created = clone.item.created;
38
+ const modified = clone.item.modified;
39
+ tmpl.item = (0, hub_common_1.normalizeSolutionTemplateItem)(clone.item);
40
+ tmpl.item.created = created;
41
+ tmpl.item.modified = modified;
42
+ // templatize the url. This is updated during the createModelFromTemplate phase
43
+ // of the deployment process
44
+ tmpl.item.url = "{{experienceUrlTemplate}}";
45
+ // use typeKeyword to mark item as published (we decided to discard unpublished drafts)
46
+ const typeKeywords = tmpl.item.typeKeywords;
47
+ if (typeKeywords.indexOf(changedTypeKW) !== -1) {
48
+ tmpl.item.typeKeywords = [publishedTypeKW].concat(tmpl.item.typeKeywords.filter((word) => word !== changedTypeKW));
49
+ }
50
+ tmpl.dependencies = (0, get_web_experience_dependencies_1.getWebExperienceDependencies)(model);
51
+ return Promise.resolve(tmpl);
52
+ // TODO: For now, we let the generic process handle item resources
53
+ // However, many newer item types have complex type-specific resource handling
54
+ // requirements so this code may be useful in the future
55
+ // ------------------------------------------------------
56
+ // return getItemResources(tmpl.itemId, authentication)
57
+ // .then((response) => {
58
+ // tmpl.resources = response.resources.map(e => e.resource)
59
+ // // Discard draft version
60
+ // .filter(filename => filename !== 'config.json');
61
+ // return tmpl;
62
+ // });
63
+ }
64
+ exports.convertWebExperienceToTemplate = convertWebExperienceToTemplate;
65
+ const publishedTypeKW = "status: Published";
66
+ const changedTypeKW = "status: Changed";
67
+ //# sourceMappingURL=convert-web-experience-to-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-web-experience-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-web-experience-to-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAA+G;AAE/G,2DAAwF;AACxF,uFAAiF;AAEjF;;;;;;;;GAQG;AACH,SAAgB,8BAA8B,CAAC,KAAa;IAC1D,MAAM,IAAI,GAAG,IAAA,2CAAyB,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,GAAG,GAAG,GAAG,IAAA,0BAAa,EAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAA,qBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC;IAEjE,MAAM,KAAK,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a,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,26 @@
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 { IModelTemplate } from "@esri/hub-common";
17
+ import { UserSession } from "@esri/solution-common";
18
+ /**
19
+ * Convert a Web Experience template into a Model that can be persisted to the Portal API
20
+ *
21
+ * @param templateModel Template
22
+ * @param settings Hash of values to interpolate into the template
23
+ * @param transforms Hash of transform functions to use in the interpolation
24
+ * @param authentication UserSession
25
+ */
26
+ export declare function createWebExperienceModelFromTemplate(templateModel: IModelTemplate, settings: any, transforms: any, authentication: UserSession): Promise<any>;
@@ -0,0 +1,42 @@
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.createWebExperienceModelFromTemplate = void 0;
19
+ const hub_common_1 = require("@esri/hub-common");
20
+ const get_web_experience_url_template_1 = require("./get-web-experience-url-template");
21
+ /**
22
+ * Convert a Web Experience template into a Model that can be persisted to the Portal API
23
+ *
24
+ * @param templateModel Template
25
+ * @param settings Hash of values to interpolate into the template
26
+ * @param transforms Hash of transform functions to use in the interpolation
27
+ * @param authentication UserSession
28
+ */
29
+ function createWebExperienceModelFromTemplate(templateModel, settings, transforms, authentication) {
30
+ // get the experience base url
31
+ settings.experienceUrlTemplate = (0, get_web_experience_url_template_1.getWebExperiencepUrlTemplate)(authentication);
32
+ const model = (0, hub_common_1.interpolate)(templateModel, settings, transforms);
33
+ // ensure this is set - there may be some templates w/o `{{experienceTemplateUrl}}
34
+ model.item.url = settings.experienceUrlTemplate;
35
+ /* istanbul ignore else */
36
+ if (templateModel.item.thumbnail) {
37
+ model.item.thumbnail = templateModel.item.thumbnail; // interpolation trashes thumbnail binary
38
+ }
39
+ return Promise.resolve(model);
40
+ }
41
+ exports.createWebExperienceModelFromTemplate = createWebExperienceModelFromTemplate;
42
+ //# sourceMappingURL=create-web-experience-model-from-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-web-experience-model-from-template.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience-model-from-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAA+D;AAE/D,uFAAiF;AACjF;;;;;;;GAOG;AACH,SAAgB,oCAAoC,CAClD,aAA6B,EAC7B,QAAa,EACb,UAAe,EACf,cAA2B;IAE3B,8BAA8B;IAC9B,QAAQ,CAAC,qBAAqB,GAAG,IAAA,8DAA4B,EAAC,cAAc,CAAC,CAAC;IAC9E,MAAM,KAAK,GAAG,IAAA,wBAAW,EAAC,aAAa,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/D,kFAAkF;IAClF,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,qBAAqB,CAAC;IAChD,0BAA0B;IAC1B,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE;QAChC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,yCAAyC;KAC/F;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAjBD,oFAiBC"}
@@ -0,0 +1,25 @@
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 { IModel } from "@esri/hub-common";
17
+ import { UserSession } from "@esri/solution-common";
18
+ /**
19
+ * Given a Model for a Web Experience, create the item in the Portal API
20
+ *
21
+ * @param model
22
+ * @param options
23
+ * @param authentication
24
+ */
25
+ export declare function createWebExperience(model: IModel, folderId: string, options: any, authentication: UserSession): Promise<IModel>;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWebExperience = void 0;
4
+ /** @license
5
+ * Copyright 2020 Esri
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ const hub_common_1 = require("@esri/hub-common");
20
+ const solution_common_1 = require("@esri/solution-common");
21
+ /**
22
+ * Given a Model for a Web Experience, create the item in the Portal API
23
+ *
24
+ * @param model
25
+ * @param options
26
+ * @param authentication
27
+ */
28
+ function createWebExperience(model, folderId, options, authentication) {
29
+ const resources = [];
30
+ // For unkown reasons we can not seem to spy on createItemInFolder
31
+ // so we will create-then-move for now
32
+ const createOptions = {
33
+ // need to serialize
34
+ item: (0, hub_common_1.serializeModel)(model),
35
+ authentication,
36
+ };
37
+ /* istanbul ignore else */
38
+ if (model.item.thumbnail) {
39
+ createOptions.params = {
40
+ // Pass thumbnail file in via params because item property is serialized, which discards a blob
41
+ thumbnail: model.item.thumbnail,
42
+ };
43
+ delete createOptions.item.thumbnail;
44
+ }
45
+ // Create the item
46
+ return ((0, solution_common_1.createItem)(createOptions)
47
+ .then((createResponse) => {
48
+ model.item.id = createResponse.id;
49
+ const savedThumbnail = model.item.thumbnail;
50
+ model = (0, hub_common_1.interpolateItemId)(model);
51
+ model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary
52
+ // Experiences store draft data in a resource attached to the item
53
+ // We'll just use the published data for the first "draft"
54
+ // changed from stringToBlob to objectToJsonBlob for issue #742
55
+ const draftResourceModel = (0, hub_common_1.cloneObject)(model.data);
56
+ resources.push({
57
+ name: "config.json",
58
+ prefix: "config",
59
+ file: (0, hub_common_1.objectToJsonBlob)(draftResourceModel),
60
+ });
61
+ // there may also be this image resources list
62
+ const imageListModel = (0, hub_common_1.cloneObject)(model.properties.imageResourcesList);
63
+ if (imageListModel) {
64
+ resources.push({
65
+ name: "image-resources-list.json",
66
+ prefix: "images",
67
+ file: (0, hub_common_1.stringToBlob)(JSON.stringify(imageListModel)),
68
+ });
69
+ }
70
+ delete model.properties;
71
+ // update the experience with the newly interpolated model
72
+ const updateOptions = {
73
+ item: (0, hub_common_1.serializeModel)(model),
74
+ authentication,
75
+ };
76
+ if (model.item.thumbnail) {
77
+ updateOptions.params = {
78
+ // Pass thumbnail file in via params because item property is serialized, which discards a blob
79
+ thumbnail: model.item.thumbnail,
80
+ };
81
+ delete updateOptions.item.thumbnail;
82
+ }
83
+ return Promise.all([(0, solution_common_1.restUpdateItem)(updateOptions), authentication.getUsername()]);
84
+ })
85
+ .then((responses) => {
86
+ const username = responses[1];
87
+ const failSafeAddItemResource = (0, hub_common_1.failSafe)(solution_common_1.addItemResource, {
88
+ success: true,
89
+ });
90
+ // upload the data and oembed resources
91
+ const resourceUploadPromises = resources.map((resource) => failSafeAddItemResource({
92
+ id: model.item.id,
93
+ owner: username,
94
+ resource: resource.file,
95
+ name: resource.name,
96
+ prefix: resource.prefix,
97
+ authentication,
98
+ }));
99
+ // fire and forget
100
+ return Promise.all(resourceUploadPromises);
101
+ })
102
+ // .then(() => {
103
+ // // TODO: Can we leave this to the main process?
104
+ // return uploadResourcesFromUrl(model, options.assets || [], authentication);
105
+ // })
106
+ .then(() => {
107
+ // Move it
108
+ return (0, solution_common_1.moveItem)({
109
+ itemId: model.item.id,
110
+ folderId,
111
+ authentication,
112
+ });
113
+ })
114
+ .then(() => {
115
+ return model;
116
+ }));
117
+ }
118
+ exports.createWebExperience = createWebExperience;
119
+ //# sourceMappingURL=create-web-experience.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-web-experience.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,iDAQ0B;AAE1B,2DAS+B;AAE/B;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,KAAa,EACb,QAAgB,EAChB,OAAY,EACZ,cAA2B;IAE3B,MAAM,SAAS,GAAU,EAAE,CAAC;IAE5B,kEAAkE;IAClE,sCAAsC;IACtC,MAAM,aAAa,GAAuB;QACxC,oBAAoB;QACpB,IAAI,EAAE,IAAA,2BAAc,EAAC,KAAK,CAAC;QAC3B,cAAc;KACf,CAAC;IAEF,0BAA0B;IAC1B,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE;QACxB,aAAa,CAAC,MAAM,GAAG;YACrB,+FAA+F;YAC/F,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS;SAChC,CAAC;QACF,OAAO,aAAa,C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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 { UserSession } from "@esri/solution-common";
17
+ /**
18
+ * Returns the subdomain for an experience based on the api the session is
19
+ * authenticated against
20
+ *
21
+ * @param authentication UserSession
22
+ */
23
+ export declare function getExperienceSubdomain(authentication: UserSession): string;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExperienceSubdomain = void 0;
4
+ /**
5
+ * Returns the subdomain for an experience based on the api the session is
6
+ * authenticated against
7
+ *
8
+ * @param authentication UserSession
9
+ */
10
+ function getExperienceSubdomain(authentication) {
11
+ const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
12
+ // TODO: Sort out how we locate experiences on portal?
13
+ let result;
14
+ if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
15
+ result = "experienceqa";
16
+ }
17
+ else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
18
+ result = "experiencedev";
19
+ }
20
+ else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
21
+ result = "experience";
22
+ }
23
+ return result;
24
+ }
25
+ exports.getExperienceSubdomain = getExperienceSubdomain;
26
+ //# sourceMappingURL=get-experience-subdomain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-experience-subdomain.js","sourceRoot":"","sources":["../../../src/helpers/get-experience-subdomain.ts"],"names":[],"mappings":";;;AAiBA;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,cAA2B;IAChE,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,IAAI,qCAAqC,CAAC;IACjF,sDAAsD;IACtD,IAAI,MAAM,CAAC;IACX,IAAI,SAAS,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;QACnD,MAAM,GAAG,cAAc,CAAC;KACzB;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE;QAC/D,MAAM,GAAG,eAAe,CAAC;KAC1B;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE;QACtD,MAAM,GAAG,YAAY,CAAC;KACvB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,wDAYC"}
@@ -0,0 +1,23 @@
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 { IModel } from "@esri/hub-common";
17
+ /**
18
+ * Given an Web Experience model, extract out all the
19
+ * items it depends on from the `dataSources` hash
20
+ *
21
+ * @param model IModel
22
+ */
23
+ export declare function getWebExperienceDependencies(model: IModel): any[];
@@ -0,0 +1,33 @@
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.getWebExperienceDependencies = void 0;
19
+ const hub_common_1 = require("@esri/hub-common");
20
+ /**
21
+ * Given an Web Experience model, extract out all the
22
+ * items it depends on from the `dataSources` hash
23
+ *
24
+ * @param model IModel
25
+ */
26
+ function getWebExperienceDependencies(model) {
27
+ const dataSources = (0, hub_common_1.getProp)(model, "data.dataSources") || {};
28
+ return Object.keys(dataSources).reduce((acc, key) => {
29
+ return (0, hub_common_1.maybePush)((0, hub_common_1.getProp)(dataSources, `${key}.itemId`), acc);
30
+ }, []);
31
+ }
32
+ exports.getWebExperienceDependencies = getWebExperienceDependencies;
33
+ //# sourceMappingURL=get-web-experience-dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-web-experience-dependencies.js","sourceRoot":"","sources":["../../../src/helpers/get-web-experience-dependencies.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAA8D;AAE9D;;;;;GAKG;AACH,SAAgB,4BAA4B,CAAC,KAAa;IACxD,MAAM,WAAW,GAAG,IAAA,oBAAO,EAAC,KAAK,EAAE,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAClD,OAAO,IAAA,sBAAS,EAAC,IAAA,oBAAO,EAAC,WAAW,EAAE,GAAG,GAAG,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;IAC/D,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AALD,oEAKC"}
@@ -0,0 +1,23 @@
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 { UserSession } from "@esri/solution-common";
17
+ /**
18
+ * For a given environment Prod/qa/dev/portal
19
+ * return the correct storymaps base url
20
+ *
21
+ * @param authentication
22
+ */
23
+ export declare function getWebExperiencepUrlTemplate(authentication: UserSession): string;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWebExperiencepUrlTemplate = void 0;
4
+ const get_experience_subdomain_1 = require("./get-experience-subdomain");
5
+ /**
6
+ * For a given environment Prod/qa/dev/portal
7
+ * return the correct storymaps base url
8
+ *
9
+ * @param authentication
10
+ */
11
+ function getWebExperiencepUrlTemplate(authentication) {
12
+ let baseUrl = "";
13
+ const subdomain = (0, get_experience_subdomain_1.getExperienceSubdomain)(authentication);
14
+ if (subdomain) {
15
+ baseUrl = `https://${subdomain}.arcgis.com/experience/{{appid}}`;
16
+ }
17
+ else {
18
+ // we're on portal
19
+ // chop off the /sharing/rest to get the baseUrl
20
+ const portalBaseUrl = authentication.portal.replace("/sharing/rest", "");
21
+ baseUrl = `${portalBaseUrl}/apps/experiencebuilder/?id={{appid}}`;
22
+ }
23
+ return baseUrl;
24
+ }
25
+ exports.getWebExperiencepUrlTemplate = getWebExperiencepUrlTemplate;
26
+ //# sourceMappingURL=get-web-experience-url-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-web-experience-url-template.js","sourceRoot":"","sources":["../../../src/helpers/get-web-experience-url-template.ts"],"names":[],"mappings":";;;AAgBA,yEAAoE;AACpE;;;;;GAKG;AACH,SAAgB,4BAA4B,CAAC,cAA2B;IACtE,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,MAAM,SAAS,GAAG,IAAA,iDAAsB,EAAC,cAAc,CAAC,CAAC;IACzD,IAAI,SAAS,EAAE;QACb,OAAO,GAAG,WAAW,SAAS,kCAAkC,CAAC;KAClE;SAAM;QACL,kBAAkB;QAClB,gDAAgD;QAChD,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QACzE,OAAO,GAAG,GAAG,aAAa,uCAAuC,CAAC;KACnE;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAdD,oEAcC"}
@@ -0,0 +1,17 @@
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
+ import * as WebExperienceProcessor from "./web-experience-processor";
17
+ export { WebExperienceProcessor };
@@ -0,0 +1,22 @@
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.WebExperienceProcessor = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const WebExperienceProcessor = tslib_1.__importStar(require("./web-experience-processor"));
21
+ exports.WebExperienceProcessor = WebExperienceProcessor;
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,2FAAqE;AAE5D,wDAAsB"}
@@ -0,0 +1,50 @@
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 and deployment of web-experience item types.
18
+ *
19
+ * @module solution-web-experience
20
+ */
21
+ import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse, IUpdateItemResponse } from "@esri/solution-common";
22
+ /**
23
+ * Convert a Web Experience item into a Template
24
+ *
25
+ * @param itemInfo
26
+ * @param destAuthentication Credentials for requests to the destination organization
27
+ * @param srcAuthentication Credentials for requests to source items
28
+ * @param isGroup
29
+ */
30
+ export declare function convertItemToTemplate(itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
31
+ /**
32
+ * Create a Web Experience from a Template
33
+ *
34
+ * @param template
35
+ * @param templateDictionary
36
+ * @param destinationAuthentication
37
+ * @param itemProgressCallback
38
+ */
39
+ export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
40
+ /**
41
+ * Post-Process an Experience
42
+ *
43
+ * @param {string} itemId The item ID
44
+ * @param {string} type The template type
45
+ * @param {any[]} itemInfos Array of \{id: 'ef3', type: 'Web Map'\} objects
46
+ * @param {any} templateDictionary The template dictionary
47
+ * @param {UserSession} authentication The destination session info
48
+ * @returns Promise resolving to successfulness of update
49
+ */
50
+ export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: IItemTemplate, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<IUpdateItemResponse>;