@esri/solution-storymap 4.1.2-alpha.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cjs/classic-storymap-processor.d.ts +24 -24
  2. package/dist/cjs/classic-storymap-processor.js +68 -68
  3. package/dist/cjs/helpers/convert-storymap-to-template.d.ts +24 -24
  4. package/dist/cjs/helpers/convert-storymap-to-template.js +98 -98
  5. package/dist/cjs/helpers/create-storymap-model-from-template.d.ts +22 -22
  6. package/dist/cjs/helpers/create-storymap-model-from-template.js +42 -42
  7. package/dist/cjs/helpers/create-storymap.d.ts +25 -25
  8. package/dist/cjs/helpers/create-storymap.js +111 -111
  9. package/dist/cjs/helpers/get-portal-env.d.ts +17 -17
  10. package/dist/cjs/helpers/get-portal-env.js +18 -18
  11. package/dist/cjs/helpers/get-storymap-base-url.d.ts +23 -23
  12. package/dist/cjs/helpers/get-storymap-base-url.js +25 -25
  13. package/dist/cjs/helpers/get-storymap-dependencies.d.ts +23 -23
  14. package/dist/cjs/helpers/get-storymap-dependencies.js +35 -35
  15. package/dist/cjs/helpers/get-storymap-subdomain.d.ts +17 -17
  16. package/dist/cjs/helpers/get-storymap-subdomain.js +19 -19
  17. package/dist/cjs/helpers/remap-webmap-keys.d.ts +24 -24
  18. package/dist/cjs/helpers/remap-webmap-keys.js +43 -43
  19. package/dist/cjs/index.d.ts +23 -23
  20. package/dist/cjs/index.js +28 -28
  21. package/dist/cjs/storymap-processor.d.ts +40 -40
  22. package/dist/cjs/storymap-processor.js +140 -140
  23. package/dist/esm/classic-storymap-processor.d.ts +24 -24
  24. package/dist/esm/classic-storymap-processor.js +61 -61
  25. package/dist/esm/helpers/convert-storymap-to-template.d.ts +24 -24
  26. package/dist/esm/helpers/convert-storymap-to-template.js +94 -94
  27. package/dist/esm/helpers/create-storymap-model-from-template.d.ts +22 -22
  28. package/dist/esm/helpers/create-storymap-model-from-template.js +38 -38
  29. package/dist/esm/helpers/create-storymap.d.ts +25 -25
  30. package/dist/esm/helpers/create-storymap.js +107 -107
  31. package/dist/esm/helpers/get-portal-env.d.ts +17 -17
  32. package/dist/esm/helpers/get-portal-env.js +14 -14
  33. package/dist/esm/helpers/get-storymap-base-url.d.ts +23 -23
  34. package/dist/esm/helpers/get-storymap-base-url.js +21 -21
  35. package/dist/esm/helpers/get-storymap-dependencies.d.ts +23 -23
  36. package/dist/esm/helpers/get-storymap-dependencies.js +31 -31
  37. package/dist/esm/helpers/get-storymap-subdomain.d.ts +17 -17
  38. package/dist/esm/helpers/get-storymap-subdomain.js +15 -15
  39. package/dist/esm/helpers/remap-webmap-keys.d.ts +24 -24
  40. package/dist/esm/helpers/remap-webmap-keys.js +39 -39
  41. package/dist/esm/index.d.ts +23 -23
  42. package/dist/esm/index.js +23 -23
  43. package/dist/esm/storymap-processor.d.ts +40 -40
  44. package/dist/esm/storymap-processor.js +134 -134
  45. package/package.json +3 -3
@@ -1,62 +1,62 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Manages the creation and deployment of Story Map item types.
18
- *
19
- * @module storymap
20
- */
21
- import * as common from "@esri/solution-common";
22
- // ------------------------------------------------------------------------------------------------------------------ //
23
- export function convertItemToTemplate(solutionItemId, itemInfo) {
24
- return new Promise((resolve, reject) => {
25
- if (isAStoryMap(itemInfo.type, itemInfo.url)) {
26
- reject(common.fail("Classic StoryMap is not yet implemented"));
27
- }
28
- else {
29
- reject(common.fail(itemInfo.id + " is not a StoryMap"));
30
- }
31
- });
32
- }
33
- export function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
34
- return new Promise(resolve => {
35
- if (isAStoryMap(template.type, template.item.url)) {
36
- // Not yet implemented
37
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
38
- resolve(common.generateEmptyCreationResponse(template.type));
39
- }
40
- else {
41
- // Not valid
42
- itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
43
- resolve(common.generateEmptyCreationResponse(template.type));
44
- }
45
- });
46
- }
47
- export function isAStoryMap(itemType, itemUrl) {
48
- if (itemUrl) {
49
- return [
50
- /\/apps\/Cascade\//i,
51
- /\/apps\/MapJournal\//i,
52
- /\/apps\/MapSeries\//i,
53
- /\/apps\/MapTour\//i,
54
- /\/apps\/Shortlist\//i,
55
- /\/apps\/StoryMap\//i,
56
- /\/apps\/StoryMapBasic\//i,
57
- /\/apps\/StorytellingSwipe\//i
58
- ].some(pattern => pattern.test(itemUrl));
59
- }
60
- return false;
61
- }
1
+ /** @license
2
+ * Copyright 2018 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Manages the creation and deployment of Story Map item types.
18
+ *
19
+ * @module storymap
20
+ */
21
+ import * as common from "@esri/solution-common";
22
+ // ------------------------------------------------------------------------------------------------------------------ //
23
+ export function convertItemToTemplate(solutionItemId, itemInfo) {
24
+ return new Promise((resolve, reject) => {
25
+ if (isAStoryMap(itemInfo.type, itemInfo.url)) {
26
+ reject(common.fail("Classic StoryMap is not yet implemented"));
27
+ }
28
+ else {
29
+ reject(common.fail(itemInfo.id + " is not a StoryMap"));
30
+ }
31
+ });
32
+ }
33
+ export function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
34
+ return new Promise(resolve => {
35
+ if (isAStoryMap(template.type, template.item.url)) {
36
+ // Not yet implemented
37
+ itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
38
+ resolve(common.generateEmptyCreationResponse(template.type));
39
+ }
40
+ else {
41
+ // Not valid
42
+ itemProgressCallback(template.itemId, common.EItemProgressStatus.Failed, 0);
43
+ resolve(common.generateEmptyCreationResponse(template.type));
44
+ }
45
+ });
46
+ }
47
+ export function isAStoryMap(itemType, itemUrl) {
48
+ if (itemUrl) {
49
+ return [
50
+ /\/apps\/Cascade\//i,
51
+ /\/apps\/MapJournal\//i,
52
+ /\/apps\/MapSeries\//i,
53
+ /\/apps\/MapTour\//i,
54
+ /\/apps\/Shortlist\//i,
55
+ /\/apps\/StoryMap\//i,
56
+ /\/apps\/StoryMapBasic\//i,
57
+ /\/apps\/StorytellingSwipe\//i
58
+ ].some(pattern => pattern.test(itemUrl));
59
+ }
60
+ return false;
61
+ }
62
62
  //# sourceMappingURL=classic-storymap-processor.js.map
@@ -1,24 +1,24 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { IModel } from "@esri/hub-common";
17
- import { IItemTemplate } from "@esri/solution-common";
18
- /**
19
- * Convert a StoryMap IModel to an IItemTemplate
20
- *
21
- * @param model
22
- * @param authentication
23
- */
24
- export declare function convertStoryMapToTemplate(model: IModel): Promise<IItemTemplate>;
1
+ /** @license
2
+ * Copyright 2018 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { IModel } from "@esri/hub-common";
17
+ import { IItemTemplate } from "@esri/solution-common";
18
+ /**
19
+ * Convert a StoryMap IModel to an IItemTemplate
20
+ *
21
+ * @param model
22
+ * @param authentication
23
+ */
24
+ export declare function convertStoryMapToTemplate(model: IModel): Promise<IItemTemplate>;
@@ -1,95 +1,95 @@
1
- /** @license
2
- * Copyright 2018 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { cloneObject, propifyString, createId, normalizeSolutionTemplateItem, deepStringReplace } from "@esri/hub-common";
17
- import { createPlaceholderTemplate } from "@esri/solution-common";
18
- import { remapWebmapKeys } from "./remap-webmap-keys";
19
- import { getStoryMapDependencies } from "./get-storymap-dependencies";
20
- /**
21
- * Convert a StoryMap IModel to an IItemTemplate
22
- *
23
- * @param model
24
- * @param authentication
25
- */
26
- export function convertStoryMapToTemplate(model) {
27
- const tmpl = createPlaceholderTemplate(model.item.id, model.item.type);
28
- tmpl.key = `${propifyString(model.item.title)}_${createId("i")}`;
29
- const clone = cloneObject(model);
30
- tmpl.data = clone.data;
31
- // We need to save these properties in order to restore them after hub.js deletes them
32
- const created = clone.item.created;
33
- const modified = clone.item.modified;
34
- tmpl.item = normalizeSolutionTemplateItem(clone.item);
35
- tmpl.item.created = created;
36
- tmpl.item.modified = modified;
37
- // templatize the url
38
- tmpl.item.url = "{{storyMapTemplateUrl}}";
39
- // Storymap Webmap Resources have complex keys that we need to remap
40
- const webmapRemaps = remapWebmapKeys(tmpl.data.resources);
41
- // and then replace in the rest of the structure
42
- webmapRemaps.forEach(remap => {
43
- tmpl.data.resources[remap.updated] = cloneObject(tmpl.data.resources[remap.original]);
44
- delete tmpl.data.resources[remap.original];
45
- tmpl.data.nodes = deepStringReplace(tmpl.data.nodes, remap.original, remap.updated);
46
- });
47
- // use typeKeyword to mark item as published
48
- // Note: Hub team decided to discard unpublished drafts when creating a template
49
- const typeKeywords = tmpl.item.typeKeywords;
50
- if (typeKeywords.indexOf(unPublishedChangesKW) !== -1) {
51
- tmpl.item.typeKeywords = [publishedChangesKW].concat(tmpl.item.typeKeywords.filter((word) => word !== unPublishedChangesKW));
52
- }
53
- tmpl.properties = {};
54
- tmpl.properties.draftFileName = "draft_{{timestamp}}.json";
55
- Object.assign(tmpl.properties, oEmbedTemplates);
56
- tmpl.dependencies = getStoryMapDependencies(model);
57
- return Promise.resolve(tmpl);
58
- // TODO: For now, we let the generic process handle item resources
59
- // However, many newer item types have complex type-specific resource handling
60
- // requirements so this code may be useful in the future
61
- // ------------------------------------------------------
62
- // return getItemResources(tmpl.itemId, hubRequestOptions)
63
- // .then((response) => {
64
- // tmpl.resources = response.resources.map(e => e.resource)
65
- // // Don't directly copy oembed resources because we need to template these
66
- // // Also, discard draft version of the storymap itself
67
- // .filter(filename => !filename.includes('oembed') && filename.search(/draft_[0-9]+.json/) === -1);
68
- // return tmpl;
69
- // });
70
- }
71
- // Internal constants
72
- const unPublishedChangesKW = "smstatusunpublishedchanges";
73
- const publishedChangesKW = "smstatuspublished";
74
- /**
75
- * Template for oEmbed
76
- */
77
- const oEmbedTemplates = {
78
- oembed: {
79
- version: "1.0",
80
- type: "rich",
81
- title: "Example StoryMap",
82
- url: "{{storyMapTemplateUrl}}",
83
- provider_name: "ArcGIS StoryMaps",
84
- provider_url: "{{storyMapBaseUrl}}",
85
- width: 800,
86
- height: 600,
87
- thumbnail_url: "{{storyMapThumbnailUrl}}",
88
- thumbnail_height: "100.5",
89
- thumbnail_width: "400",
90
- html: '<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',
91
- cache_age: 86400
92
- },
93
- 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>'
94
- };
1
+ /** @license
2
+ * Copyright 2018 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { cloneObject, propifyString, createId, normalizeSolutionTemplateItem, deepStringReplace } from "@esri/hub-common";
17
+ import { createPlaceholderTemplate } from "@esri/solution-common";
18
+ import { remapWebmapKeys } from "./remap-webmap-keys";
19
+ import { getStoryMapDependencies } from "./get-storymap-dependencies";
20
+ /**
21
+ * Convert a StoryMap IModel to an IItemTemplate
22
+ *
23
+ * @param model
24
+ * @param authentication
25
+ */
26
+ export function convertStoryMapToTemplate(model) {
27
+ const tmpl = createPlaceholderTemplate(model.item.id, model.item.type);
28
+ tmpl.key = `${propifyString(model.item.title)}_${createId("i")}`;
29
+ const clone = cloneObject(model);
30
+ tmpl.data = clone.data;
31
+ // We need to save these properties in order to restore them after hub.js deletes them
32
+ const created = clone.item.created;
33
+ const modified = clone.item.modified;
34
+ tmpl.item = normalizeSolutionTemplateItem(clone.item);
35
+ tmpl.item.created = created;
36
+ tmpl.item.modified = modified;
37
+ // templatize the url
38
+ tmpl.item.url = "{{storyMapTemplateUrl}}";
39
+ // Storymap Webmap Resources have complex keys that we need to remap
40
+ const webmapRemaps = remapWebmapKeys(tmpl.data.resources);
41
+ // and then replace in the rest of the structure
42
+ webmapRemaps.forEach(remap => {
43
+ tmpl.data.resources[remap.updated] = cloneObject(tmpl.data.resources[remap.original]);
44
+ delete tmpl.data.resources[remap.original];
45
+ tmpl.data.nodes = deepStringReplace(tmpl.data.nodes, remap.original, remap.updated);
46
+ });
47
+ // use typeKeyword to mark item as published
48
+ // Note: Hub team decided to discard unpublished drafts when creating a template
49
+ const typeKeywords = tmpl.item.typeKeywords;
50
+ if (typeKeywords.indexOf(unPublishedChangesKW) !== -1) {
51
+ tmpl.item.typeKeywords = [publishedChangesKW].concat(tmpl.item.typeKeywords.filter((word) => word !== unPublishedChangesKW));
52
+ }
53
+ tmpl.properties = {};
54
+ tmpl.properties.draftFileName = "draft_{{timestamp}}.json";
55
+ Object.assign(tmpl.properties, oEmbedTemplates);
56
+ tmpl.dependencies = getStoryMapDependencies(model);
57
+ return Promise.resolve(tmpl);
58
+ // TODO: For now, we let the generic process handle item resources
59
+ // However, many newer item types have complex type-specific resource handling
60
+ // requirements so this code may be useful in the future
61
+ // ------------------------------------------------------
62
+ // return getItemResources(tmpl.itemId, hubRequestOptions)
63
+ // .then((response) => {
64
+ // tmpl.resources = response.resources.map(e => e.resource)
65
+ // // Don't directly copy oembed resources because we need to template these
66
+ // // Also, discard draft version of the storymap itself
67
+ // .filter(filename => !filename.includes('oembed') && filename.search(/draft_[0-9]+.json/) === -1);
68
+ // return tmpl;
69
+ // });
70
+ }
71
+ // Internal constants
72
+ const unPublishedChangesKW = "smstatusunpublishedchanges";
73
+ const publishedChangesKW = "smstatuspublished";
74
+ /**
75
+ * Template for oEmbed
76
+ */
77
+ const oEmbedTemplates = {
78
+ oembed: {
79
+ version: "1.0",
80
+ type: "rich",
81
+ title: "Example StoryMap",
82
+ url: "{{storyMapTemplateUrl}}",
83
+ provider_name: "ArcGIS StoryMaps",
84
+ provider_url: "{{storyMapBaseUrl}}",
85
+ width: 800,
86
+ height: 600,
87
+ thumbnail_url: "{{storyMapThumbnailUrl}}",
88
+ thumbnail_height: "100.5",
89
+ thumbnail_width: "400",
90
+ html: '<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',
91
+ cache_age: 86400
92
+ },
93
+ 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>'
94
+ };
95
95
  //# sourceMappingURL=convert-storymap-to-template.js.map
@@ -1,22 +1,22 @@
1
- /** @license
2
- * Copyright 2020 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Given a template, process it and interpolate it such that
18
- * we have a model that is ready to be sent to the Portal API
19
- */
20
- import { IModelTemplate } from "@esri/hub-common";
21
- import { UserSession } from "@esri/solution-common";
22
- export declare function createStoryMapModelFromTemplate(templateModel: IModelTemplate, settings: any, transforms: any, authentication: UserSession): Promise<any>;
1
+ /** @license
2
+ * Copyright 2020 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Given a template, process it and interpolate it such that
18
+ * we have a model that is ready to be sent to the Portal API
19
+ */
20
+ import { IModelTemplate } from "@esri/hub-common";
21
+ import { UserSession } from "@esri/solution-common";
22
+ export declare function createStoryMapModelFromTemplate(templateModel: IModelTemplate, settings: any, transforms: any, authentication: UserSession): Promise<any>;
@@ -1,39 +1,39 @@
1
- /** @license
2
- * Copyright 2020 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- /**
17
- * Given a template, process it and interpolate it such that
18
- * we have a model that is ready to be sent to the Portal API
19
- */
20
- import { interpolate } from "@esri/hub-common";
21
- import { getPortalEnv } from "./get-portal-env";
22
- import { getStoryMapBaseUrl } from "./get-storymap-base-url";
23
- import { getStoryMapSubdomain } from "./get-storymap-subdomain";
24
- export function createStoryMapModelFromTemplate(templateModel, settings, transforms, authentication) {
25
- const timestamp = new Date().getTime();
26
- // Keep these around in case we encounter some old templates
27
- settings.agoenv = getPortalEnv(authentication);
28
- settings.smBase = getStoryMapSubdomain(authentication);
29
- settings.timestamp = new Date().getTime();
30
- // These are used in the oembed resource, as well as the item url
31
- // they have `{{appid}}` in them so that the id of the created item
32
- // will be interpolated into it after the item is created
33
- settings.storyMapBaseUrl = getStoryMapBaseUrl(authentication);
34
- settings.storyMapTemplateUrl = `${settings.storyMapBaseUrl}/stories/{{appid}}`;
35
- settings.storyMapThumnailUrl = `${authentication.portal}/content/items/{{appid}}/info/thumbnail/thumbnail.jpg/?w=400&d=${timestamp}`;
36
- const model = interpolate(templateModel, settings, transforms);
37
- return Promise.resolve(model);
38
- }
1
+ /** @license
2
+ * Copyright 2020 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ /**
17
+ * Given a template, process it and interpolate it such that
18
+ * we have a model that is ready to be sent to the Portal API
19
+ */
20
+ import { interpolate } from "@esri/hub-common";
21
+ import { getPortalEnv } from "./get-portal-env";
22
+ import { getStoryMapBaseUrl } from "./get-storymap-base-url";
23
+ import { getStoryMapSubdomain } from "./get-storymap-subdomain";
24
+ export function createStoryMapModelFromTemplate(templateModel, settings, transforms, authentication) {
25
+ const timestamp = new Date().getTime();
26
+ // Keep these around in case we encounter some old templates
27
+ settings.agoenv = getPortalEnv(authentication);
28
+ settings.smBase = getStoryMapSubdomain(authentication);
29
+ settings.timestamp = new Date().getTime();
30
+ // These are used in the oembed resource, as well as the item url
31
+ // they have `{{appid}}` in them so that the id of the created item
32
+ // will be interpolated into it after the item is created
33
+ settings.storyMapBaseUrl = getStoryMapBaseUrl(authentication);
34
+ settings.storyMapTemplateUrl = `${settings.storyMapBaseUrl}/stories/{{appid}}`;
35
+ settings.storyMapThumnailUrl = `${authentication.portal}/content/items/{{appid}}/info/thumbnail/thumbnail.jpg/?w=400&d=${timestamp}`;
36
+ const model = interpolate(templateModel, settings, transforms);
37
+ return Promise.resolve(model);
38
+ }
39
39
  //# sourceMappingURL=create-storymap-model-from-template.js.map
@@ -1,25 +1,25 @@
1
- /** @license
2
- * Copyright 2020 Esri
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { IModel } from "@esri/hub-common";
17
- import { UserSession } from "@esri/solution-common";
18
- /**
19
- * Create a StoryMap from an interpolated template
20
- *
21
- * @param model
22
- * @param options
23
- * @param authentication
24
- */
25
- export declare function createStoryMap(model: IModel, folderId: string, options: any, authentication: UserSession): Promise<IModel>;
1
+ /** @license
2
+ * Copyright 2020 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { IModel } from "@esri/hub-common";
17
+ import { UserSession } from "@esri/solution-common";
18
+ /**
19
+ * Create a StoryMap from an interpolated template
20
+ *
21
+ * @param model
22
+ * @param options
23
+ * @param authentication
24
+ */
25
+ export declare function createStoryMap(model: IModel, folderId: string, options: any, authentication: UserSession): Promise<IModel>;