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