@esri/solution-storymap 6.0.5-alpha.0 → 6.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/dist/cjs/classic-storymap-processor.d.ts +0 -24
- package/dist/cjs/classic-storymap-processor.js +0 -69
- package/dist/cjs/classic-storymap-processor.js.map +0 -1
- package/dist/cjs/helpers/convert-storymap-to-template.d.ts +0 -24
- package/dist/cjs/helpers/convert-storymap-to-template.js +0 -99
- package/dist/cjs/helpers/convert-storymap-to-template.js.map +0 -1
- package/dist/cjs/helpers/create-storymap-model-from-template.d.ts +0 -22
- package/dist/cjs/helpers/create-storymap-model-from-template.js +0 -43
- package/dist/cjs/helpers/create-storymap-model-from-template.js.map +0 -1
- package/dist/cjs/helpers/create-storymap.d.ts +0 -25
- package/dist/cjs/helpers/create-storymap.js +0 -119
- package/dist/cjs/helpers/create-storymap.js.map +0 -1
- package/dist/cjs/helpers/get-portal-env.d.ts +0 -17
- package/dist/cjs/helpers/get-portal-env.js +0 -19
- package/dist/cjs/helpers/get-portal-env.js.map +0 -1
- package/dist/cjs/helpers/get-storymap-base-url.d.ts +0 -23
- package/dist/cjs/helpers/get-storymap-base-url.js +0 -26
- package/dist/cjs/helpers/get-storymap-base-url.js.map +0 -1
- package/dist/cjs/helpers/get-storymap-dependencies.d.ts +0 -23
- package/dist/cjs/helpers/get-storymap-dependencies.js +0 -36
- package/dist/cjs/helpers/get-storymap-dependencies.js.map +0 -1
- package/dist/cjs/helpers/get-storymap-subdomain.d.ts +0 -17
- package/dist/cjs/helpers/get-storymap-subdomain.js +0 -20
- package/dist/cjs/helpers/get-storymap-subdomain.js.map +0 -1
- package/dist/cjs/helpers/remap-webmap-keys.d.ts +0 -24
- package/dist/cjs/helpers/remap-webmap-keys.js +0 -44
- package/dist/cjs/helpers/remap-webmap-keys.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -23
- package/dist/cjs/index.js +0 -29
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/storymap-processor.d.ts +0 -39
- package/dist/cjs/storymap-processor.js +0 -139
- package/dist/cjs/storymap-processor.js.map +0 -1
- package/dist/esm/classic-storymap-processor.d.ts +0 -24
- package/dist/esm/classic-storymap-processor.js +0 -62
- package/dist/esm/classic-storymap-processor.js.map +0 -1
- package/dist/esm/helpers/convert-storymap-to-template.d.ts +0 -24
- package/dist/esm/helpers/convert-storymap-to-template.js +0 -95
- package/dist/esm/helpers/convert-storymap-to-template.js.map +0 -1
- package/dist/esm/helpers/create-storymap-model-from-template.d.ts +0 -22
- package/dist/esm/helpers/create-storymap-model-from-template.js +0 -39
- package/dist/esm/helpers/create-storymap-model-from-template.js.map +0 -1
- package/dist/esm/helpers/create-storymap.d.ts +0 -25
- package/dist/esm/helpers/create-storymap.js +0 -115
- package/dist/esm/helpers/create-storymap.js.map +0 -1
- package/dist/esm/helpers/get-portal-env.d.ts +0 -17
- package/dist/esm/helpers/get-portal-env.js +0 -15
- package/dist/esm/helpers/get-portal-env.js.map +0 -1
- package/dist/esm/helpers/get-storymap-base-url.d.ts +0 -23
- package/dist/esm/helpers/get-storymap-base-url.js +0 -22
- package/dist/esm/helpers/get-storymap-base-url.js.map +0 -1
- package/dist/esm/helpers/get-storymap-dependencies.d.ts +0 -23
- package/dist/esm/helpers/get-storymap-dependencies.js +0 -32
- package/dist/esm/helpers/get-storymap-dependencies.js.map +0 -1
- package/dist/esm/helpers/get-storymap-subdomain.d.ts +0 -17
- package/dist/esm/helpers/get-storymap-subdomain.js +0 -16
- package/dist/esm/helpers/get-storymap-subdomain.js.map +0 -1
- package/dist/esm/helpers/remap-webmap-keys.d.ts +0 -24
- package/dist/esm/helpers/remap-webmap-keys.js +0 -40
- package/dist/esm/helpers/remap-webmap-keys.js.map +0 -1
- package/dist/esm/index.d.ts +0 -23
- package/dist/esm/index.js +0 -24
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/storymap-processor.d.ts +0 -39
- package/dist/esm/storymap-processor.js +0 -133
- package/dist/esm/storymap-processor.js.map +0 -1
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { UserSession } from "@esri/solution-common";
|
|
17
|
-
export declare function getStoryMapSubdomain(authentication: UserSession): string;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStoryMapSubdomain = void 0;
|
|
4
|
-
function getStoryMapSubdomain(authentication) {
|
|
5
|
-
const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
|
|
6
|
-
// TODO: Sort out how we locate storymaps on portal?
|
|
7
|
-
let result;
|
|
8
|
-
if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
9
|
-
result = "storymapsqa";
|
|
10
|
-
}
|
|
11
|
-
else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
12
|
-
result = "storymapsdev";
|
|
13
|
-
}
|
|
14
|
-
else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
15
|
-
result = "storymaps";
|
|
16
|
-
}
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
exports.getStoryMapSubdomain = getStoryMapSubdomain;
|
|
20
|
-
//# sourceMappingURL=get-storymap-subdomain.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-storymap-subdomain.js","sourceRoot":"","sources":["../../../src/helpers/get-storymap-subdomain.ts"],"names":[],"mappings":";;;AAiBA,SAAgB,oBAAoB,CAAC,cAA2B;IAC9D,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,IAAI,qCAAqC,CAAC;IACjF,oDAAoD;IACpD,IAAI,MAAM,CAAC;IACX,IAAI,SAAS,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;QACnD,MAAM,GAAG,aAAa,CAAC;KACxB;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE;QAC/D,MAAM,GAAG,cAAc,CAAC;KACzB;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE;QACtD,MAAM,GAAG,WAAW,CAAC;KACtB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,oDAYC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* For some reason, the webmap resource key names are fancier than other resource keys
|
|
18
|
-
* They look like this: r-<webmap-item-id>-<timestamp>
|
|
19
|
-
* This interpolation is hard to accomplish given our current setup, so we're just overwriting
|
|
20
|
-
* them with "webmap0", "webmap1" and so forth. This _seems_ to make no difference.
|
|
21
|
-
*
|
|
22
|
-
* @param model
|
|
23
|
-
*/
|
|
24
|
-
export declare function remapWebmapKeys(resources?: any): any[];
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2018 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.remapWebmapKeys = void 0;
|
|
19
|
-
const hub_common_1 = require("@esri/hub-common");
|
|
20
|
-
/**
|
|
21
|
-
* For some reason, the webmap resource key names are fancier than other resource keys
|
|
22
|
-
* They look like this: r-<webmap-item-id>-<timestamp>
|
|
23
|
-
* This interpolation is hard to accomplish given our current setup, so we're just overwriting
|
|
24
|
-
* them with "webmap0", "webmap1" and so forth. This _seems_ to make no difference.
|
|
25
|
-
*
|
|
26
|
-
* @param model
|
|
27
|
-
*/
|
|
28
|
-
function remapWebmapKeys(resources = {}) {
|
|
29
|
-
let webmapCounter = 0;
|
|
30
|
-
return Object.keys(resources).reduce((acc, key) => {
|
|
31
|
-
if ((0, hub_common_1.getProp)(resources, `${key}.type`) === "webmap") {
|
|
32
|
-
if (key !== `webmap${webmapCounter}`) {
|
|
33
|
-
acc.push({
|
|
34
|
-
original: key,
|
|
35
|
-
updated: `webmap${webmapCounter}`,
|
|
36
|
-
});
|
|
37
|
-
webmapCounter++;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return acc;
|
|
41
|
-
}, []);
|
|
42
|
-
}
|
|
43
|
-
exports.remapWebmapKeys = remapWebmapKeys;
|
|
44
|
-
//# sourceMappingURL=remap-webmap-keys.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remap-webmap-keys.js","sourceRoot":"","sources":["../../../src/helpers/remap-webmap-keys.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAA2C;AAE3C;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,YAAiB,EAAE;IACjD,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAChD,IAAI,IAAA,oBAAO,EAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,KAAK,QAAQ,EAAE;YAClD,IAAI,GAAG,KAAK,SAAS,aAAa,EAAE,EAAE;gBACpC,GAAG,CAAC,IAAI,CAAC;oBACP,QAAQ,EAAE,GAAG;oBACb,OAAO,EAAE,SAAS,aAAa,EAAE;iBAClC,CAAC,CAAC;gBACH,aAAa,EAAE,CAAC;aACjB;SACF;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAdD,0CAcC"}
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Manages the creation and deployment of Story Map item types.
|
|
18
|
-
*
|
|
19
|
-
* @module storymap
|
|
20
|
-
*/
|
|
21
|
-
import * as StoryMapProcessor from "./storymap-processor";
|
|
22
|
-
import * as ClassicStoryMapProcessor from "./classic-storymap-processor";
|
|
23
|
-
export { StoryMapProcessor, ClassicStoryMapProcessor };
|
package/dist/cjs/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2018 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.ClassicStoryMapProcessor = exports.StoryMapProcessor = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
/**
|
|
21
|
-
* Manages the creation and deployment of Story Map item types.
|
|
22
|
-
*
|
|
23
|
-
* @module storymap
|
|
24
|
-
*/
|
|
25
|
-
const StoryMapProcessor = tslib_1.__importStar(require("./storymap-processor"));
|
|
26
|
-
exports.StoryMapProcessor = StoryMapProcessor;
|
|
27
|
-
const ClassicStoryMapProcessor = tslib_1.__importStar(require("./classic-storymap-processor"));
|
|
28
|
-
exports.ClassicStoryMapProcessor = ClassicStoryMapProcessor;
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,gFAA0D;AAGjD,8CAAiB;AAF1B,+FAAyE;AAE7C,4DAAwB"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Manages the creation and deployment of Story Map item types.
|
|
18
|
-
*
|
|
19
|
-
* @module storymap
|
|
20
|
-
*/
|
|
21
|
-
import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse, UserSession } from "@esri/solution-common";
|
|
22
|
-
/**
|
|
23
|
-
* Convert a StoryMap to a template
|
|
24
|
-
*
|
|
25
|
-
* @param itemInfo
|
|
26
|
-
* @param destAuthentication Credentials for requests to the destination organization
|
|
27
|
-
* @param srcAuthentication Credentials for requests to source items
|
|
28
|
-
*/
|
|
29
|
-
export declare function convertItemToTemplate(itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
|
|
30
|
-
/**
|
|
31
|
-
* Create a StoryMap from the passed in template
|
|
32
|
-
*
|
|
33
|
-
* @param template
|
|
34
|
-
* @param templateDictionary
|
|
35
|
-
* @param destinationAuthentication
|
|
36
|
-
* @param itemProgressCallback
|
|
37
|
-
*/
|
|
38
|
-
export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
|
|
39
|
-
export declare function isAStoryMap(itemType: string): boolean;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2018 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.isAStoryMap = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
|
|
19
|
-
/**
|
|
20
|
-
* Manages the creation and deployment of Story Map item types.
|
|
21
|
-
*
|
|
22
|
-
* @module storymap
|
|
23
|
-
*/
|
|
24
|
-
const solution_common_1 = require("@esri/solution-common");
|
|
25
|
-
const hub_common_1 = require("@esri/hub-common");
|
|
26
|
-
const convert_storymap_to_template_1 = require("./helpers/convert-storymap-to-template");
|
|
27
|
-
const create_storymap_model_from_template_1 = require("./helpers/create-storymap-model-from-template");
|
|
28
|
-
const create_storymap_1 = require("./helpers/create-storymap");
|
|
29
|
-
/**
|
|
30
|
-
* Convert a StoryMap to a template
|
|
31
|
-
*
|
|
32
|
-
* @param itemInfo
|
|
33
|
-
* @param destAuthentication Credentials for requests to the destination organization
|
|
34
|
-
* @param srcAuthentication Credentials for requests to source items
|
|
35
|
-
*/
|
|
36
|
-
function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentication) {
|
|
37
|
-
const model = {
|
|
38
|
-
item: itemInfo,
|
|
39
|
-
data: {},
|
|
40
|
-
};
|
|
41
|
-
// fetch the data.json
|
|
42
|
-
return (0, solution_common_1.getItemData)(itemInfo.id, { authentication: srcAuthentication })
|
|
43
|
-
.then((data) => {
|
|
44
|
-
// append into the model
|
|
45
|
-
model.data = data;
|
|
46
|
-
// and use that to create a template
|
|
47
|
-
return (0, convert_storymap_to_template_1.convertStoryMapToTemplate)(model);
|
|
48
|
-
})
|
|
49
|
-
.then((tmpl) => {
|
|
50
|
-
return tmpl;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
exports.convertItemToTemplate = convertItemToTemplate;
|
|
54
|
-
/**
|
|
55
|
-
* Create a StoryMap from the passed in template
|
|
56
|
-
*
|
|
57
|
-
* @param template
|
|
58
|
-
* @param templateDictionary
|
|
59
|
-
* @param destinationAuthentication
|
|
60
|
-
* @param itemProgressCallback
|
|
61
|
-
*/
|
|
62
|
-
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
63
|
-
// let the progress system know we've started...
|
|
64
|
-
const startStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Started, 0);
|
|
65
|
-
// and if it returned false, just resolve out
|
|
66
|
-
if (!startStatus) {
|
|
67
|
-
return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
|
|
68
|
-
}
|
|
69
|
-
// ensure we have a solution object in the templateDictionary hash
|
|
70
|
-
if (!templateDictionary.solution) {
|
|
71
|
-
templateDictionary.solution = {};
|
|
72
|
-
}
|
|
73
|
-
// .title should always be set on the templateDictionary
|
|
74
|
-
templateDictionary.solution.title = templateDictionary.title;
|
|
75
|
-
// TODO: Determine if we need any transforms in this new env
|
|
76
|
-
const transforms = {};
|
|
77
|
-
// create an object to hold the created site through
|
|
78
|
-
// subsequent promise calls
|
|
79
|
-
let model;
|
|
80
|
-
// Create the "siteModel" from the template. Does not save the site item yet
|
|
81
|
-
// Note: depending on licensing and user privs, will also create the team groups
|
|
82
|
-
// and initiative item.
|
|
83
|
-
return (0, create_storymap_model_from_template_1.createStoryMapModelFromTemplate)(template, templateDictionary, transforms, destinationAuthentication)
|
|
84
|
-
.then((interpolated) => {
|
|
85
|
-
const options = {
|
|
86
|
-
assets: interpolated.assets || [],
|
|
87
|
-
};
|
|
88
|
-
return (0, create_storymap_1.createStoryMap)(interpolated, templateDictionary.folderId, options, destinationAuthentication);
|
|
89
|
-
})
|
|
90
|
-
.then((createdModel) => {
|
|
91
|
-
model = createdModel;
|
|
92
|
-
// Update the template dictionary
|
|
93
|
-
// TODO: This should be done in whatever receives
|
|
94
|
-
// the outcome of this promise chain
|
|
95
|
-
templateDictionary[template.itemId] = {
|
|
96
|
-
itemId: model.item.id,
|
|
97
|
-
};
|
|
98
|
-
// call the progress callback, which also mutates templateDictionary
|
|
99
|
-
const finalStatus = itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, model.item.id);
|
|
100
|
-
if (!finalStatus) {
|
|
101
|
-
// clean up the site we just created
|
|
102
|
-
const failSafeRemove = (0, hub_common_1.failSafe)(solution_common_1.restRemoveItem, { success: true });
|
|
103
|
-
return failSafeRemove({
|
|
104
|
-
id: model.item.id,
|
|
105
|
-
authentication: destinationAuthentication,
|
|
106
|
-
}).then(() => {
|
|
107
|
-
return Promise.resolve((0, solution_common_1.generateEmptyCreationResponse)(template.type));
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
// finally, return ICreateItemFromTemplateResponse
|
|
112
|
-
const response = {
|
|
113
|
-
item: {
|
|
114
|
-
...template,
|
|
115
|
-
...(0, solution_common_1.convertIModel)(model),
|
|
116
|
-
},
|
|
117
|
-
id: model.item.id,
|
|
118
|
-
type: template.type,
|
|
119
|
-
postProcess: false,
|
|
120
|
-
};
|
|
121
|
-
response.item.itemId = model.item.id;
|
|
122
|
-
return response;
|
|
123
|
-
}
|
|
124
|
-
})
|
|
125
|
-
.catch((ex) => {
|
|
126
|
-
itemProgressCallback(template.itemId, solution_common_1.EItemProgressStatus.Failed, 0);
|
|
127
|
-
throw ex;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
exports.createItemFromTemplate = createItemFromTemplate;
|
|
131
|
-
function isAStoryMap(itemType) {
|
|
132
|
-
let result = false;
|
|
133
|
-
if (itemType === "StoryMap") {
|
|
134
|
-
result = true;
|
|
135
|
-
}
|
|
136
|
-
return result;
|
|
137
|
-
}
|
|
138
|
-
exports.isAStoryMap = isAStoryMap;
|
|
139
|
-
//# sourceMappingURL=storymap-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storymap-processor.js","sourceRoot":"","sources":["../../src/storymap-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,2DAU+B;AAC/B,iDAAoD;AACpD,yFAAmF;AACnF,uGAAgG;AAChG,+DAA2D;AAE3D;;;;;;GAMG;AACH,SAAgB,qBAAqB,CACnC,QAAa,EACb,kBAA+B,EAC/B,iBAA8B;IAE9B,MAAM,KAAK,GAAG;QACZ,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,EAAE;KACC,CAAC;IACZ,sBAAsB;IACtB,OAAO,IAAA,6BAAW,EAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC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AG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,OAAO,QAAQ,CAAC;SACjB;IACH,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE;QACZ,oBAAoB,CAAC,QAAQ,CAAC,MAAM,EAAE,qCAAmB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACrE,MAAM,EAAE,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC;AAjFD,wDAiFC;AAED,SAAgB,WAAW,CAAC,QAAgB;IAC1C,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,QAAQ,KAAK,UAAU,EAAE;QAC3B,MAAM,GAAG,IAAI,CAAC;KACf;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,kCAMC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Manages the creation and deployment of Story Map item types.
|
|
18
|
-
*
|
|
19
|
-
* @module storymap
|
|
20
|
-
*/
|
|
21
|
-
import * as common from "@esri/solution-common";
|
|
22
|
-
export declare function convertItemToTemplate(itemInfo: any): Promise<common.IItemTemplate>;
|
|
23
|
-
export declare function createItemFromTemplate(template: common.IItemTemplate, templateDictionary: any, destinationAuthentication: common.UserSession, itemProgressCallback: common.IItemProgressCallback): Promise<common.ICreateItemFromTemplateResponse>;
|
|
24
|
-
export declare function isAStoryMap(itemType: string, itemUrl?: string): boolean;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Manages the creation 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(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
|
-
//# sourceMappingURL=classic-storymap-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classic-storymap-processor.js","sourceRoot":"","sources":["../../src/classic-storymap-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,wHAAwH;AAExH,MAAM,UAAU,qBAAqB,CAAC,QAAa;IACjD,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3D,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC5C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC,CAAC;SAChE;aAAM;YACL,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,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|
-
* 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 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
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
|
-
//# sourceMappingURL=convert-storymap-to-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"convert-storymap-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-storymap-to-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,WAAW,EACX,aAAa,EACb,QAAQ,EACR,6BAA6B,EAC7B,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAwB,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAa;IACrD,MAAM,IAAI,GAAG,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,GAAG,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;IAEjE,MAAM,KAAK,GAAG,WAAW,CAAC,K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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 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* 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
|
-
//# sourceMappingURL=create-storymap-model-from-template.js.map
|