@esri/solution-storymap 1.1.2 → 1.1.3

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 (47) hide show
  1. package/dist/esm/classic-storymap-processor.js +3 -3
  2. package/dist/esm/classic-storymap-processor.js.map +1 -1
  3. package/dist/esm/helpers/convert-storymap-to-template.js +10 -10
  4. package/dist/esm/helpers/convert-storymap-to-template.js.map +1 -1
  5. package/dist/esm/helpers/create-storymap-model-from-template.js +4 -4
  6. package/dist/esm/helpers/create-storymap-model-from-template.js.map +1 -1
  7. package/dist/esm/helpers/create-storymap.js +14 -14
  8. package/dist/esm/helpers/create-storymap.js.map +1 -1
  9. package/dist/esm/helpers/get-portal-env.js +2 -2
  10. package/dist/esm/helpers/get-portal-env.js.map +1 -1
  11. package/dist/esm/helpers/get-storymap-base-url.js +5 -5
  12. package/dist/esm/helpers/get-storymap-base-url.js.map +1 -1
  13. package/dist/esm/helpers/get-storymap-dependencies.js +4 -4
  14. package/dist/esm/helpers/get-storymap-dependencies.js.map +1 -1
  15. package/dist/esm/helpers/get-storymap-subdomain.js +2 -2
  16. package/dist/esm/helpers/get-storymap-subdomain.js.map +1 -1
  17. package/dist/esm/helpers/remap-webmap-keys.js +6 -7
  18. package/dist/esm/helpers/remap-webmap-keys.js.map +1 -1
  19. package/dist/esm/storymap-processor.js +20 -18
  20. package/dist/esm/storymap-processor.js.map +1 -1
  21. package/dist/node/classic-storymap-processor.js +4 -4
  22. package/dist/node/classic-storymap-processor.js.map +1 -1
  23. package/dist/node/helpers/convert-storymap-to-template.js +14 -14
  24. package/dist/node/helpers/convert-storymap-to-template.js.map +1 -1
  25. package/dist/node/helpers/create-storymap-model-from-template.js +8 -8
  26. package/dist/node/helpers/create-storymap-model-from-template.js.map +1 -1
  27. package/dist/node/helpers/create-storymap.js +16 -16
  28. package/dist/node/helpers/create-storymap.js.map +1 -1
  29. package/dist/node/helpers/get-portal-env.js +2 -2
  30. package/dist/node/helpers/get-portal-env.js.map +1 -1
  31. package/dist/node/helpers/get-storymap-base-url.js +6 -6
  32. package/dist/node/helpers/get-storymap-base-url.js.map +1 -1
  33. package/dist/node/helpers/get-storymap-dependencies.js +5 -5
  34. package/dist/node/helpers/get-storymap-dependencies.js.map +1 -1
  35. package/dist/node/helpers/get-storymap-subdomain.js +2 -2
  36. package/dist/node/helpers/get-storymap-subdomain.js.map +1 -1
  37. package/dist/node/helpers/remap-webmap-keys.js +7 -8
  38. package/dist/node/helpers/remap-webmap-keys.js.map +1 -1
  39. package/dist/node/index.js +2 -2
  40. package/dist/node/index.js.map +1 -1
  41. package/dist/node/storymap-processor.js +26 -24
  42. package/dist/node/storymap-processor.js.map +1 -1
  43. package/dist/umd/storymap.umd.js +533 -557
  44. package/dist/umd/storymap.umd.js.map +1 -1
  45. package/dist/umd/storymap.umd.min.js +3 -3
  46. package/dist/umd/storymap.umd.min.js.map +1 -1
  47. package/package.json +11 -11
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-storymap - v1.1.2 - Apache-2.0
2
+ * @esri/solution-storymap - v1.1.3 - Apache-2.0
3
3
  * Copyright (c) 2018-2021 Esri, Inc.
4
- * Mon Aug 30 2021 23:59:29 GMT-0700 (Pacific Daylight Time)
4
+ * Mon Oct 18 2021 09:02:11 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.
@@ -16,576 +16,552 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  (function (global, factory) {
19
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common'), require('@esri/hub-common'), require('@esri/arcgis-rest-portal')) :
20
- typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common', '@esri/hub-common', '@esri/arcgis-rest-portal'], factory) :
21
- (global = global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution, global.arcgisHub, global.arcgisRest));
19
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common'), require('@esri/hub-common'), require('@esri/arcgis-rest-portal')) :
20
+ typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common', '@esri/hub-common', '@esri/arcgis-rest-portal'], factory) :
21
+ (global = global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution, global.arcgisHub, global.arcgisRest));
22
22
  }(this, (function (exports, common, hubCommon, arcgisRestPortal) { 'use strict';
23
23
 
24
- /*! *****************************************************************************
25
- Copyright (c) Microsoft Corporation. All rights reserved.
26
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
27
- this file except in compliance with the License. You may obtain a copy of the
28
- License at http://www.apache.org/licenses/LICENSE-2.0
29
-
30
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
31
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
32
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
33
- MERCHANTABLITY OR NON-INFRINGEMENT.
34
-
35
- See the Apache Version 2.0 License for specific language governing permissions
36
- and limitations under the License.
37
- ***************************************************************************** */
38
-
39
- var __assign = function() {
40
- __assign = Object.assign || function __assign(t) {
41
- for (var s, i = 1, n = arguments.length; i < n; i++) {
42
- s = arguments[i];
43
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
44
- }
45
- return t;
46
- };
47
- return __assign.apply(this, arguments);
48
- };
24
+ /** @license
25
+ * Copyright 2018 Esri
26
+ *
27
+ * Licensed under the Apache License, Version 2.0 (the "License");
28
+ * you may not use this file except in compliance with the License.
29
+ * You may obtain a copy of the License at
30
+ *
31
+ * http://www.apache.org/licenses/LICENSE-2.0
32
+ *
33
+ * Unless required by applicable law or agreed to in writing, software
34
+ * distributed under the License is distributed on an "AS IS" BASIS,
35
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36
+ * See the License for the specific language governing permissions and
37
+ * limitations under the License.
38
+ */
39
+ /**
40
+ * For some reason, the webmap resource key names are fancier than other resource keys
41
+ * They look like this: r-<webmap-item-id>-<timestamp>
42
+ * This interpolation is hard to accomplish given our current setup, so we're just overwriting
43
+ * them with "webmap0", "webmap1" and so forth. This _seems_ to make no difference.
44
+ *
45
+ * @param model
46
+ */
47
+ function remapWebmapKeys(resources = {}) {
48
+ let webmapCounter = 0;
49
+ return Object.keys(resources).reduce((acc, key) => {
50
+ if (hubCommon.getProp(resources, `${key}.type`) === "webmap") {
51
+ if (key !== `webmap${webmapCounter}`) {
52
+ acc.push({
53
+ original: key,
54
+ updated: `webmap${webmapCounter}`
55
+ });
56
+ webmapCounter++;
57
+ }
58
+ }
59
+ return acc;
60
+ }, []);
61
+ }
49
62
 
50
- /** @license
51
- * Copyright 2018 Esri
52
- *
53
- * Licensed under the Apache License, Version 2.0 (the "License");
54
- * you may not use this file except in compliance with the License.
55
- * You may obtain a copy of the License at
56
- *
57
- * http://www.apache.org/licenses/LICENSE-2.0
58
- *
59
- * Unless required by applicable law or agreed to in writing, software
60
- * distributed under the License is distributed on an "AS IS" BASIS,
61
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
62
- * See the License for the specific language governing permissions and
63
- * limitations under the License.
64
- */
65
- /**
66
- * For some reason, the webmap resource key names are fancier than other resource keys
67
- * They look like this: r-<webmap-item-id>-<timestamp>
68
- * This interpolation is hard to accomplish given our current setup, so we're just overwriting
69
- * them with "webmap0", "webmap1" and so forth. This _seems_ to make no difference.
70
- *
71
- * @param model
72
- */
73
- function remapWebmapKeys(resources) {
74
- if (resources === void 0) { resources = {}; }
75
- var webmapCounter = 0;
76
- return Object.keys(resources).reduce(function (acc, key) {
77
- if (hubCommon.getProp(resources, key + ".type") === "webmap") {
78
- if (key !== "webmap" + webmapCounter) {
79
- acc.push({
80
- original: key,
81
- updated: "webmap" + webmapCounter
82
- });
83
- webmapCounter++;
84
- }
85
- }
86
- return acc;
87
- }, []);
88
- }
63
+ /** @license
64
+ * Copyright 2018 Esri
65
+ *
66
+ * Licensed under the Apache License, Version 2.0 (the "License");
67
+ * you may not use this file except in compliance with the License.
68
+ * You may obtain a copy of the License at
69
+ *
70
+ * http://www.apache.org/licenses/LICENSE-2.0
71
+ *
72
+ * Unless required by applicable law or agreed to in writing, software
73
+ * distributed under the License is distributed on an "AS IS" BASIS,
74
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
75
+ * See the License for the specific language governing permissions and
76
+ * limitations under the License.
77
+ */
78
+ /**
79
+ * Extract a list of Items this storymap depends on
80
+ * At this point we are just extracting webmaps
81
+ *
82
+ * @param model IModel
83
+ */
84
+ function getStoryMapDependencies(model) {
85
+ const resources = hubCommon.getProp(model, "data.resources") || {};
86
+ return Object.keys(resources).reduce((acc, key) => {
87
+ if (hubCommon.getProp(resources, `${key}.type`) === "webmap") {
88
+ acc.push(hubCommon.getProp(resources, `${key}.data.itemId`));
89
+ }
90
+ return acc;
91
+ }, []);
92
+ }
89
93
 
90
- /** @license
91
- * Copyright 2018 Esri
92
- *
93
- * Licensed under the Apache License, Version 2.0 (the "License");
94
- * you may not use this file except in compliance with the License.
95
- * You may obtain a copy of the License at
96
- *
97
- * http://www.apache.org/licenses/LICENSE-2.0
98
- *
99
- * Unless required by applicable law or agreed to in writing, software
100
- * distributed under the License is distributed on an "AS IS" BASIS,
101
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
102
- * See the License for the specific language governing permissions and
103
- * limitations under the License.
104
- */
105
- /**
106
- * Extract a list of Items this storymap depends on
107
- * At this point we are just extracting webmaps
108
- *
109
- * @param model IModel
110
- */
111
- function getStoryMapDependencies(model) {
112
- var resources = hubCommon.getProp(model, "data.resources") || {};
113
- return Object.keys(resources).reduce(function (acc, key) {
114
- if (hubCommon.getProp(resources, key + ".type") === "webmap") {
115
- acc.push(hubCommon.getProp(resources, key + ".data.itemId"));
116
- }
117
- return acc;
118
- }, []);
119
- }
94
+ /** @license
95
+ * Copyright 2018 Esri
96
+ *
97
+ * Licensed under the Apache License, Version 2.0 (the "License");
98
+ * you may not use this file except in compliance with the License.
99
+ * You may obtain a copy of the License at
100
+ *
101
+ * http://www.apache.org/licenses/LICENSE-2.0
102
+ *
103
+ * Unless required by applicable law or agreed to in writing, software
104
+ * distributed under the License is distributed on an "AS IS" BASIS,
105
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
106
+ * See the License for the specific language governing permissions and
107
+ * limitations under the License.
108
+ */
109
+ /**
110
+ * Convert a StoryMap IModel to an IItemTemplate
111
+ *
112
+ * @param model
113
+ * @param authentication
114
+ */
115
+ function convertStoryMapToTemplate(model) {
116
+ const tmpl = common.createPlaceholderTemplate(model.item.id, model.item.type);
117
+ tmpl.key = `${hubCommon.propifyString(model.item.title)}_${hubCommon.createId("i")}`;
118
+ const clone = hubCommon.cloneObject(model);
119
+ tmpl.data = clone.data;
120
+ tmpl.item = hubCommon.normalizeSolutionTemplateItem(clone.item);
121
+ // templatize the url
122
+ tmpl.item.url = "{{storyMapTemplateUrl}}";
123
+ // Storymap Webmap Resources have complex keys that we need to remap
124
+ const webmapRemaps = remapWebmapKeys(tmpl.data.resources);
125
+ // and then replace in the rest of the structure
126
+ webmapRemaps.forEach(remap => {
127
+ tmpl.data.resources[remap.updated] = hubCommon.cloneObject(tmpl.data.resources[remap.original]);
128
+ delete tmpl.data.resources[remap.original];
129
+ tmpl.data.nodes = hubCommon.deepStringReplace(tmpl.data.nodes, remap.original, remap.updated);
130
+ });
131
+ // use typeKeyword to mark item as published
132
+ // Note: Hub team decided to discard unpublished drafts when creating a template
133
+ const typeKeywords = tmpl.item.typeKeywords;
134
+ if (typeKeywords.indexOf(unPublishedChangesKW) !== -1) {
135
+ tmpl.item.typeKeywords = [publishedChangesKW].concat(tmpl.item.typeKeywords.filter((word) => word !== unPublishedChangesKW));
136
+ }
137
+ tmpl.properties = {};
138
+ tmpl.properties.draftFileName = "draft_{{timestamp}}.json";
139
+ Object.assign(tmpl.properties, oEmbedTemplates);
140
+ tmpl.dependencies = getStoryMapDependencies(model);
141
+ return Promise.resolve(tmpl);
142
+ // TODO: For now, we let the generic process handle item resources
143
+ // However, many newer item types have complex type-specific resource handling
144
+ // requirements so this code may be useful in the future
145
+ // ------------------------------------------------------
146
+ // return getItemResources(tmpl.itemId, hubRequestOptions)
147
+ // .then((response) => {
148
+ // tmpl.resources = response.resources.map(e => e.resource)
149
+ // // Don't directly copy oembed resources because we need to template these
150
+ // // Also, discard draft version of the storymap itself
151
+ // .filter(filename => !filename.includes('oembed') && filename.search(/draft_[0-9]+.json/) === -1);
152
+ // return tmpl;
153
+ // });
154
+ }
155
+ // Internal constants
156
+ const unPublishedChangesKW = "smstatusunpublishedchanges";
157
+ const publishedChangesKW = "smstatuspublished";
158
+ /**
159
+ * Template for oEmbed
160
+ */
161
+ const oEmbedTemplates = {
162
+ oembed: {
163
+ version: "1.0",
164
+ type: "rich",
165
+ title: "Example StoryMap",
166
+ url: "{{storyMapTemplateUrl}}",
167
+ provider_name: "ArcGIS StoryMaps",
168
+ provider_url: "{{storyMapBaseUrl}}",
169
+ width: 800,
170
+ height: 600,
171
+ thumbnail_url: "{{storyMapThumbnailUrl}}",
172
+ thumbnail_height: "100.5",
173
+ thumbnail_width: "400",
174
+ html: '<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',
175
+ cache_age: 86400
176
+ },
177
+ oembedXML: '<?xml version="1.0" encoding="utf-8" standalone="yes"?>\n <oembed>\n <version>1.0</version>\n <type>rich</type>\n <title>Example StoryMap</title>\n <url>{{storyMapTemplateUrl}}</url>\n <author_name>undefined</author_name>\n <provider_name>ArcGIS StoryMaps</provider_name>\n <provider_url>{{storyMapBaseUrl}}</provider_url>\n <width>800</width>\n <height>600</height>\n <thumbnail_url>{{storyMapThumbnailUrl}}</thumbnail_url>\n <thumbnail_height>100.5</thumbnail_height>\n <thumbnail_width>400</thumbnail_width>\n <html><iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen="true"></iframe></html>\n <cache_age>86400</cache_age>\n </oembed>'
178
+ };
120
179
 
121
- /** @license
122
- * Copyright 2018 Esri
123
- *
124
- * Licensed under the Apache License, Version 2.0 (the "License");
125
- * you may not use this file except in compliance with the License.
126
- * You may obtain a copy of the License at
127
- *
128
- * http://www.apache.org/licenses/LICENSE-2.0
129
- *
130
- * Unless required by applicable law or agreed to in writing, software
131
- * distributed under the License is distributed on an "AS IS" BASIS,
132
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133
- * See the License for the specific language governing permissions and
134
- * limitations under the License.
135
- */
136
- /**
137
- * Convert a StoryMap IModel to an IItemTemplate
138
- *
139
- * @param model
140
- * @param authentication
141
- */
142
- function convertStoryMapToTemplate(model) {
143
- var tmpl = common.createPlaceholderTemplate(model.item.id, model.item.type);
144
- tmpl.key = hubCommon.propifyString(model.item.title) + "_" + hubCommon.createId("i");
145
- var clone = hubCommon.cloneObject(model);
146
- tmpl.data = clone.data;
147
- tmpl.item = hubCommon.normalizeSolutionTemplateItem(clone.item);
148
- // templatize the url
149
- tmpl.item.url = "{{storyMapTemplateUrl}}";
150
- // Storymap Webmap Resources have complex keys that we need to remap
151
- var webmapRemaps = remapWebmapKeys(tmpl.data.resources);
152
- // and then replace in the rest of the structure
153
- webmapRemaps.forEach(function (remap) {
154
- tmpl.data.resources[remap.updated] = hubCommon.cloneObject(tmpl.data.resources[remap.original]);
155
- delete tmpl.data.resources[remap.original];
156
- tmpl.data.nodes = hubCommon.deepStringReplace(tmpl.data.nodes, remap.original, remap.updated);
157
- });
158
- // use typeKeyword to mark item as published
159
- // Note: Hub team decided to discard unpublished drafts when creating a template
160
- var typeKeywords = tmpl.item.typeKeywords;
161
- if (typeKeywords.indexOf(unPublishedChangesKW) !== -1) {
162
- tmpl.item.typeKeywords = [publishedChangesKW].concat(tmpl.item.typeKeywords.filter(function (word) { return word !== unPublishedChangesKW; }));
163
- }
164
- tmpl.properties = {};
165
- tmpl.properties.draftFileName = "draft_{{timestamp}}.json";
166
- Object.assign(tmpl.properties, oEmbedTemplates);
167
- tmpl.dependencies = getStoryMapDependencies(model);
168
- return Promise.resolve(tmpl);
169
- // TODO: For now, we let the generic process handle item resources
170
- // However, many newer item types have complex type-specific resource handling
171
- // requirements so this code may be useful in the future
172
- // ------------------------------------------------------
173
- // return getItemResources(tmpl.itemId, hubRequestOptions)
174
- // .then((response) => {
175
- // tmpl.resources = response.resources.map(e => e.resource)
176
- // // Don't directly copy oembed resources because we need to template these
177
- // // Also, discard draft version of the storymap itself
178
- // .filter(filename => !filename.includes('oembed') && filename.search(/draft_[0-9]+.json/) === -1);
179
- // return tmpl;
180
- // });
181
- }
182
- // Internal constants
183
- var unPublishedChangesKW = "smstatusunpublishedchanges";
184
- var publishedChangesKW = "smstatuspublished";
185
- /**
186
- * Template for oEmbed
187
- */
188
- var oEmbedTemplates = {
189
- oembed: {
190
- version: "1.0",
191
- type: "rich",
192
- title: "Example StoryMap",
193
- url: "{{storyMapTemplateUrl}}",
194
- provider_name: "ArcGIS StoryMaps",
195
- provider_url: "{{storyMapBaseUrl}}",
196
- width: 800,
197
- height: 600,
198
- thumbnail_url: "{{storyMapThumbnailUrl}}",
199
- thumbnail_height: "100.5",
200
- thumbnail_width: "400",
201
- html: '<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',
202
- cache_age: 86400
203
- },
204
- oembedXML: '<?xml version="1.0" encoding="utf-8" standalone="yes"?>\n <oembed>\n <version>1.0</version>\n <type>rich</type>\n <title>Example StoryMap</title>\n <url>{{storyMapTemplateUrl}}</url>\n <author_name>undefined</author_name>\n <provider_name>ArcGIS StoryMaps</provider_name>\n <provider_url>{{storyMapBaseUrl}}</provider_url>\n <width>800</width>\n <height>600</height>\n <thumbnail_url>{{storyMapThumbnailUrl}}</thumbnail_url>\n <thumbnail_height>100.5</thumbnail_height>\n <thumbnail_width>400</thumbnail_width>\n <html><iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen="true"></iframe></html>\n <cache_age>86400</cache_age>\n </oembed>'
205
- };
180
+ function getPortalEnv(authentication) {
181
+ const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
182
+ let result = "portal";
183
+ if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
184
+ result = "qaext";
185
+ }
186
+ else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
187
+ result = "devext";
188
+ }
189
+ else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
190
+ result = "www";
191
+ }
192
+ return result;
193
+ }
206
194
 
207
- function getPortalEnv(authentication) {
208
- var portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
209
- var result = "portal";
210
- if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
211
- result = "qaext";
212
- }
213
- else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
214
- result = "devext";
215
- }
216
- else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
217
- result = "www";
218
- }
219
- return result;
220
- }
195
+ function getStoryMapSubdomain(authentication) {
196
+ const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
197
+ // TODO: Sort out how we locate storymaps on portal?
198
+ let result;
199
+ if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
200
+ result = "storymapsqa";
201
+ }
202
+ else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
203
+ result = "storymapsdev";
204
+ }
205
+ else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
206
+ result = "storymaps";
207
+ }
208
+ return result;
209
+ }
221
210
 
222
- function getStoryMapSubdomain(authentication) {
223
- var portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
224
- // TODO: Sort out how we locate storymaps on portal?
225
- var result;
226
- if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
227
- result = "storymapsqa";
228
- }
229
- else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
230
- result = "storymapsdev";
231
- }
232
- else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
233
- result = "storymaps";
234
- }
235
- return result;
236
- }
211
+ /**
212
+ * For a given environment Prod/qa/dev/portal
213
+ * return the correct storymaps base url
214
+ *
215
+ * @param authentication
216
+ */
217
+ function getStoryMapBaseUrl(authentication) {
218
+ let baseUrl = "";
219
+ const subdomain = getStoryMapSubdomain(authentication);
220
+ if (subdomain) {
221
+ baseUrl = `https://${subdomain}.arcgis.com`;
222
+ }
223
+ else {
224
+ // we're on portal
225
+ // chop off the /sharing/rest to get the baseUrl
226
+ const portalBaseUrl = authentication.portal.replace("/sharing/rest", "");
227
+ baseUrl = `${portalBaseUrl}/apps/storymaps`;
228
+ }
229
+ return baseUrl;
230
+ }
237
231
 
238
- /**
239
- * For a given environment Prod/qa/dev/portal
240
- * return the correct storymaps base url
241
- *
242
- * @param authentication
243
- */
244
- function getStoryMapBaseUrl(authentication) {
245
- var baseUrl = "";
246
- var subdomain = getStoryMapSubdomain(authentication);
247
- if (subdomain) {
248
- baseUrl = "https://" + subdomain + ".arcgis.com";
249
- }
250
- else {
251
- // we're on portal
252
- // chop off the /sharing/rest to get the baseUrl
253
- var portalBaseUrl = authentication.portal.replace("/sharing/rest", "");
254
- baseUrl = portalBaseUrl + "/apps/storymaps";
255
- }
256
- return baseUrl;
257
- }
232
+ /** @license
233
+ * Copyright 2020 Esri
234
+ *
235
+ * Licensed under the Apache License, Version 2.0 (the "License");
236
+ * you may not use this file except in compliance with the License.
237
+ * You may obtain a copy of the License at
238
+ *
239
+ * http://www.apache.org/licenses/LICENSE-2.0
240
+ *
241
+ * Unless required by applicable law or agreed to in writing, software
242
+ * distributed under the License is distributed on an "AS IS" BASIS,
243
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
244
+ * See the License for the specific language governing permissions and
245
+ * limitations under the License.
246
+ */
247
+ function createStoryMapModelFromTemplate(templateModel, settings, transforms, authentication) {
248
+ const timestamp = new Date().getTime();
249
+ // Keep these around in case we encounter some old templates
250
+ settings.agoenv = getPortalEnv(authentication);
251
+ settings.smBase = getStoryMapSubdomain(authentication);
252
+ settings.timestamp = new Date().getTime();
253
+ // These are used in the oembed resource, as well as the item url
254
+ // they have `{{appid}}` in them so that the id of the created item
255
+ // will be interpolated into it after the item is created
256
+ settings.storyMapBaseUrl = getStoryMapBaseUrl(authentication);
257
+ settings.storyMapTemplateUrl = `${settings.storyMapBaseUrl}/stories/{{appid}}`;
258
+ settings.storyMapThumnailUrl = `${authentication.portal}/content/items/{{appid}}/info/thumbnail/thumbnail.jpg/?w=400&d=${timestamp}`;
259
+ const model = hubCommon.interpolate(templateModel, settings, transforms);
260
+ return Promise.resolve(model);
261
+ }
258
262
 
259
- /** @license
260
- * Copyright 2020 Esri
261
- *
262
- * Licensed under the Apache License, Version 2.0 (the "License");
263
- * you may not use this file except in compliance with the License.
264
- * You may obtain a copy of the License at
265
- *
266
- * http://www.apache.org/licenses/LICENSE-2.0
267
- *
268
- * Unless required by applicable law or agreed to in writing, software
269
- * distributed under the License is distributed on an "AS IS" BASIS,
270
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
271
- * See the License for the specific language governing permissions and
272
- * limitations under the License.
273
- */
274
- function createStoryMapModelFromTemplate(templateModel, settings, transforms, authentication) {
275
- var timestamp = new Date().getTime();
276
- // Keep these around in case we encounter some old templates
277
- settings.agoenv = getPortalEnv(authentication);
278
- settings.smBase = getStoryMapSubdomain(authentication);
279
- settings.timestamp = new Date().getTime();
280
- // These are used in the oembed resource, as well as the item url
281
- // they have `{{appid}}` in them so that the id of the created item
282
- // will be interpolated into it after the item is created
283
- settings.storyMapBaseUrl = getStoryMapBaseUrl(authentication);
284
- settings.storyMapTemplateUrl = settings.storyMapBaseUrl + "/stories/{{appid}}";
285
- settings.storyMapThumnailUrl = authentication.portal + "/content/items/{{appid}}/info/thumbnail/thumbnail.jpg/?w=400&d=" + timestamp;
286
- var model = hubCommon.interpolate(templateModel, settings, transforms);
287
- return Promise.resolve(model);
288
- }
263
+ /** @license
264
+ * Copyright 2020 Esri
265
+ *
266
+ * Licensed under the Apache License, Version 2.0 (the "License");
267
+ * you may not use this file except in compliance with the License.
268
+ * You may obtain a copy of the License at
269
+ *
270
+ * http://www.apache.org/licenses/LICENSE-2.0
271
+ *
272
+ * Unless required by applicable law or agreed to in writing, software
273
+ * distributed under the License is distributed on an "AS IS" BASIS,
274
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
275
+ * See the License for the specific language governing permissions and
276
+ * limitations under the License.
277
+ */
278
+ /**
279
+ * Create a StoryMap from an interpolated template
280
+ *
281
+ * @param model
282
+ * @param options
283
+ * @param authentication
284
+ */
285
+ function createStoryMap(model, folderId, options, authentication) {
286
+ // create an array to hold well-known resources
287
+ // that we have to generate from the passed in model
288
+ const resources = [];
289
+ // For unknown reasons we can not seem to spy on createItemInFolder
290
+ // so we will create-then-move for now
291
+ const createOptions = {
292
+ // need to serialize
293
+ item: hubCommon.serializeModel(model),
294
+ authentication
295
+ };
296
+ /* istanbul ignore else */
297
+ if (model.item.thumbnail) {
298
+ createOptions.params = {
299
+ // Pass thumbnail file in via params because item property is serialized, which discards a blob
300
+ thumbnail: model.item.thumbnail
301
+ };
302
+ delete createOptions.item.thumbnail;
303
+ }
304
+ // Create the item
305
+ return arcgisRestPortal.createItem(createOptions)
306
+ .then((createResponse) => {
307
+ // hold the id in the model
308
+ model.item.id = createResponse.id;
309
+ // and re-interpolate the item id
310
+ model = hubCommon.interpolateItemId(model);
311
+ // Compute the item url based on current environment
312
+ // Storymaps store draft data in a timestamped resource attached to the item
313
+ // We'll just use the published data for the first "draft"
314
+ resources.push({
315
+ name: model.properties.draftFileName,
316
+ file: hubCommon.stringToBlob(JSON.stringify(model.data))
317
+ });
318
+ resources.push({
319
+ name: "oembed.json",
320
+ file: hubCommon.stringToBlob(JSON.stringify(model.properties.oembed))
321
+ });
322
+ resources.push({
323
+ name: "oembed.xml",
324
+ file: hubCommon.stringToBlob(model.properties.oembedXML)
325
+ });
326
+ // remove the properties hash now that we've gotten what we need
327
+ delete model.properties;
328
+ // update the item with the newly re-interpolated model
329
+ return Promise.all([
330
+ arcgisRestPortal.updateItem({
331
+ item: hubCommon.serializeModel(model),
332
+ authentication
333
+ }),
334
+ authentication.getUsername()
335
+ ]);
336
+ })
337
+ .then((responses) => {
338
+ const username = responses[1];
339
+ // add the resources
340
+ const failSafeAddItemResource = hubCommon.failSafe(arcgisRestPortal.addItemResource, {
341
+ success: true
342
+ });
343
+ const resourcePromises = resources.map(resource => {
344
+ return failSafeAddItemResource({
345
+ id: model.item.id,
346
+ owner: username,
347
+ resource: resource.file,
348
+ name: resource.name,
349
+ authentication
350
+ });
351
+ });
352
+ // Fire and forget as these are not critical-path
353
+ return Promise.all(resourcePromises);
354
+ })
355
+ .then(() => {
356
+ // Move it
357
+ return arcgisRestPortal.moveItem({
358
+ itemId: model.item.id,
359
+ folderId,
360
+ authentication
361
+ });
362
+ })
363
+ .then(() => {
364
+ return model;
365
+ });
366
+ }
289
367
 
290
- /** @license
291
- * Copyright 2020 Esri
292
- *
293
- * Licensed under the Apache License, Version 2.0 (the "License");
294
- * you may not use this file except in compliance with the License.
295
- * You may obtain a copy of the License at
296
- *
297
- * http://www.apache.org/licenses/LICENSE-2.0
298
- *
299
- * Unless required by applicable law or agreed to in writing, software
300
- * distributed under the License is distributed on an "AS IS" BASIS,
301
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
302
- * See the License for the specific language governing permissions and
303
- * limitations under the License.
304
- */
305
- /**
306
- * Create a StoryMap from an interpolated template
307
- *
308
- * @param model
309
- * @param options
310
- * @param authentication
311
- */
312
- function createStoryMap(model, folderId, options, authentication) {
313
- // create an array to hold well-known resources
314
- // that we have to generate from the passed in model
315
- var resources = [];
316
- // For unknown reasons we can not seem to spy on createItemInFolder
317
- // so we will create-then-move for now
318
- var createOptions = {
319
- // need to serialize
320
- item: hubCommon.serializeModel(model),
321
- authentication: authentication
322
- };
323
- /* istanbul ignore else */
324
- if (model.item.thumbnail) {
325
- createOptions.params = {
326
- // Pass thumbnail file in via params because item property is serialized, which discards a blob
327
- thumbnail: model.item.thumbnail
328
- };
329
- delete createOptions.item.thumbnail;
330
- }
331
- // Create the item
332
- return arcgisRestPortal.createItem(createOptions)
333
- .then(function (createResponse) {
334
- // hold the id in the model
335
- model.item.id = createResponse.id;
336
- // and re-interpolate the item id
337
- model = hubCommon.interpolateItemId(model);
338
- // Compute the item url based on current environment
339
- // Storymaps store draft data in a timestamped resource attached to the item
340
- // We'll just use the published data for the first "draft"
341
- resources.push({
342
- name: model.properties.draftFileName,
343
- file: hubCommon.stringToBlob(JSON.stringify(model.data))
344
- });
345
- resources.push({
346
- name: "oembed.json",
347
- file: hubCommon.stringToBlob(JSON.stringify(model.properties.oembed))
348
- });
349
- resources.push({
350
- name: "oembed.xml",
351
- file: hubCommon.stringToBlob(model.properties.oembedXML)
352
- });
353
- // remove the properties hash now that we've gotten what we need
354
- delete model.properties;
355
- // update the item with the newly re-interpolated model
356
- return Promise.all([
357
- arcgisRestPortal.updateItem({
358
- item: hubCommon.serializeModel(model),
359
- authentication: authentication
360
- }),
361
- authentication.getUsername()
362
- ]);
363
- })
364
- .then(function (responses) {
365
- var username = responses[1];
366
- // add the resources
367
- var failSafeAddItemResource = hubCommon.failSafe(arcgisRestPortal.addItemResource, {
368
- success: true
369
- });
370
- var resourcePromises = resources.map(function (resource) {
371
- return failSafeAddItemResource({
372
- id: model.item.id,
373
- owner: username,
374
- resource: resource.file,
375
- name: resource.name,
376
- authentication: authentication
377
- });
378
- });
379
- // Fire and forget as these are not critical-path
380
- return Promise.all(resourcePromises);
381
- })
382
- .then(function () {
383
- // Move it
384
- return arcgisRestPortal.moveItem({
385
- itemId: model.item.id,
386
- folderId: folderId,
387
- authentication: authentication
388
- });
389
- })
390
- .then(function () {
391
- return model;
392
- });
393
- }
368
+ /** @license
369
+ * Copyright 2018 Esri
370
+ *
371
+ * Licensed under the Apache License, Version 2.0 (the "License");
372
+ * you may not use this file except in compliance with the License.
373
+ * You may obtain a copy of the License at
374
+ *
375
+ * http://www.apache.org/licenses/LICENSE-2.0
376
+ *
377
+ * Unless required by applicable law or agreed to in writing, software
378
+ * distributed under the License is distributed on an "AS IS" BASIS,
379
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
380
+ * See the License for the specific language governing permissions and
381
+ * limitations under the License.
382
+ */
383
+ /**
384
+ * Convert a StoryMap to a template
385
+ *
386
+ * @param solutionItemId
387
+ * @param itemInfo
388
+ * @param authentication
389
+ */
390
+ function convertItemToTemplate(solutionItemId, itemInfo, authentication) {
391
+ const model = {
392
+ item: itemInfo,
393
+ data: {}
394
+ };
395
+ // fetch the data.json
396
+ return arcgisRestPortal.getItemData(itemInfo.id, { authentication })
397
+ .then(data => {
398
+ // append into the model
399
+ model.data = data;
400
+ // and use that to create a template
401
+ return convertStoryMapToTemplate(model);
402
+ })
403
+ .then(tmpl => {
404
+ return tmpl;
405
+ });
406
+ }
407
+ /**
408
+ * Create a StoryMap from the passed in template
409
+ *
410
+ * @param template
411
+ * @param templateDictionary
412
+ * @param destinationAuthentication
413
+ * @param itemProgressCallback
414
+ */
415
+ function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
416
+ // let the progress system know we've started...
417
+ const startStatus = itemProgressCallback(template.itemId, common.EItemProgressStatus.Started, 0);
418
+ // and if it returned false, just resolve out
419
+ if (!startStatus) {
420
+ return Promise.resolve(common.generateEmptyCreationResponse(template.type));
421
+ }
422
+ // ensure we have a solution object in the templateDictionary hash
423
+ if (!templateDictionary.solution) {
424
+ templateDictionary.solution = {};
425
+ }
426
+ // .title should always be set on the templateDictionary
427
+ templateDictionary.solution.title = templateDictionary.title;
428
+ // TODO: Determine if we need any transforms in this new env
429
+ const transforms = {};
430
+ // create an object to hold the created site through
431
+ // subsequent promise calls
432
+ let model;
433
+ // Create the "siteModel" from the template. Does not save the site item yet
434
+ // Note: depending on licensing and user privs, will also create the team groups
435
+ // and initiative item.
436
+ return createStoryMapModelFromTemplate(template, templateDictionary, transforms, destinationAuthentication)
437
+ .then(interpolated => {
438
+ const options = {
439
+ assets: interpolated.assets || []
440
+ };
441
+ return createStoryMap(interpolated, templateDictionary.folderId, options, destinationAuthentication);
442
+ })
443
+ .then(createdModel => {
444
+ model = createdModel;
445
+ // Update the template dictionary
446
+ // TODO: This should be done in whatever receives
447
+ // the outcome of this promise chain
448
+ templateDictionary[template.itemId] = {
449
+ itemId: model.item.id
450
+ };
451
+ // call the progress callback, which also mutates templateDictionary
452
+ const finalStatus = itemProgressCallback(template.itemId, common.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, model.item.id);
453
+ if (!finalStatus) {
454
+ // clean up the site we just created
455
+ const failSafeRemove = hubCommon.failSafe(arcgisRestPortal.removeItem, { success: true });
456
+ return failSafeRemove({
457
+ id: model.item.id,
458
+ authentication: destinationAuthentication
459
+ }).then(() => {
460
+ return Promise.resolve(common.generateEmptyCreationResponse(template.type));
461
+ });
462
+ }
463
+ else {
464
+ // finally, return ICreateItemFromTemplateResponse
465
+ const response = {
466
+ item: {
467
+ ...template,
468
+ ...model
469
+ },
470
+ id: model.item.id,
471
+ type: template.type,
472
+ postProcess: false
473
+ };
474
+ response.item.itemId = model.item.id;
475
+ return response;
476
+ }
477
+ })
478
+ .catch(ex => {
479
+ itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
480
+ throw ex;
481
+ });
482
+ }
483
+ function isAStoryMap(itemType) {
484
+ let result = false;
485
+ if (itemType === "StoryMap") {
486
+ result = true;
487
+ }
488
+ return result;
489
+ }
394
490
 
395
- /** @license
396
- * Copyright 2018 Esri
397
- *
398
- * Licensed under the Apache License, Version 2.0 (the "License");
399
- * you may not use this file except in compliance with the License.
400
- * You may obtain a copy of the License at
401
- *
402
- * http://www.apache.org/licenses/LICENSE-2.0
403
- *
404
- * Unless required by applicable law or agreed to in writing, software
405
- * distributed under the License is distributed on an "AS IS" BASIS,
406
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
407
- * See the License for the specific language governing permissions and
408
- * limitations under the License.
409
- */
410
- /**
411
- * Convert a StoryMap to a template
412
- *
413
- * @param solutionItemId
414
- * @param itemInfo
415
- * @param authentication
416
- */
417
- function convertItemToTemplate(solutionItemId, itemInfo, authentication) {
418
- var model = {
419
- item: itemInfo,
420
- data: {}
421
- };
422
- // fetch the data.json
423
- return arcgisRestPortal.getItemData(itemInfo.id, { authentication: authentication })
424
- .then(function (data) {
425
- // append into the model
426
- model.data = data;
427
- // and use that to create a template
428
- return convertStoryMapToTemplate(model);
429
- })
430
- .then(function (tmpl) {
431
- return tmpl;
432
- });
433
- }
434
- /**
435
- * Create a StoryMap from the passed in template
436
- *
437
- * @param template
438
- * @param templateDictionary
439
- * @param destinationAuthentication
440
- * @param itemProgressCallback
441
- */
442
- function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
443
- // let the progress system know we've started...
444
- var startStatus = itemProgressCallback(template.itemId, common.EItemProgressStatus.Started, 0);
445
- // and if it returned false, just resolve out
446
- if (!startStatus) {
447
- return Promise.resolve(common.generateEmptyCreationResponse(template.type));
448
- }
449
- // ensure we have a solution object in the templateDictionary hash
450
- if (!templateDictionary.solution) {
451
- templateDictionary.solution = {};
452
- }
453
- // .title should always be set on the templateDictionary
454
- templateDictionary.solution.title = templateDictionary.title;
455
- // TODO: Determine if we need any transforms in this new env
456
- var transforms = {};
457
- // create an object to hold the created site through
458
- // subsequent promise calls
459
- var model;
460
- // Create the "siteModel" from the template. Does not save the site item yet
461
- // Note: depending on licensing and user privs, will also create the team groups
462
- // and initiative item.
463
- return createStoryMapModelFromTemplate(template, templateDictionary, transforms, destinationAuthentication)
464
- .then(function (interpolated) {
465
- var options = {
466
- assets: interpolated.assets || []
467
- };
468
- return createStoryMap(interpolated, templateDictionary.folderId, options, destinationAuthentication);
469
- })
470
- .then(function (createdModel) {
471
- model = createdModel;
472
- // Update the template dictionary
473
- // TODO: This should be done in whatever receives
474
- // the outcome of this promise chain
475
- templateDictionary[template.itemId] = {
476
- itemId: model.item.id
477
- };
478
- // call the progress callback, which also mutates templateDictionary
479
- var finalStatus = itemProgressCallback(template.itemId, common.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, model.item.id);
480
- if (!finalStatus) {
481
- // clean up the site we just created
482
- var failSafeRemove = hubCommon.failSafe(arcgisRestPortal.removeItem, { success: true });
483
- return failSafeRemove({
484
- id: model.item.id,
485
- authentication: destinationAuthentication
486
- }).then(function () {
487
- return Promise.resolve(common.generateEmptyCreationResponse(template.type));
488
- });
489
- }
490
- else {
491
- // finally, return ICreateItemFromTemplateResponse
492
- var response = {
493
- item: __assign(__assign({}, template), model),
494
- id: model.item.id,
495
- type: template.type,
496
- postProcess: false
497
- };
498
- response.item.itemId = model.item.id;
499
- return response;
500
- }
501
- })
502
- .catch(function (ex) {
503
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
504
- throw ex;
505
- });
506
- }
507
- function isAStoryMap(itemType) {
508
- var result = false;
509
- if (itemType === "StoryMap") {
510
- result = true;
511
- }
512
- return result;
513
- }
491
+ var storymapProcessor = /*#__PURE__*/Object.freeze({
492
+ __proto__: null,
493
+ convertItemToTemplate: convertItemToTemplate,
494
+ createItemFromTemplate: createItemFromTemplate,
495
+ isAStoryMap: isAStoryMap
496
+ });
514
497
 
515
- var storymapProcessor = /*#__PURE__*/Object.freeze({
516
- __proto__: null,
517
- convertItemToTemplate: convertItemToTemplate,
518
- createItemFromTemplate: createItemFromTemplate,
519
- isAStoryMap: isAStoryMap
520
- });
498
+ /** @license
499
+ * Copyright 2018 Esri
500
+ *
501
+ * Licensed under the Apache License, Version 2.0 (the "License");
502
+ * you may not use this file except in compliance with the License.
503
+ * You may obtain a copy of the License at
504
+ *
505
+ * http://www.apache.org/licenses/LICENSE-2.0
506
+ *
507
+ * Unless required by applicable law or agreed to in writing, software
508
+ * distributed under the License is distributed on an "AS IS" BASIS,
509
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
510
+ * See the License for the specific language governing permissions and
511
+ * limitations under the License.
512
+ */
513
+ // ------------------------------------------------------------------------------------------------------------------ //
514
+ function convertItemToTemplate$1(solutionItemId, itemInfo) {
515
+ return new Promise((resolve, reject) => {
516
+ if (isAStoryMap$1(itemInfo.type, itemInfo.url)) {
517
+ reject(common.fail("Classic StoryMap is not yet implemented"));
518
+ }
519
+ else {
520
+ reject(common.fail(itemInfo.id + " is not a StoryMap"));
521
+ }
522
+ });
523
+ }
524
+ function createItemFromTemplate$1(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
525
+ return new Promise(resolve => {
526
+ if (isAStoryMap$1(template.type, template.item.url)) {
527
+ // Not yet implemented
528
+ itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
529
+ resolve(common.generateEmptyCreationResponse(template.type));
530
+ }
531
+ else {
532
+ // Not valid
533
+ itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
534
+ resolve(common.generateEmptyCreationResponse(template.type));
535
+ }
536
+ });
537
+ }
538
+ function isAStoryMap$1(itemType, itemUrl) {
539
+ if (itemUrl) {
540
+ return [
541
+ /\/apps\/Cascade\//i,
542
+ /\/apps\/MapJournal\//i,
543
+ /\/apps\/MapSeries\//i,
544
+ /\/apps\/MapTour\//i,
545
+ /\/apps\/Shortlist\//i,
546
+ /\/apps\/StoryMap\//i,
547
+ /\/apps\/StoryMapBasic\//i,
548
+ /\/apps\/StorytellingSwipe\//i
549
+ ].some(pattern => pattern.test(itemUrl));
550
+ }
551
+ return false;
552
+ }
521
553
 
522
- /** @license
523
- * Copyright 2018 Esri
524
- *
525
- * Licensed under the Apache License, Version 2.0 (the "License");
526
- * you may not use this file except in compliance with the License.
527
- * You may obtain a copy of the License at
528
- *
529
- * http://www.apache.org/licenses/LICENSE-2.0
530
- *
531
- * Unless required by applicable law or agreed to in writing, software
532
- * distributed under the License is distributed on an "AS IS" BASIS,
533
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
534
- * See the License for the specific language governing permissions and
535
- * limitations under the License.
536
- */
537
- // ------------------------------------------------------------------------------------------------------------------ //
538
- function convertItemToTemplate$1(solutionItemId, itemInfo) {
539
- return new Promise(function (resolve, reject) {
540
- if (isAStoryMap$1(itemInfo.type, itemInfo.url)) {
541
- reject(common.fail("Classic StoryMap is not yet implemented"));
542
- }
543
- else {
544
- reject(common.fail(itemInfo.id + " is not a StoryMap"));
545
- }
546
- });
547
- }
548
- function createItemFromTemplate$1(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
549
- return new Promise(function (resolve) {
550
- if (isAStoryMap$1(template.type, template.item.url)) {
551
- // Not yet implemented
552
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
553
- resolve(common.generateEmptyCreationResponse(template.type));
554
- }
555
- else {
556
- // Not valid
557
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
558
- resolve(common.generateEmptyCreationResponse(template.type));
559
- }
560
- });
561
- }
562
- function isAStoryMap$1(itemType, itemUrl) {
563
- if (itemUrl) {
564
- return [
565
- /\/apps\/Cascade\//i,
566
- /\/apps\/MapJournal\//i,
567
- /\/apps\/MapSeries\//i,
568
- /\/apps\/MapTour\//i,
569
- /\/apps\/Shortlist\//i,
570
- /\/apps\/StoryMap\//i,
571
- /\/apps\/StoryMapBasic\//i,
572
- /\/apps\/StorytellingSwipe\//i
573
- ].some(function (pattern) { return pattern.test(itemUrl); });
574
- }
575
- return false;
576
- }
554
+ var classicStorymapProcessor = /*#__PURE__*/Object.freeze({
555
+ __proto__: null,
556
+ convertItemToTemplate: convertItemToTemplate$1,
557
+ createItemFromTemplate: createItemFromTemplate$1,
558
+ isAStoryMap: isAStoryMap$1
559
+ });
577
560
 
578
- var classicStorymapProcessor = /*#__PURE__*/Object.freeze({
579
- __proto__: null,
580
- convertItemToTemplate: convertItemToTemplate$1,
581
- createItemFromTemplate: createItemFromTemplate$1,
582
- isAStoryMap: isAStoryMap$1
583
- });
561
+ exports.ClassicStoryMapProcessor = classicStorymapProcessor;
562
+ exports.StoryMapProcessor = storymapProcessor;
584
563
 
585
- exports.ClassicStoryMapProcessor = classicStorymapProcessor;
586
- exports.StoryMapProcessor = storymapProcessor;
587
-
588
- Object.defineProperty(exports, '__esModule', { value: true });
564
+ Object.defineProperty(exports, '__esModule', { value: true });
589
565
 
590
566
  })));
591
567
  //# sourceMappingURL=storymap.umd.js.map