@esri/solution-storymap 1.1.3 → 1.3.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/dist/esm/helpers/convert-storymap-to-template.js +5 -0
- package/dist/esm/helpers/convert-storymap-to-template.js.map +1 -1
- package/dist/esm/storymap-processor.d.ts +3 -2
- package/dist/esm/storymap-processor.js +4 -3
- package/dist/esm/storymap-processor.js.map +1 -1
- package/dist/node/classic-storymap-processor.js +2 -1
- package/dist/node/classic-storymap-processor.js.map +1 -1
- package/dist/node/helpers/convert-storymap-to-template.js +5 -0
- package/dist/node/helpers/convert-storymap-to-template.js.map +1 -1
- package/dist/node/index.js +3 -2
- package/dist/node/index.js.map +1 -1
- package/dist/node/storymap-processor.d.ts +3 -2
- package/dist/node/storymap-processor.js +4 -3
- package/dist/node/storymap-processor.js.map +1 -1
- package/dist/umd/storymap-processor.d.ts +3 -2
- package/dist/umd/storymap.umd.js +54 -28
- package/dist/umd/storymap.umd.js.map +1 -1
- package/dist/umd/storymap.umd.min.js +4 -4
- package/dist/umd/storymap.umd.min.js.map +1 -1
- package/package.json +13 -14
|
@@ -28,7 +28,12 @@ export function convertStoryMapToTemplate(model) {
|
|
|
28
28
|
tmpl.key = `${propifyString(model.item.title)}_${createId("i")}`;
|
|
29
29
|
const clone = cloneObject(model);
|
|
30
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;
|
|
31
34
|
tmpl.item = normalizeSolutionTemplateItem(clone.item);
|
|
35
|
+
tmpl.item.created = created;
|
|
36
|
+
tmpl.item.modified = modified;
|
|
32
37
|
// templatize the url
|
|
33
38
|
tmpl.item.url = "{{storyMapTemplateUrl}}";
|
|
34
39
|
// Storymap Webmap Resources have complex keys that we need to remap
|
|
@@ -1 +1 @@
|
|
|
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,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAa;IAEb,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,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;
|
|
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,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAa;IAEb,MAAM,IAAI,GAAG,yBAAyB,CAAC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AAM,EAAE,GAAG;QACX,aAAa,EAAE,0BAA0B;QACzC,gBAAgB,EAAE,OAAO;QACzB,eAAe,EAAE,KAAK;QACtB,IAAI,EACF,0HAA0H;QAC5H,SAAS,EAAE,KAAK;KACjB;IACD,SAAS,EACP,0rBAA0rB;CAC7rB,CAAC"}
|
|
@@ -24,9 +24,10 @@ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse,
|
|
|
24
24
|
*
|
|
25
25
|
* @param solutionItemId
|
|
26
26
|
* @param itemInfo
|
|
27
|
-
* @param
|
|
27
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
28
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
29
|
*/
|
|
29
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any,
|
|
30
|
+
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
|
|
30
31
|
/**
|
|
31
32
|
* Create a StoryMap from the passed in template
|
|
32
33
|
*
|
|
@@ -29,15 +29,16 @@ import { createStoryMap } from "./helpers/create-storymap";
|
|
|
29
29
|
*
|
|
30
30
|
* @param solutionItemId
|
|
31
31
|
* @param itemInfo
|
|
32
|
-
* @param
|
|
32
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
33
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
33
34
|
*/
|
|
34
|
-
export function convertItemToTemplate(solutionItemId, itemInfo,
|
|
35
|
+
export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
|
|
35
36
|
const model = {
|
|
36
37
|
item: itemInfo,
|
|
37
38
|
data: {}
|
|
38
39
|
};
|
|
39
40
|
// fetch the data.json
|
|
40
|
-
return getItemData(itemInfo.id, { authentication })
|
|
41
|
+
return getItemData(itemInfo.id, { authentication: srcAuthentication })
|
|
41
42
|
.then(data => {
|
|
42
43
|
// append into the model
|
|
43
44
|
model.data = data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storymap-processor.js","sourceRoot":"","sources":["../../src/storymap-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,EAIL,mBAAmB,EAEnB,6BAA6B,EAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAU,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D
|
|
1
|
+
{"version":3,"file":"storymap-processor.js","sourceRoot":"","sources":["../../src/storymap-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,EAIL,mBAAmB,EAEnB,6BAA6B,EAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAU,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,cAAsB,EACtB,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,WAAW,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC;SACn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AE,CAAC,EAAE;QACV,oBAAoB,CAAC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACrE,MAAM,EAAE,CAAC;IACX,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,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"}
|
|
@@ -16,12 +16,13 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.isAStoryMap = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
19
20
|
/**
|
|
20
21
|
* Manages the creation and deployment of Story Map item types.
|
|
21
22
|
*
|
|
22
23
|
* @module storymap
|
|
23
24
|
*/
|
|
24
|
-
const common = require("@esri/solution-common");
|
|
25
|
+
const common = (0, tslib_1.__importStar)(require("@esri/solution-common"));
|
|
25
26
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
26
27
|
function convertItemToTemplate(solutionItemId, itemInfo) {
|
|
27
28
|
return new Promise((resolve, reject) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classic-storymap-processor.js","sourceRoot":"","sources":["../../src/classic-storymap-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"classic-storymap-processor.js","sourceRoot":"","sources":["../../src/classic-storymap-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,2EAAgD;AAEhD,wHAAwH;AAExH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa;IAEb,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,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CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;KAC1C;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAdD,kCAcC"}
|
|
@@ -31,7 +31,12 @@ function convertStoryMapToTemplate(model) {
|
|
|
31
31
|
tmpl.key = `${(0, hub_common_1.propifyString)(model.item.title)}_${(0, hub_common_1.createId)("i")}`;
|
|
32
32
|
const clone = (0, hub_common_1.cloneObject)(model);
|
|
33
33
|
tmpl.data = clone.data;
|
|
34
|
+
// We need to save these properties in order to restore them after hub.js deletes them
|
|
35
|
+
const created = clone.item.created;
|
|
36
|
+
const modified = clone.item.modified;
|
|
34
37
|
tmpl.item = (0, hub_common_1.normalizeSolutionTemplateItem)(clone.item);
|
|
38
|
+
tmpl.item.created = created;
|
|
39
|
+
tmpl.item.modified = modified;
|
|
35
40
|
// templatize the url
|
|
36
41
|
tmpl.item.url = "{{storyMapTemplateUrl}}";
|
|
37
42
|
// Storymap Webmap Resources have complex keys that we need to remap
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-storymap-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-storymap-to-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAO0B;AAE1B,2DAG+B;AAC/B,2DAAsD;AACtD,2EAAsE;AAEtE;;;;;GAKG;AACH,SAAgB,yBAAyB,CACvC,KAAa;IAEb,MAAM,IAAI,GAAG,IAAA,2CAAyB,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,GAAG,GAAG,GAAG,IAAA,0BAAa,EAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAA,qBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC;IAEjE,MAAM,KAAK,GAAG,IAAA,wBAAW,EAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,GA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AAmB;IACnB,QAAQ;AACV,CAAC;AAhED,8DAgEC;AAED,qBAAqB;AACrB,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AAC1D,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAE/C;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,MAAM,EAAE;QACN,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,kBAAkB;QACzB,GAAG,EAAE,yBAAyB;QAC9B,aAAa,EAAE,kBAAkB;QACjC,YAAY,EAAE,qBAAqB;QACnC,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,aAAa,EAAE,0BAA0B;QACzC,gBAAgB,EAAE,OAAO;QACzB,eAAe,EAAE,KAAK;QACtB,IAAI,EACF,0HAA0H;QAC5H,SAAS,EAAE,KAAK;KACjB;IACD,SAAS,EACP,0rBAA0rB;CAC7rB,CAAC"}
|
package/dist/node/index.js
CHANGED
|
@@ -16,13 +16,14 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.ClassicStoryMapProcessor = exports.StoryMapProcessor = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
19
20
|
/**
|
|
20
21
|
* Manages the creation and deployment of Story Map item types.
|
|
21
22
|
*
|
|
22
23
|
* @module storymap
|
|
23
24
|
*/
|
|
24
|
-
const StoryMapProcessor = require("./storymap-processor");
|
|
25
|
+
const StoryMapProcessor = (0, tslib_1.__importStar)(require("./storymap-processor"));
|
|
25
26
|
exports.StoryMapProcessor = StoryMapProcessor;
|
|
26
|
-
const ClassicStoryMapProcessor = require("./classic-storymap-processor");
|
|
27
|
+
const ClassicStoryMapProcessor = (0, tslib_1.__importStar)(require("./classic-storymap-processor"));
|
|
27
28
|
exports.ClassicStoryMapProcessor = ClassicStoryMapProcessor;
|
|
28
29
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH;;;;GAIG;AAEH,qFAA0D;AAGjD,8CAAiB;AAF1B,oGAAyE;AAE7C,4DAAwB"}
|
|
@@ -24,9 +24,10 @@ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse,
|
|
|
24
24
|
*
|
|
25
25
|
* @param solutionItemId
|
|
26
26
|
* @param itemInfo
|
|
27
|
-
* @param
|
|
27
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
28
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
29
|
*/
|
|
29
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any,
|
|
30
|
+
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
|
|
30
31
|
/**
|
|
31
32
|
* Create a StoryMap from the passed in template
|
|
32
33
|
*
|
|
@@ -32,15 +32,16 @@ const create_storymap_1 = require("./helpers/create-storymap");
|
|
|
32
32
|
*
|
|
33
33
|
* @param solutionItemId
|
|
34
34
|
* @param itemInfo
|
|
35
|
-
* @param
|
|
35
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
36
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
36
37
|
*/
|
|
37
|
-
function convertItemToTemplate(solutionItemId, itemInfo,
|
|
38
|
+
function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
|
|
38
39
|
const model = {
|
|
39
40
|
item: itemInfo,
|
|
40
41
|
data: {}
|
|
41
42
|
};
|
|
42
43
|
// fetch the data.json
|
|
43
|
-
return (0, arcgis_rest_portal_1.getItemData)(itemInfo.id, { authentication })
|
|
44
|
+
return (0, arcgis_rest_portal_1.getItemData)(itemInfo.id, { authentication: srcAuthentication })
|
|
44
45
|
.then(data => {
|
|
45
46
|
// append into the model
|
|
46
47
|
model.data = data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storymap-processor.js","sourceRoot":"","sources":["../../src/storymap-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,2DAO+B;AAC/B,iDAAoD;AACpD,iEAAmE;AACnE,yFAAmF;AACnF,uGAAgG;AAChG,+DAA2D;AAE3D
|
|
1
|
+
{"version":3,"file":"storymap-processor.js","sourceRoot":"","sources":["../../src/storymap-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,2DAO+B;AAC/B,iDAAoD;AACpD,iEAAmE;AACnE,yFAAmF;AACnF,uGAAgG;AAChG,+DAA2D;AAE3D;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,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,gCAAW,EAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAC;SACnE,IAAI,CAAC,IAAI,CAAC,EAAE;QACX,wBAAwB;QACxB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,oCAAoC;QACpC,OAAO,IAAA,wDAAyB,EAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,EAAE;QACX,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACP,CAAC;AArBD,sDAqBC;AAED;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACpC,QAAuB,EACvB,kBAAuB,EACvB,yBAAsC,EACtC,oBA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;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,kCAMC"}
|
|
@@ -24,9 +24,10 @@ import { IItemTemplate, IItemProgressCallback, ICreateItemFromTemplateResponse,
|
|
|
24
24
|
*
|
|
25
25
|
* @param solutionItemId
|
|
26
26
|
* @param itemInfo
|
|
27
|
-
* @param
|
|
27
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
28
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
28
29
|
*/
|
|
29
|
-
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any,
|
|
30
|
+
export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
|
|
30
31
|
/**
|
|
31
32
|
* Create a StoryMap from the passed in template
|
|
32
33
|
*
|
package/dist/umd/storymap.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-storymap - v1.
|
|
3
|
-
* Copyright (c) 2018-
|
|
4
|
-
*
|
|
2
|
+
* @esri/solution-storymap - v1.3.0 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
+
* Thu Feb 17 2022 09:42:53 GMT-0800 (Pacific Standard 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.
|
|
@@ -18,8 +18,28 @@
|
|
|
18
18
|
(function (global, factory) {
|
|
19
19
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common'), require('@esri/hub-common'), require('@esri/arcgis-rest-portal')) :
|
|
20
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
|
-
}(this, (function (exports, common, hubCommon, arcgisRestPortal) { 'use strict';
|
|
21
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution, global.arcgisHub, global.arcgisRest));
|
|
22
|
+
})(this, (function (exports, common, hubCommon, arcgisRestPortal) { 'use strict';
|
|
23
|
+
|
|
24
|
+
function _interopNamespace(e) {
|
|
25
|
+
if (e && e.__esModule) return e;
|
|
26
|
+
var n = Object.create(null);
|
|
27
|
+
if (e) {
|
|
28
|
+
Object.keys(e).forEach(function (k) {
|
|
29
|
+
if (k !== 'default') {
|
|
30
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
31
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return e[k]; }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
n["default"] = e;
|
|
39
|
+
return Object.freeze(n);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var common__namespace = /*#__PURE__*/_interopNamespace(common);
|
|
23
43
|
|
|
24
44
|
/** @license
|
|
25
45
|
* Copyright 2018 Esri
|
|
@@ -117,7 +137,12 @@
|
|
|
117
137
|
tmpl.key = `${hubCommon.propifyString(model.item.title)}_${hubCommon.createId("i")}`;
|
|
118
138
|
const clone = hubCommon.cloneObject(model);
|
|
119
139
|
tmpl.data = clone.data;
|
|
140
|
+
// We need to save these properties in order to restore them after hub.js deletes them
|
|
141
|
+
const created = clone.item.created;
|
|
142
|
+
const modified = clone.item.modified;
|
|
120
143
|
tmpl.item = hubCommon.normalizeSolutionTemplateItem(clone.item);
|
|
144
|
+
tmpl.item.created = created;
|
|
145
|
+
tmpl.item.modified = modified;
|
|
121
146
|
// templatize the url
|
|
122
147
|
tmpl.item.url = "{{storyMapTemplateUrl}}";
|
|
123
148
|
// Storymap Webmap Resources have complex keys that we need to remap
|
|
@@ -385,15 +410,16 @@
|
|
|
385
410
|
*
|
|
386
411
|
* @param solutionItemId
|
|
387
412
|
* @param itemInfo
|
|
388
|
-
* @param
|
|
413
|
+
* @param destAuthentication Credentials for requests to the destination organization
|
|
414
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
389
415
|
*/
|
|
390
|
-
function convertItemToTemplate(solutionItemId, itemInfo,
|
|
416
|
+
function convertItemToTemplate$1(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
|
|
391
417
|
const model = {
|
|
392
418
|
item: itemInfo,
|
|
393
419
|
data: {}
|
|
394
420
|
};
|
|
395
421
|
// fetch the data.json
|
|
396
|
-
return arcgisRestPortal.getItemData(itemInfo.id, { authentication })
|
|
422
|
+
return arcgisRestPortal.getItemData(itemInfo.id, { authentication: srcAuthentication })
|
|
397
423
|
.then(data => {
|
|
398
424
|
// append into the model
|
|
399
425
|
model.data = data;
|
|
@@ -412,7 +438,7 @@
|
|
|
412
438
|
* @param destinationAuthentication
|
|
413
439
|
* @param itemProgressCallback
|
|
414
440
|
*/
|
|
415
|
-
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
441
|
+
function createItemFromTemplate$1(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
416
442
|
// let the progress system know we've started...
|
|
417
443
|
const startStatus = itemProgressCallback(template.itemId, common.EItemProgressStatus.Started, 0);
|
|
418
444
|
// and if it returned false, just resolve out
|
|
@@ -480,7 +506,7 @@
|
|
|
480
506
|
throw ex;
|
|
481
507
|
});
|
|
482
508
|
}
|
|
483
|
-
function isAStoryMap(itemType) {
|
|
509
|
+
function isAStoryMap$1(itemType) {
|
|
484
510
|
let result = false;
|
|
485
511
|
if (itemType === "StoryMap") {
|
|
486
512
|
result = true;
|
|
@@ -490,9 +516,9 @@
|
|
|
490
516
|
|
|
491
517
|
var storymapProcessor = /*#__PURE__*/Object.freeze({
|
|
492
518
|
__proto__: null,
|
|
493
|
-
convertItemToTemplate: convertItemToTemplate,
|
|
494
|
-
createItemFromTemplate: createItemFromTemplate,
|
|
495
|
-
isAStoryMap: isAStoryMap
|
|
519
|
+
convertItemToTemplate: convertItemToTemplate$1,
|
|
520
|
+
createItemFromTemplate: createItemFromTemplate$1,
|
|
521
|
+
isAStoryMap: isAStoryMap$1
|
|
496
522
|
});
|
|
497
523
|
|
|
498
524
|
/** @license
|
|
@@ -511,31 +537,31 @@
|
|
|
511
537
|
* limitations under the License.
|
|
512
538
|
*/
|
|
513
539
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
514
|
-
function convertItemToTemplate
|
|
540
|
+
function convertItemToTemplate(solutionItemId, itemInfo) {
|
|
515
541
|
return new Promise((resolve, reject) => {
|
|
516
|
-
if (isAStoryMap
|
|
517
|
-
reject(
|
|
542
|
+
if (isAStoryMap(itemInfo.type, itemInfo.url)) {
|
|
543
|
+
reject(common__namespace.fail("Classic StoryMap is not yet implemented"));
|
|
518
544
|
}
|
|
519
545
|
else {
|
|
520
|
-
reject(
|
|
546
|
+
reject(common__namespace.fail(itemInfo.id + " is not a StoryMap"));
|
|
521
547
|
}
|
|
522
548
|
});
|
|
523
549
|
}
|
|
524
|
-
function createItemFromTemplate
|
|
550
|
+
function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
|
|
525
551
|
return new Promise(resolve => {
|
|
526
|
-
if (isAStoryMap
|
|
552
|
+
if (isAStoryMap(template.type, template.item.url)) {
|
|
527
553
|
// Not yet implemented
|
|
528
|
-
itemProgressCallback(template.itemId,
|
|
529
|
-
resolve(
|
|
554
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
555
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type));
|
|
530
556
|
}
|
|
531
557
|
else {
|
|
532
558
|
// Not valid
|
|
533
|
-
itemProgressCallback(template.itemId,
|
|
534
|
-
resolve(
|
|
559
|
+
itemProgressCallback(template.itemId, common__namespace.EItemProgressStatus.Failed, 0);
|
|
560
|
+
resolve(common__namespace.generateEmptyCreationResponse(template.type));
|
|
535
561
|
}
|
|
536
562
|
});
|
|
537
563
|
}
|
|
538
|
-
function isAStoryMap
|
|
564
|
+
function isAStoryMap(itemType, itemUrl) {
|
|
539
565
|
if (itemUrl) {
|
|
540
566
|
return [
|
|
541
567
|
/\/apps\/Cascade\//i,
|
|
@@ -553,9 +579,9 @@
|
|
|
553
579
|
|
|
554
580
|
var classicStorymapProcessor = /*#__PURE__*/Object.freeze({
|
|
555
581
|
__proto__: null,
|
|
556
|
-
convertItemToTemplate: convertItemToTemplate
|
|
557
|
-
createItemFromTemplate: createItemFromTemplate
|
|
558
|
-
isAStoryMap: isAStoryMap
|
|
582
|
+
convertItemToTemplate: convertItemToTemplate,
|
|
583
|
+
createItemFromTemplate: createItemFromTemplate,
|
|
584
|
+
isAStoryMap: isAStoryMap
|
|
559
585
|
});
|
|
560
586
|
|
|
561
587
|
exports.ClassicStoryMapProcessor = classicStorymapProcessor;
|
|
@@ -563,5 +589,5 @@
|
|
|
563
589
|
|
|
564
590
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
565
591
|
|
|
566
|
-
}))
|
|
592
|
+
}));
|
|
567
593
|
//# sourceMappingURL=storymap.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storymap.umd.js","sources":["../../src/helpers/remap-webmap-keys.ts","../../src/helpers/get-storymap-dependencies.ts","../../src/helpers/convert-storymap-to-template.ts","../../src/helpers/get-portal-env.ts","../../src/helpers/get-storymap-subdomain.ts","../../src/helpers/get-storymap-base-url.ts","../../src/helpers/create-storymap-model-from-template.ts","../../src/helpers/create-storymap.ts","../../src/storymap-processor.ts","../../src/classic-storymap-processor.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { getProp } from \"@esri/hub-common\";\r\n\r\n/**\r\n * For some reason, the webmap resource key names are fancier than other resource keys\r\n * They look like this: r-<webmap-item-id>-<timestamp>\r\n * This interpolation is hard to accomplish given our current setup, so we're just overwriting\r\n * them with \"webmap0\", \"webmap1\" and so forth. This _seems_ to make no difference.\r\n *\r\n * @param model\r\n */\r\nexport function remapWebmapKeys(resources: any = {}): any[] {\r\n let webmapCounter = 0;\r\n return Object.keys(resources).reduce((acc, key) => {\r\n if (getProp(resources, `${key}.type`) === \"webmap\") {\r\n if (key !== `webmap${webmapCounter}`) {\r\n acc.push({\r\n original: key,\r\n updated: `webmap${webmapCounter}`\r\n });\r\n webmapCounter++;\r\n }\r\n }\r\n return acc;\r\n }, []);\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { IModel, getProp } from \"@esri/hub-common\";\r\n\r\n/**\r\n * Extract a list of Items this storymap depends on\r\n * At this point we are just extracting webmaps\r\n *\r\n * @param model IModel\r\n */\r\nexport function getStoryMapDependencies(model: IModel): any[] {\r\n const resources = getProp(model, \"data.resources\") || {};\r\n return Object.keys(resources).reduce((acc, key) => {\r\n if (getProp(resources, `${key}.type`) === \"webmap\") {\r\n acc.push(getProp(resources, `${key}.data.itemId`));\r\n }\r\n return acc;\r\n }, []);\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n IModel,\r\n cloneObject,\r\n propifyString,\r\n createId,\r\n normalizeSolutionTemplateItem,\r\n deepStringReplace\r\n} from \"@esri/hub-common\";\r\nimport { IItem } from \"@esri/arcgis-rest-portal\";\r\nimport {\r\n IItemTemplate,\r\n createPlaceholderTemplate\r\n} from \"@esri/solution-common\";\r\nimport { remapWebmapKeys } from \"./remap-webmap-keys\";\r\nimport { getStoryMapDependencies } from \"./get-storymap-dependencies\";\r\n\r\n/**\r\n * Convert a StoryMap IModel to an IItemTemplate\r\n *\r\n * @param model\r\n * @param authentication\r\n */\r\nexport function convertStoryMapToTemplate(\r\n model: IModel\r\n): Promise<IItemTemplate> {\r\n const tmpl = createPlaceholderTemplate(model.item.id, model.item.type);\r\n tmpl.key = `${propifyString(model.item.title)}_${createId(\"i\")}`;\r\n\r\n const clone = cloneObject(model);\r\n tmpl.data = clone.data;\r\n tmpl.item = normalizeSolutionTemplateItem(clone.item) as IItem;\r\n // templatize the url\r\n tmpl.item.url = \"{{storyMapTemplateUrl}}\";\r\n\r\n // Storymap Webmap Resources have complex keys that we need to remap\r\n const webmapRemaps = remapWebmapKeys(tmpl.data.resources);\r\n // and then replace in the rest of the structure\r\n webmapRemaps.forEach(remap => {\r\n tmpl.data.resources[remap.updated] = cloneObject(\r\n tmpl.data.resources[remap.original]\r\n );\r\n delete tmpl.data.resources[remap.original];\r\n tmpl.data.nodes = deepStringReplace(\r\n tmpl.data.nodes,\r\n remap.original,\r\n remap.updated\r\n );\r\n });\r\n\r\n // use typeKeyword to mark item as published\r\n // Note: Hub team decided to discard unpublished drafts when creating a template\r\n const typeKeywords = tmpl.item.typeKeywords;\r\n if (typeKeywords.indexOf(unPublishedChangesKW) !== -1) {\r\n tmpl.item.typeKeywords = [publishedChangesKW].concat(\r\n tmpl.item.typeKeywords.filter(\r\n (word: string) => word !== unPublishedChangesKW\r\n )\r\n );\r\n }\r\n\r\n tmpl.properties = {};\r\n tmpl.properties.draftFileName = \"draft_{{timestamp}}.json\";\r\n Object.assign(tmpl.properties, oEmbedTemplates);\r\n\r\n tmpl.dependencies = getStoryMapDependencies(model);\r\n\r\n return Promise.resolve(tmpl);\r\n // TODO: For now, we let the generic process handle item resources\r\n // However, many newer item types have complex type-specific resource handling\r\n // requirements so this code may be useful in the future\r\n // ------------------------------------------------------\r\n // return getItemResources(tmpl.itemId, hubRequestOptions)\r\n // .then((response) => {\r\n // tmpl.resources = response.resources.map(e => e.resource)\r\n // // Don't directly copy oembed resources because we need to template these\r\n // // Also, discard draft version of the storymap itself\r\n // .filter(filename => !filename.includes('oembed') && filename.search(/draft_[0-9]+.json/) === -1);\r\n // return tmpl;\r\n // });\r\n}\r\n\r\n// Internal constants\r\nconst unPublishedChangesKW = \"smstatusunpublishedchanges\";\r\nconst publishedChangesKW = \"smstatuspublished\";\r\n\r\n/**\r\n * Template for oEmbed\r\n */\r\nconst oEmbedTemplates = {\r\n oembed: {\r\n version: \"1.0\",\r\n type: \"rich\",\r\n title: \"Example StoryMap\",\r\n url: \"{{storyMapTemplateUrl}}\",\r\n provider_name: \"ArcGIS StoryMaps\",\r\n provider_url: \"{{storyMapBaseUrl}}\",\r\n width: 800,\r\n height: 600,\r\n thumbnail_url: \"{{storyMapThumbnailUrl}}\",\r\n thumbnail_height: \"100.5\",\r\n thumbnail_width: \"400\",\r\n html:\r\n '<iframe src=\"{{storyMapTemplateUrl}}\" width=\"800\" height=\"600\" scrolling=\"yes\" frameborder=\"0\" allowfullscreen></iframe>',\r\n cache_age: 86400\r\n },\r\n oembedXML:\r\n '<?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>'\r\n};\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nexport function getPortalEnv(authentication: UserSession): string {\r\n const portalUrl =\r\n authentication.portal || \"https://www.arcgis.com/sharing/rest\";\r\n let result = \"portal\";\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"qaext\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"devext\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"www\";\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nexport function getStoryMapSubdomain(authentication: UserSession): string {\r\n const portalUrl =\r\n authentication.portal || \"https://www.arcgis.com/sharing/rest\";\r\n // TODO: Sort out how we locate storymaps on portal?\r\n let result;\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"storymapsqa\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"storymapsdev\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"storymaps\";\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getStoryMapSubdomain } from \"./get-storymap-subdomain\";\r\n/**\r\n * For a given environment Prod/qa/dev/portal\r\n * return the correct storymaps base url\r\n *\r\n * @param authentication\r\n */\r\nexport function getStoryMapBaseUrl(authentication: UserSession): string {\r\n let baseUrl = \"\";\r\n\r\n const subdomain = getStoryMapSubdomain(authentication);\r\n if (subdomain) {\r\n baseUrl = `https://${subdomain}.arcgis.com`;\r\n } else {\r\n // we're on portal\r\n // chop off the /sharing/rest to get the baseUrl\r\n const portalBaseUrl = authentication.portal.replace(\"/sharing/rest\", \"\");\r\n baseUrl = `${portalBaseUrl}/apps/storymaps`;\r\n }\r\n\r\n return baseUrl;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Given a template, process it and interpolate it such that\r\n * we have a model that is ready to be sent to the Portal API\r\n */\r\n\r\nimport { interpolate, IModelTemplate } from \"@esri/hub-common\";\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getPortalEnv } from \"./get-portal-env\";\r\nimport { getStoryMapBaseUrl } from \"./get-storymap-base-url\";\r\nimport { getStoryMapSubdomain } from \"./get-storymap-subdomain\";\r\n\r\nexport function createStoryMapModelFromTemplate(\r\n templateModel: IModelTemplate,\r\n settings: any,\r\n transforms: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n const timestamp = new Date().getTime();\r\n // Keep these around in case we encounter some old templates\r\n settings.agoenv = getPortalEnv(authentication);\r\n settings.smBase = getStoryMapSubdomain(authentication);\r\n settings.timestamp = new Date().getTime();\r\n // These are used in the oembed resource, as well as the item url\r\n // they have `{{appid}}` in them so that the id of the created item\r\n // will be interpolated into it after the item is created\r\n settings.storyMapBaseUrl = getStoryMapBaseUrl(authentication);\r\n settings.storyMapTemplateUrl = `${settings.storyMapBaseUrl}/stories/{{appid}}`;\r\n settings.storyMapThumnailUrl = `${authentication.portal}/content/items/{{appid}}/info/thumbnail/thumbnail.jpg/?w=400&d=${timestamp}`;\r\n\r\n const model = interpolate(templateModel, settings, transforms);\r\n\r\n return Promise.resolve(model);\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n// TODO ENSURE THIS CREATES IN THE TARGET FOLDER\r\nimport {\r\n IModel,\r\n failSafe,\r\n serializeModel,\r\n interpolateItemId,\r\n stringToBlob\r\n} from \"@esri/hub-common\";\r\n\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nimport {\r\n createItem,\r\n moveItem,\r\n addItemResource,\r\n updateItem,\r\n ICreateItemOptions,\r\n ICreateItemResponse\r\n} from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Create a StoryMap from an interpolated template\r\n *\r\n * @param model\r\n * @param options\r\n * @param authentication\r\n */\r\nexport function createStoryMap(\r\n model: IModel,\r\n folderId: string,\r\n options: any,\r\n authentication: UserSession\r\n): Promise<IModel> {\r\n // create an array to hold well-known resources\r\n // that we have to generate from the passed in model\r\n const resources: any[] = [];\r\n\r\n // For unknown reasons we can not seem to spy on createItemInFolder\r\n // so we will create-then-move for now\r\n const createOptions: ICreateItemOptions = {\r\n // need to serialize\r\n item: serializeModel(model),\r\n authentication\r\n };\r\n\r\n /* istanbul ignore else */\r\n if (model.item.thumbnail) {\r\n createOptions.params = {\r\n // Pass thumbnail file in via params because item property is serialized, which discards a blob\r\n thumbnail: model.item.thumbnail\r\n };\r\n delete createOptions.item.thumbnail;\r\n }\r\n\r\n // Create the item\r\n return createItem(createOptions)\r\n .then((createResponse: ICreateItemResponse) => {\r\n // hold the id in the model\r\n model.item.id = createResponse.id;\r\n // and re-interpolate the item id\r\n model = interpolateItemId(model);\r\n // Compute the item url based on current environment\r\n\r\n // Storymaps store draft data in a timestamped resource attached to the item\r\n // We'll just use the published data for the first \"draft\"\r\n resources.push({\r\n name: model.properties.draftFileName,\r\n file: stringToBlob(JSON.stringify(model.data))\r\n });\r\n resources.push({\r\n name: \"oembed.json\",\r\n file: stringToBlob(JSON.stringify(model.properties.oembed))\r\n });\r\n resources.push({\r\n name: \"oembed.xml\",\r\n file: stringToBlob(model.properties.oembedXML)\r\n });\r\n // remove the properties hash now that we've gotten what we need\r\n delete model.properties;\r\n // update the item with the newly re-interpolated model\r\n return Promise.all([\r\n updateItem({\r\n item: serializeModel(model),\r\n authentication\r\n }),\r\n authentication.getUsername()\r\n ]);\r\n })\r\n .then((responses: any[]) => {\r\n const username = responses[1];\r\n // add the resources\r\n const failSafeAddItemResource = failSafe(addItemResource, {\r\n success: true\r\n });\r\n const resourcePromises = resources.map(resource => {\r\n return failSafeAddItemResource({\r\n id: model.item.id,\r\n owner: username,\r\n resource: resource.file,\r\n name: resource.name,\r\n authentication\r\n });\r\n });\r\n // Fire and forget as these are not critical-path\r\n return Promise.all(resourcePromises);\r\n })\r\n .then(() => {\r\n // Move it\r\n return moveItem({\r\n itemId: model.item.id,\r\n folderId,\r\n authentication\r\n });\r\n })\r\n .then(() => {\r\n return model;\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of Story Map item types.\r\n *\r\n * @module storymap\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse,\r\n EItemProgressStatus,\r\n UserSession,\r\n generateEmptyCreationResponse\r\n} from \"@esri/solution-common\";\r\nimport { IModel, failSafe } from \"@esri/hub-common\";\r\nimport { getItemData, removeItem } from \"@esri/arcgis-rest-portal\";\r\nimport { convertStoryMapToTemplate } from \"./helpers/convert-storymap-to-template\";\r\nimport { createStoryMapModelFromTemplate } from \"./helpers/create-storymap-model-from-template\";\r\nimport { createStoryMap } from \"./helpers/create-storymap\";\r\n\r\n/**\r\n * Convert a StoryMap to a template\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo\r\n * @param authentication\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n authentication: UserSession\r\n): Promise<IItemTemplate> {\r\n const model = {\r\n item: itemInfo,\r\n data: {}\r\n } as IModel;\r\n // fetch the data.json\r\n return getItemData(itemInfo.id, { authentication })\r\n .then(data => {\r\n // append into the model\r\n model.data = data;\r\n // and use that to create a template\r\n return convertStoryMapToTemplate(model);\r\n })\r\n .then(tmpl => {\r\n return tmpl;\r\n });\r\n}\r\n\r\n/**\r\n * Create a StoryMap from the passed in template\r\n *\r\n * @param template\r\n * @param templateDictionary\r\n * @param destinationAuthentication\r\n * @param itemProgressCallback\r\n */\r\nexport function createItemFromTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n // let the progress system know we've started...\r\n const startStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Started,\r\n 0\r\n );\r\n\r\n // and if it returned false, just resolve out\r\n if (!startStatus) {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n }\r\n\r\n // ensure we have a solution object in the templateDictionary hash\r\n if (!templateDictionary.solution) {\r\n templateDictionary.solution = {};\r\n }\r\n // .title should always be set on the templateDictionary\r\n templateDictionary.solution.title = templateDictionary.title;\r\n\r\n // TODO: Determine if we need any transforms in this new env\r\n const transforms = {};\r\n\r\n // create an object to hold the created site through\r\n // subsequent promise calls\r\n let model: IModel;\r\n\r\n // Create the \"siteModel\" from the template. Does not save the site item yet\r\n // Note: depending on licensing and user privs, will also create the team groups\r\n // and initiative item.\r\n return createStoryMapModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n transforms,\r\n destinationAuthentication\r\n )\r\n .then(interpolated => {\r\n const options = {\r\n assets: interpolated.assets || []\r\n };\r\n return createStoryMap(\r\n interpolated,\r\n templateDictionary.folderId,\r\n options,\r\n destinationAuthentication\r\n );\r\n })\r\n .then(createdModel => {\r\n model = createdModel;\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever receives\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: model.item.id\r\n };\r\n // call the progress callback, which also mutates templateDictionary\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n model.item.id\r\n );\r\n if (!finalStatus) {\r\n // clean up the site we just created\r\n const failSafeRemove = failSafe(removeItem, { success: true });\r\n return failSafeRemove({\r\n id: model.item.id,\r\n authentication: destinationAuthentication\r\n }).then(() => {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n });\r\n } else {\r\n // finally, return ICreateItemFromTemplateResponse\r\n const response: ICreateItemFromTemplateResponse = {\r\n item: {\r\n ...template,\r\n ...model\r\n },\r\n id: model.item.id,\r\n type: template.type,\r\n postProcess: false\r\n };\r\n response.item.itemId = model.item.id;\r\n return response;\r\n }\r\n })\r\n .catch(ex => {\r\n itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);\r\n throw ex;\r\n });\r\n}\r\n\r\nexport function isAStoryMap(itemType: string): boolean {\r\n let result = false;\r\n if (itemType === \"StoryMap\") {\r\n result = true;\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of Story Map item types.\r\n *\r\n * @module storymap\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>((resolve, reject) => {\r\n if (isAStoryMap(itemInfo.type, itemInfo.url)) {\r\n reject(common.fail(\"Classic StoryMap is not yet implemented\"));\r\n } else {\r\n reject(common.fail(itemInfo.id + \" is not a StoryMap\"));\r\n }\r\n });\r\n}\r\n\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n if (isAStoryMap(template.type, template.item.url)) {\r\n // Not yet implemented\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n } else {\r\n // Not valid\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n }\r\n });\r\n}\r\n\r\nexport function isAStoryMap(itemType: string, itemUrl?: string): boolean {\r\n if (itemUrl) {\r\n return [\r\n /\\/apps\\/Cascade\\//i,\r\n /\\/apps\\/MapJournal\\//i,\r\n /\\/apps\\/MapSeries\\//i,\r\n /\\/apps\\/MapTour\\//i,\r\n /\\/apps\\/Shortlist\\//i,\r\n /\\/apps\\/StoryMap\\//i,\r\n /\\/apps\\/StoryMapBasic\\//i,\r\n /\\/apps\\/StorytellingSwipe\\//i\r\n ].some(pattern => pattern.test(itemUrl));\r\n }\r\n return false;\r\n}\r\n"],"names":["getProp","createPlaceholderTemplate","propifyString","createId","cloneObject","normalizeSolutionTemplateItem","deepStringReplace","interpolate","serializeModel","createItem","interpolateItemId","stringToBlob","updateItem","failSafe","addItemResource","moveItem","getItemData","EItemProgressStatus","generateEmptyCreationResponse","removeItem","convertItemToTemplate","isAStoryMap","common.fail","createItemFromTemplate","common.EItemProgressStatus","common.generateEmptyCreationResponse"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;EAkBA;;;;;;;;WAQgB,eAAe,CAAC,YAAiB,EAAE;MACjD,IAAI,aAAa,GAAG,CAAC,CAAC;MACtB,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG;UAC5C,IAAIA,iBAAO,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,KAAK,QAAQ,EAAE;cAClD,IAAI,GAAG,KAAK,SAAS,aAAa,EAAE,EAAE;kBACpC,GAAG,CAAC,IAAI,CAAC;sBACP,QAAQ,EAAE,GAAG;sBACb,OAAO,EAAE,SAAS,aAAa,EAAE;mBAClC,CAAC,CAAC;kBACH,aAAa,EAAE,CAAC;eACjB;WACF;UACD,OAAO,GAAG,CAAC;OACZ,EAAE,EAAE,CAAC,CAAC;EACT;;ECxCA;;;;;;;;;;;;;;;AAgBA,EAEA;;;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CAAC;WAChE;eAAM;cACL,MAAM,CAACA,WAAW,CAAC,QAAQ,CAAC,EAAE,GAAG,oBAAoB,CAAC,CAAC,CAAC;WACzD;OACF,CAAC,CAAC;EACL,CAAC;AAED,WAAgBC,wBAAsB,CACpC,QAA8B,EAC9B,kBAAuB,EACvB,yBAA6C,EAC7C,oBAAkD;MAElD,OAAO,IAAI,OAAO,CAAyC,OAAO;UAChE,IAAIF,aAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;;cAEjD,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACfG,0BAA0B,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;cACF,OAAO,CAACC,oCAAoC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;WAC9D;eAAM;;cAEL,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACfD,0BAA0B,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;cACF,OAAO,CAACC,oCAAoC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;WAC9D;OACF,CAAC,CAAC;EACL,CAAC;AAED,WAAgBJ,aAAW,CAAC,QAAgB,EAAE,OAAgB;MAC5D,IAAI,OAAO,EAAE;UACX,OAAO;cACL,oBAAoB;cACpB,uBAAuB;cACvB,sBAAsB;cACtB,oBAAoB;cACpB,sBAAsB;cACtB,qBAAqB;cACrB,0BAA0B;cAC1B,8BAA8B;WAC/B,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;OAC1C;MACD,OAAO,KAAK,CAAC;EACf,CAAC;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"storymap.umd.js","sources":["../../src/helpers/remap-webmap-keys.ts","../../src/helpers/get-storymap-dependencies.ts","../../src/helpers/convert-storymap-to-template.ts","../../src/helpers/get-portal-env.ts","../../src/helpers/get-storymap-subdomain.ts","../../src/helpers/get-storymap-base-url.ts","../../src/helpers/create-storymap-model-from-template.ts","../../src/helpers/create-storymap.ts","../../src/storymap-processor.ts","../../src/classic-storymap-processor.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { getProp } from \"@esri/hub-common\";\r\n\r\n/**\r\n * For some reason, the webmap resource key names are fancier than other resource keys\r\n * They look like this: r-<webmap-item-id>-<timestamp>\r\n * This interpolation is hard to accomplish given our current setup, so we're just overwriting\r\n * them with \"webmap0\", \"webmap1\" and so forth. This _seems_ to make no difference.\r\n *\r\n * @param model\r\n */\r\nexport function remapWebmapKeys(resources: any = {}): any[] {\r\n let webmapCounter = 0;\r\n return Object.keys(resources).reduce((acc, key) => {\r\n if (getProp(resources, `${key}.type`) === \"webmap\") {\r\n if (key !== `webmap${webmapCounter}`) {\r\n acc.push({\r\n original: key,\r\n updated: `webmap${webmapCounter}`\r\n });\r\n webmapCounter++;\r\n }\r\n }\r\n return acc;\r\n }, []);\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { IModel, getProp } from \"@esri/hub-common\";\r\n\r\n/**\r\n * Extract a list of Items this storymap depends on\r\n * At this point we are just extracting webmaps\r\n *\r\n * @param model IModel\r\n */\r\nexport function getStoryMapDependencies(model: IModel): any[] {\r\n const resources = getProp(model, \"data.resources\") || {};\r\n return Object.keys(resources).reduce((acc, key) => {\r\n if (getProp(resources, `${key}.type`) === \"webmap\") {\r\n acc.push(getProp(resources, `${key}.data.itemId`));\r\n }\r\n return acc;\r\n }, []);\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n IModel,\r\n cloneObject,\r\n propifyString,\r\n createId,\r\n normalizeSolutionTemplateItem,\r\n deepStringReplace\r\n} from \"@esri/hub-common\";\r\nimport { IItem } from \"@esri/arcgis-rest-portal\";\r\nimport {\r\n IItemTemplate,\r\n createPlaceholderTemplate\r\n} from \"@esri/solution-common\";\r\nimport { remapWebmapKeys } from \"./remap-webmap-keys\";\r\nimport { getStoryMapDependencies } from \"./get-storymap-dependencies\";\r\n\r\n/**\r\n * Convert a StoryMap IModel to an IItemTemplate\r\n *\r\n * @param model\r\n * @param authentication\r\n */\r\nexport function convertStoryMapToTemplate(\r\n model: IModel\r\n): Promise<IItemTemplate> {\r\n const tmpl = createPlaceholderTemplate(model.item.id, model.item.type);\r\n tmpl.key = `${propifyString(model.item.title)}_${createId(\"i\")}`;\r\n\r\n const clone = cloneObject(model);\r\n tmpl.data = clone.data;\r\n\r\n // We need to save these properties in order to restore them after hub.js deletes them\r\n const created = clone.item.created;\r\n const modified = clone.item.modified;\r\n tmpl.item = normalizeSolutionTemplateItem(clone.item) as IItem;\r\n tmpl.item.created = created;\r\n tmpl.item.modified = modified;\r\n\r\n // templatize the url\r\n tmpl.item.url = \"{{storyMapTemplateUrl}}\";\r\n\r\n // Storymap Webmap Resources have complex keys that we need to remap\r\n const webmapRemaps = remapWebmapKeys(tmpl.data.resources);\r\n // and then replace in the rest of the structure\r\n webmapRemaps.forEach(remap => {\r\n tmpl.data.resources[remap.updated] = cloneObject(\r\n tmpl.data.resources[remap.original]\r\n );\r\n delete tmpl.data.resources[remap.original];\r\n tmpl.data.nodes = deepStringReplace(\r\n tmpl.data.nodes,\r\n remap.original,\r\n remap.updated\r\n );\r\n });\r\n\r\n // use typeKeyword to mark item as published\r\n // Note: Hub team decided to discard unpublished drafts when creating a template\r\n const typeKeywords = tmpl.item.typeKeywords;\r\n if (typeKeywords.indexOf(unPublishedChangesKW) !== -1) {\r\n tmpl.item.typeKeywords = [publishedChangesKW].concat(\r\n tmpl.item.typeKeywords.filter(\r\n (word: string) => word !== unPublishedChangesKW\r\n )\r\n );\r\n }\r\n\r\n tmpl.properties = {};\r\n tmpl.properties.draftFileName = \"draft_{{timestamp}}.json\";\r\n Object.assign(tmpl.properties, oEmbedTemplates);\r\n\r\n tmpl.dependencies = getStoryMapDependencies(model);\r\n\r\n return Promise.resolve(tmpl);\r\n // TODO: For now, we let the generic process handle item resources\r\n // However, many newer item types have complex type-specific resource handling\r\n // requirements so this code may be useful in the future\r\n // ------------------------------------------------------\r\n // return getItemResources(tmpl.itemId, hubRequestOptions)\r\n // .then((response) => {\r\n // tmpl.resources = response.resources.map(e => e.resource)\r\n // // Don't directly copy oembed resources because we need to template these\r\n // // Also, discard draft version of the storymap itself\r\n // .filter(filename => !filename.includes('oembed') && filename.search(/draft_[0-9]+.json/) === -1);\r\n // return tmpl;\r\n // });\r\n}\r\n\r\n// Internal constants\r\nconst unPublishedChangesKW = \"smstatusunpublishedchanges\";\r\nconst publishedChangesKW = \"smstatuspublished\";\r\n\r\n/**\r\n * Template for oEmbed\r\n */\r\nconst oEmbedTemplates = {\r\n oembed: {\r\n version: \"1.0\",\r\n type: \"rich\",\r\n title: \"Example StoryMap\",\r\n url: \"{{storyMapTemplateUrl}}\",\r\n provider_name: \"ArcGIS StoryMaps\",\r\n provider_url: \"{{storyMapBaseUrl}}\",\r\n width: 800,\r\n height: 600,\r\n thumbnail_url: \"{{storyMapThumbnailUrl}}\",\r\n thumbnail_height: \"100.5\",\r\n thumbnail_width: \"400\",\r\n html:\r\n '<iframe src=\"{{storyMapTemplateUrl}}\" width=\"800\" height=\"600\" scrolling=\"yes\" frameborder=\"0\" allowfullscreen></iframe>',\r\n cache_age: 86400\r\n },\r\n oembedXML:\r\n '<?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>'\r\n};\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nexport function getPortalEnv(authentication: UserSession): string {\r\n const portalUrl =\r\n authentication.portal || \"https://www.arcgis.com/sharing/rest\";\r\n let result = \"portal\";\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"qaext\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"devext\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"www\";\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nexport function getStoryMapSubdomain(authentication: UserSession): string {\r\n const portalUrl =\r\n authentication.portal || \"https://www.arcgis.com/sharing/rest\";\r\n // TODO: Sort out how we locate storymaps on portal?\r\n let result;\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"storymapsqa\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"storymapsdev\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"storymaps\";\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getStoryMapSubdomain } from \"./get-storymap-subdomain\";\r\n/**\r\n * For a given environment Prod/qa/dev/portal\r\n * return the correct storymaps base url\r\n *\r\n * @param authentication\r\n */\r\nexport function getStoryMapBaseUrl(authentication: UserSession): string {\r\n let baseUrl = \"\";\r\n\r\n const subdomain = getStoryMapSubdomain(authentication);\r\n if (subdomain) {\r\n baseUrl = `https://${subdomain}.arcgis.com`;\r\n } else {\r\n // we're on portal\r\n // chop off the /sharing/rest to get the baseUrl\r\n const portalBaseUrl = authentication.portal.replace(\"/sharing/rest\", \"\");\r\n baseUrl = `${portalBaseUrl}/apps/storymaps`;\r\n }\r\n\r\n return baseUrl;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Given a template, process it and interpolate it such that\r\n * we have a model that is ready to be sent to the Portal API\r\n */\r\n\r\nimport { interpolate, IModelTemplate } from \"@esri/hub-common\";\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getPortalEnv } from \"./get-portal-env\";\r\nimport { getStoryMapBaseUrl } from \"./get-storymap-base-url\";\r\nimport { getStoryMapSubdomain } from \"./get-storymap-subdomain\";\r\n\r\nexport function createStoryMapModelFromTemplate(\r\n templateModel: IModelTemplate,\r\n settings: any,\r\n transforms: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n const timestamp = new Date().getTime();\r\n // Keep these around in case we encounter some old templates\r\n settings.agoenv = getPortalEnv(authentication);\r\n settings.smBase = getStoryMapSubdomain(authentication);\r\n settings.timestamp = new Date().getTime();\r\n // These are used in the oembed resource, as well as the item url\r\n // they have `{{appid}}` in them so that the id of the created item\r\n // will be interpolated into it after the item is created\r\n settings.storyMapBaseUrl = getStoryMapBaseUrl(authentication);\r\n settings.storyMapTemplateUrl = `${settings.storyMapBaseUrl}/stories/{{appid}}`;\r\n settings.storyMapThumnailUrl = `${authentication.portal}/content/items/{{appid}}/info/thumbnail/thumbnail.jpg/?w=400&d=${timestamp}`;\r\n\r\n const model = interpolate(templateModel, settings, transforms);\r\n\r\n return Promise.resolve(model);\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n// TODO ENSURE THIS CREATES IN THE TARGET FOLDER\r\nimport {\r\n IModel,\r\n failSafe,\r\n serializeModel,\r\n interpolateItemId,\r\n stringToBlob\r\n} from \"@esri/hub-common\";\r\n\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nimport {\r\n createItem,\r\n moveItem,\r\n addItemResource,\r\n updateItem,\r\n ICreateItemOptions,\r\n ICreateItemResponse\r\n} from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Create a StoryMap from an interpolated template\r\n *\r\n * @param model\r\n * @param options\r\n * @param authentication\r\n */\r\nexport function createStoryMap(\r\n model: IModel,\r\n folderId: string,\r\n options: any,\r\n authentication: UserSession\r\n): Promise<IModel> {\r\n // create an array to hold well-known resources\r\n // that we have to generate from the passed in model\r\n const resources: any[] = [];\r\n\r\n // For unknown reasons we can not seem to spy on createItemInFolder\r\n // so we will create-then-move for now\r\n const createOptions: ICreateItemOptions = {\r\n // need to serialize\r\n item: serializeModel(model),\r\n authentication\r\n };\r\n\r\n /* istanbul ignore else */\r\n if (model.item.thumbnail) {\r\n createOptions.params = {\r\n // Pass thumbnail file in via params because item property is serialized, which discards a blob\r\n thumbnail: model.item.thumbnail\r\n };\r\n delete createOptions.item.thumbnail;\r\n }\r\n\r\n // Create the item\r\n return createItem(createOptions)\r\n .then((createResponse: ICreateItemResponse) => {\r\n // hold the id in the model\r\n model.item.id = createResponse.id;\r\n // and re-interpolate the item id\r\n model = interpolateItemId(model);\r\n // Compute the item url based on current environment\r\n\r\n // Storymaps store draft data in a timestamped resource attached to the item\r\n // We'll just use the published data for the first \"draft\"\r\n resources.push({\r\n name: model.properties.draftFileName,\r\n file: stringToBlob(JSON.stringify(model.data))\r\n });\r\n resources.push({\r\n name: \"oembed.json\",\r\n file: stringToBlob(JSON.stringify(model.properties.oembed))\r\n });\r\n resources.push({\r\n name: \"oembed.xml\",\r\n file: stringToBlob(model.properties.oembedXML)\r\n });\r\n // remove the properties hash now that we've gotten what we need\r\n delete model.properties;\r\n // update the item with the newly re-interpolated model\r\n return Promise.all([\r\n updateItem({\r\n item: serializeModel(model),\r\n authentication\r\n }),\r\n authentication.getUsername()\r\n ]);\r\n })\r\n .then((responses: any[]) => {\r\n const username = responses[1];\r\n // add the resources\r\n const failSafeAddItemResource = failSafe(addItemResource, {\r\n success: true\r\n });\r\n const resourcePromises = resources.map(resource => {\r\n return failSafeAddItemResource({\r\n id: model.item.id,\r\n owner: username,\r\n resource: resource.file,\r\n name: resource.name,\r\n authentication\r\n });\r\n });\r\n // Fire and forget as these are not critical-path\r\n return Promise.all(resourcePromises);\r\n })\r\n .then(() => {\r\n // Move it\r\n return moveItem({\r\n itemId: model.item.id,\r\n folderId,\r\n authentication\r\n });\r\n })\r\n .then(() => {\r\n return model;\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of Story Map item types.\r\n *\r\n * @module storymap\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse,\r\n EItemProgressStatus,\r\n UserSession,\r\n generateEmptyCreationResponse\r\n} from \"@esri/solution-common\";\r\nimport { IModel, failSafe } from \"@esri/hub-common\";\r\nimport { getItemData, removeItem } from \"@esri/arcgis-rest-portal\";\r\nimport { convertStoryMapToTemplate } from \"./helpers/convert-storymap-to-template\";\r\nimport { createStoryMapModelFromTemplate } from \"./helpers/create-storymap-model-from-template\";\r\nimport { createStoryMap } from \"./helpers/create-storymap\";\r\n\r\n/**\r\n * Convert a StoryMap to a template\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: UserSession,\r\n srcAuthentication: UserSession\r\n): Promise<IItemTemplate> {\r\n const model = {\r\n item: itemInfo,\r\n data: {}\r\n } as IModel;\r\n // fetch the data.json\r\n return getItemData(itemInfo.id, { authentication: srcAuthentication })\r\n .then(data => {\r\n // append into the model\r\n model.data = data;\r\n // and use that to create a template\r\n return convertStoryMapToTemplate(model);\r\n })\r\n .then(tmpl => {\r\n return tmpl;\r\n });\r\n}\r\n\r\n/**\r\n * Create a StoryMap from the passed in template\r\n *\r\n * @param template\r\n * @param templateDictionary\r\n * @param destinationAuthentication\r\n * @param itemProgressCallback\r\n */\r\nexport function createItemFromTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n // let the progress system know we've started...\r\n const startStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Started,\r\n 0\r\n );\r\n\r\n // and if it returned false, just resolve out\r\n if (!startStatus) {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n }\r\n\r\n // ensure we have a solution object in the templateDictionary hash\r\n if (!templateDictionary.solution) {\r\n templateDictionary.solution = {};\r\n }\r\n // .title should always be set on the templateDictionary\r\n templateDictionary.solution.title = templateDictionary.title;\r\n\r\n // TODO: Determine if we need any transforms in this new env\r\n const transforms = {};\r\n\r\n // create an object to hold the created site through\r\n // subsequent promise calls\r\n let model: IModel;\r\n\r\n // Create the \"siteModel\" from the template. Does not save the site item yet\r\n // Note: depending on licensing and user privs, will also create the team groups\r\n // and initiative item.\r\n return createStoryMapModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n transforms,\r\n destinationAuthentication\r\n )\r\n .then(interpolated => {\r\n const options = {\r\n assets: interpolated.assets || []\r\n };\r\n return createStoryMap(\r\n interpolated,\r\n templateDictionary.folderId,\r\n options,\r\n destinationAuthentication\r\n );\r\n })\r\n .then(createdModel => {\r\n model = createdModel;\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever receives\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: model.item.id\r\n };\r\n // call the progress callback, which also mutates templateDictionary\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n model.item.id\r\n );\r\n if (!finalStatus) {\r\n // clean up the site we just created\r\n const failSafeRemove = failSafe(removeItem, { success: true });\r\n return failSafeRemove({\r\n id: model.item.id,\r\n authentication: destinationAuthentication\r\n }).then(() => {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n });\r\n } else {\r\n // finally, return ICreateItemFromTemplateResponse\r\n const response: ICreateItemFromTemplateResponse = {\r\n item: {\r\n ...template,\r\n ...model\r\n },\r\n id: model.item.id,\r\n type: template.type,\r\n postProcess: false\r\n };\r\n response.item.itemId = model.item.id;\r\n return response;\r\n }\r\n })\r\n .catch(ex => {\r\n itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);\r\n throw ex;\r\n });\r\n}\r\n\r\nexport function isAStoryMap(itemType: string): boolean {\r\n let result = false;\r\n if (itemType === \"StoryMap\") {\r\n result = true;\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of Story Map item types.\r\n *\r\n * @module storymap\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>((resolve, reject) => {\r\n if (isAStoryMap(itemInfo.type, itemInfo.url)) {\r\n reject(common.fail(\"Classic StoryMap is not yet implemented\"));\r\n } else {\r\n reject(common.fail(itemInfo.id + \" is not a StoryMap\"));\r\n }\r\n });\r\n}\r\n\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n if (isAStoryMap(template.type, template.item.url)) {\r\n // Not yet implemented\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n } else {\r\n // Not valid\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n }\r\n });\r\n}\r\n\r\nexport function isAStoryMap(itemType: string, itemUrl?: string): boolean {\r\n if (itemUrl) {\r\n return [\r\n /\\/apps\\/Cascade\\//i,\r\n /\\/apps\\/MapJournal\\//i,\r\n /\\/apps\\/MapSeries\\//i,\r\n /\\/apps\\/MapTour\\//i,\r\n /\\/apps\\/Shortlist\\//i,\r\n /\\/apps\\/StoryMap\\//i,\r\n /\\/apps\\/StoryMapBasic\\//i,\r\n /\\/apps\\/StorytellingSwipe\\//i\r\n ].some(pattern => pattern.test(itemUrl));\r\n }\r\n return false;\r\n}\r\n"],"names":["getProp","createPlaceholderTemplate","propifyString","createId","cloneObject","normalizeSolutionTemplateItem","deepStringReplace","interpolate","serializeModel","createItem","interpolateItemId","stringToBlob","updateItem","failSafe","addItemResource","moveItem","convertItemToTemplate","getItemData","createItemFromTemplate","EItemProgressStatus","generateEmptyCreationResponse","removeItem","isAStoryMap","common"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;EAkBA;;;;;;;;WAQgB,eAAe,CAAC,YAAiB,EAAE;MACjD,IAAI,aAAa,G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BAAM,CAAC,mBAAmB,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;cACF,OAAO,CAACA,iBAAM,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;WAC9D;OACF,CAAC,CAAC;EACL,CAAC;WAEe,WAAW,CAAC,QAAgB,EAAE,OAAgB;MAC5D,IAAI,OAAO,EAAE;UACX,OAAO;cACL,oBAAoB;cACpB,uBAAuB;cACvB,sBAAsB;cACtB,oBAAoB;cACpB,sBAAsB;cACtB,qBAAqB;cACrB,0BAA0B;cAC1B,8BAA8B;WAC/B,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;OAC1C;MACD,OAAO,KAAK,CAAC;EACf;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-storymap - v1.
|
|
3
|
-
* Copyright (c) 2018-
|
|
4
|
-
*
|
|
2
|
+
* @esri/solution-storymap - v1.3.0 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
+
* Thu Feb 17 2022 09:43:01 GMT-0800 (Pacific Standard 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.
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common"),require("@esri/hub-common"),require("@esri/arcgis-rest-portal")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common","@esri/hub-common","@esri/arcgis-rest-portal"],t):t((e=e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution,e.arcgisHub,e.arcgisRest)}(this,(function(e,t,r,i){"use strict";function a(e){const i=t.createPlaceholderTemplate(e.item.id,e.item.type);i.key=`${r.propifyString(e.item.title)}_${r.createId("i")}`;const a=r.cloneObject(e);i.data=a.data,i.item=r.normalizeSolutionTemplateItem(a.item),i.item.url="{{storyMapTemplateUrl}}";(function(e={}){let t=0;return Object.keys(e).reduce(((i,a)=>("webmap"===r.getProp(e,`${a}.type`)&&a!==`webmap${t}`&&(i.push({original:a,updated:`webmap${t}`}),t++),i)),[])})(i.data.resources).forEach((e=>{i.data.resources[e.updated]=r.cloneObject(i.data.resources[e.original]),delete i.data.resources[e.original],i.data.nodes=r.deepStringReplace(i.data.nodes,e.original,e.updated)}));return-1!==i.item.typeKeywords.indexOf(
|
|
18
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common"),require("@esri/hub-common"),require("@esri/arcgis-rest-portal")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common","@esri/hub-common","@esri/arcgis-rest-portal"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution,e.arcgisHub,e.arcgisRest)}(this,(function(e,t,r,i){"use strict";function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=a(t);function s(e){const i=t.createPlaceholderTemplate(e.item.id,e.item.type);i.key=`${r.propifyString(e.item.title)}_${r.createId("i")}`;const a=r.cloneObject(e);i.data=a.data;const o=a.item.created,s=a.item.modified;i.item=r.normalizeSolutionTemplateItem(a.item),i.item.created=o,i.item.modified=s,i.item.url="{{storyMapTemplateUrl}}";(function(e={}){let t=0;return Object.keys(e).reduce(((i,a)=>("webmap"===r.getProp(e,`${a}.type`)&&a!==`webmap${t}`&&(i.push({original:a,updated:`webmap${t}`}),t++),i)),[])})(i.data.resources).forEach((e=>{i.data.resources[e.updated]=r.cloneObject(i.data.resources[e.original]),delete i.data.resources[e.original],i.data.nodes=r.deepStringReplace(i.data.nodes,e.original,e.updated)}));return-1!==i.item.typeKeywords.indexOf(n)&&(i.item.typeKeywords=[m].concat(i.item.typeKeywords.filter((e=>e!==n)))),i.properties={},i.properties.draftFileName="draft_{{timestamp}}.json",Object.assign(i.properties,l),i.dependencies=function(e){const t=r.getProp(e,"data.resources")||{};return Object.keys(t).reduce(((e,i)=>("webmap"===r.getProp(t,`${i}.type`)&&e.push(r.getProp(t,`${i}.data.itemId`)),e)),[])}(e),Promise.resolve(i)}const n="smstatusunpublishedchanges",m="smstatuspublished",l={oembed:{version:"1.0",type:"rich",title:"Example StoryMap",url:"{{storyMapTemplateUrl}}",provider_name:"ArcGIS StoryMaps",provider_url:"{{storyMapBaseUrl}}",width:800,height:600,thumbnail_url:"{{storyMapThumbnailUrl}}",thumbnail_height:"100.5",thumbnail_width:"400",html:'<iframe src="{{storyMapTemplateUrl}}" width="800" height="600" scrolling="yes" frameborder="0" allowfullscreen></iframe>',cache_age:86400},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>'};function p(e){const t=e.portal||"https://www.arcgis.com/sharing/rest";let r;return t.match(/(qaext|\.mapsqa)\.arcgis.com/)?r="storymapsqa":t.match(/(devext|\.mapsdevext)\.arcgis.com/)?r="storymapsdev":t.match(/(www|\.maps)\.arcgis.com/)&&(r="storymaps"),r}function c(e,t,i,a){const o=(new Date).getTime();t.agoenv=function(e){const t=e.portal||"https://www.arcgis.com/sharing/rest";let r="portal";return t.match(/(qaext|\.mapsqa)\.arcgis.com/)?r="qaext":t.match(/(devext|\.mapsdevext)\.arcgis.com/)?r="devext":t.match(/(www|\.maps)\.arcgis.com/)&&(r="www"),r}(a),t.smBase=p(a),t.timestamp=(new Date).getTime(),t.storyMapBaseUrl=function(e){let t="";const r=p(e);t=r?`https://${r}.arcgis.com`:`${e.portal.replace("/sharing/rest","")}/apps/storymaps`;return t}(a),t.storyMapTemplateUrl=`${t.storyMapBaseUrl}/stories/{{appid}}`,t.storyMapThumnailUrl=`${a.portal}/content/items/{{appid}}/info/thumbnail/thumbnail.jpg/?w=400&d=${o}`;const s=r.interpolate(e,t,i);return Promise.resolve(s)}var u=Object.freeze({__proto__:null,convertItemToTemplate:function(e,t,r,a){const o={item:t,data:{}};return i.getItemData(t.id,{authentication:a}).then((e=>(o.data=e,s(o)))).then((e=>e))},createItemFromTemplate:function(e,a,o,s){if(!s(e.itemId,t.EItemProgressStatus.Started,0))return Promise.resolve(t.generateEmptyCreationResponse(e.type));let n;return a.solution||(a.solution={}),a.solution.title=a.title,c(e,a,{},o).then((e=>{e.assets;return function(e,t,a,o){const s=[],n={item:r.serializeModel(e),authentication:o};return e.item.thumbnail&&(n.params={thumbnail:e.item.thumbnail},delete n.item.thumbnail),i.createItem(n).then((t=>(e.item.id=t.id,e=r.interpolateItemId(e),s.push({name:e.properties.draftFileName,file:r.stringToBlob(JSON.stringify(e.data))}),s.push({name:"oembed.json",file:r.stringToBlob(JSON.stringify(e.properties.oembed))}),s.push({name:"oembed.xml",file:r.stringToBlob(e.properties.oembedXML)}),delete e.properties,Promise.all([i.updateItem({item:r.serializeModel(e),authentication:o}),o.getUsername()])))).then((t=>{const a=t[1],n=r.failSafe(i.addItemResource,{success:!0}),m=s.map((t=>n({id:e.item.id,owner:a,resource:t.file,name:t.name,authentication:o})));return Promise.all(m)})).then((()=>i.moveItem({itemId:e.item.id,folderId:t,authentication:o}))).then((()=>e))}(e,a.folderId,0,o)})).then((m=>{n=m,a[e.itemId]={itemId:n.item.id};if(s(e.itemId,t.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor||2,n.item.id)){const t={item:{...e,...n},id:n.item.id,type:e.type,postProcess:!1};return t.item.itemId=n.item.id,t}return r.failSafe(i.removeItem,{success:!0})({id:n.item.id,authentication:o}).then((()=>Promise.resolve(t.generateEmptyCreationResponse(e.type))))})).catch((r=>{throw s(e.itemId,t.EItemProgressStatus.Failed,0),r}))},isAStoryMap:function(e){let t=!1;return"StoryMap"===e&&(t=!0),t}});function d(e,t){return!!t&&[/\/apps\/Cascade\//i,/\/apps\/MapJournal\//i,/\/apps\/MapSeries\//i,/\/apps\/MapTour\//i,/\/apps\/Shortlist\//i,/\/apps\/StoryMap\//i,/\/apps\/StoryMapBasic\//i,/\/apps\/StorytellingSwipe\//i].some((e=>e.test(t)))}var h=Object.freeze({__proto__:null,convertItemToTemplate:function(e,t){return new Promise(((e,r)=>{d(t.type,t.url)?r(o.fail("Classic StoryMap is not yet implemented")):r(o.fail(t.id+" is not a StoryMap"))}))},createItemFromTemplate:function(e,t,r,i){return new Promise((t=>{d(e.type,e.item.url),i(e.itemId,o.EItemProgressStatus.Failed,0),t(o.generateEmptyCreationResponse(e.type))}))},isAStoryMap:d});e.ClassicStoryMapProcessor=h,e.StoryMapProcessor=u,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
19
19
|
//# sourceMappingURL=storymap.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storymap.umd.min.js","sources":["../../src/helpers/convert-storymap-to-template.ts","../../src/helpers/remap-webmap-keys.ts","../../src/helpers/get-storymap-dependencies.ts","../../src/helpers/get-storymap-subdomain.ts","../../src/helpers/create-storymap-model-from-template.ts","../../src/helpers/get-portal-env.ts","../../src/helpers/get-storymap-base-url.ts","../../src/storymap-processor.ts","../../src/helpers/create-storymap.ts","../../src/classic-storymap-processor.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n IModel,\r\n cloneObject,\r\n propifyString,\r\n createId,\r\n normalizeSolutionTemplateItem,\r\n deepStringReplace\r\n} from \"@esri/hub-common\";\r\nimport { IItem } from \"@esri/arcgis-rest-portal\";\r\nimport {\r\n IItemTemplate,\r\n createPlaceholderTemplate\r\n} from \"@esri/solution-common\";\r\nimport { remapWebmapKeys } from \"./remap-webmap-keys\";\r\nimport { getStoryMapDependencies } from \"./get-storymap-dependencies\";\r\n\r\n/**\r\n * Convert a StoryMap IModel to an IItemTemplate\r\n *\r\n * @param model\r\n * @param authentication\r\n */\r\nexport function convertStoryMapToTemplate(\r\n model: IModel\r\n): Promise<IItemTemplate> {\r\n const tmpl = createPlaceholderTemplate(model.item.id, model.item.type);\r\n tmpl.key = `${propifyString(model.item.title)}_${createId(\"i\")}`;\r\n\r\n const clone = cloneObject(model);\r\n tmpl.data = clone.data;\r\n tmpl.item = normalizeSolutionTemplateItem(clone.item) as IItem;\r\n // templatize the url\r\n tmpl.item.url = \"{{storyMapTemplateUrl}}\";\r\n\r\n // Storymap Webmap Resources have complex keys that we need to remap\r\n const webmapRemaps = remapWebmapKeys(tmpl.data.resources);\r\n // and then replace in the rest of the structure\r\n webmapRemaps.forEach(remap => {\r\n tmpl.data.resources[remap.updated] = cloneObject(\r\n tmpl.data.resources[remap.original]\r\n );\r\n delete tmpl.data.resources[remap.original];\r\n tmpl.data.nodes = deepStringReplace(\r\n tmpl.data.nodes,\r\n remap.original,\r\n remap.updated\r\n );\r\n });\r\n\r\n // use typeKeyword to mark item as published\r\n // Note: Hub team decided to discard unpublished drafts when creating a template\r\n const typeKeywords = tmpl.item.typeKeywords;\r\n if (typeKeywords.indexOf(unPublishedChangesKW) !== -1) {\r\n tmpl.item.typeKeywords = [publishedChangesKW].concat(\r\n tmpl.item.typeKeywords.filter(\r\n (word: string) => word !== unPublishedChangesKW\r\n )\r\n );\r\n }\r\n\r\n tmpl.properties = {};\r\n tmpl.properties.draftFileName = \"draft_{{timestamp}}.json\";\r\n Object.assign(tmpl.properties, oEmbedTemplates);\r\n\r\n tmpl.dependencies = getStoryMapDependencies(model);\r\n\r\n return Promise.resolve(tmpl);\r\n // TODO: For now, we let the generic process handle item resources\r\n // However, many newer item types have complex type-specific resource handling\r\n // requirements so this code may be useful in the future\r\n // ------------------------------------------------------\r\n // return getItemResources(tmpl.itemId, hubRequestOptions)\r\n // .then((response) => {\r\n // tmpl.resources = response.resources.map(e => e.resource)\r\n // // Don't directly copy oembed resources because we need to template these\r\n // // Also, discard draft version of the storymap itself\r\n // .filter(filename => !filename.includes('oembed') && filename.search(/draft_[0-9]+.json/) === -1);\r\n // return tmpl;\r\n // });\r\n}\r\n\r\n// Internal constants\r\nconst unPublishedChangesKW = \"smstatusunpublishedchanges\";\r\nconst publishedChangesKW = \"smstatuspublished\";\r\n\r\n/**\r\n * Template for oEmbed\r\n */\r\nconst oEmbedTemplates = {\r\n oembed: {\r\n version: \"1.0\",\r\n type: \"rich\",\r\n title: \"Example StoryMap\",\r\n url: \"{{storyMapTemplateUrl}}\",\r\n provider_name: \"ArcGIS StoryMaps\",\r\n provider_url: \"{{storyMapBaseUrl}}\",\r\n width: 800,\r\n height: 600,\r\n thumbnail_url: \"{{storyMapThumbnailUrl}}\",\r\n thumbnail_height: \"100.5\",\r\n thumbnail_width: \"400\",\r\n html:\r\n '<iframe src=\"{{storyMapTemplateUrl}}\" width=\"800\" height=\"600\" scrolling=\"yes\" frameborder=\"0\" allowfullscreen></iframe>',\r\n cache_age: 86400\r\n },\r\n oembedXML:\r\n '<?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>'\r\n};\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { getProp } from \"@esri/hub-common\";\r\n\r\n/**\r\n * For some reason, the webmap resource key names are fancier than other resource keys\r\n * They look like this: r-<webmap-item-id>-<timestamp>\r\n * This interpolation is hard to accomplish given our current setup, so we're just overwriting\r\n * them with \"webmap0\", \"webmap1\" and so forth. This _seems_ to make no difference.\r\n *\r\n * @param model\r\n */\r\nexport function remapWebmapKeys(resources: any = {}): any[] {\r\n let webmapCounter = 0;\r\n return Object.keys(resources).reduce((acc, key) => {\r\n if (getProp(resources, `${key}.type`) === \"webmap\") {\r\n if (key !== `webmap${webmapCounter}`) {\r\n acc.push({\r\n original: key,\r\n updated: `webmap${webmapCounter}`\r\n });\r\n webmapCounter++;\r\n }\r\n }\r\n return acc;\r\n }, []);\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { IModel, getProp } from \"@esri/hub-common\";\r\n\r\n/**\r\n * Extract a list of Items this storymap depends on\r\n * At this point we are just extracting webmaps\r\n *\r\n * @param model IModel\r\n */\r\nexport function getStoryMapDependencies(model: IModel): any[] {\r\n const resources = getProp(model, \"data.resources\") || {};\r\n return Object.keys(resources).reduce((acc, key) => {\r\n if (getProp(resources, `${key}.type`) === \"webmap\") {\r\n acc.push(getProp(resources, `${key}.data.itemId`));\r\n }\r\n return acc;\r\n }, []);\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nexport function getStoryMapSubdomain(authentication: UserSession): string {\r\n const portalUrl =\r\n authentication.portal || \"https://www.arcgis.com/sharing/rest\";\r\n // TODO: Sort out how we locate storymaps on portal?\r\n let result;\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"storymapsqa\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"storymapsdev\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"storymaps\";\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Given a template, process it and interpolate it such that\r\n * we have a model that is ready to be sent to the Portal API\r\n */\r\n\r\nimport { interpolate, IModelTemplate } from \"@esri/hub-common\";\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getPortalEnv } from \"./get-portal-env\";\r\nimport { getStoryMapBaseUrl } from \"./get-storymap-base-url\";\r\nimport { getStoryMapSubdomain } from \"./get-storymap-subdomain\";\r\n\r\nexport function createStoryMapModelFromTemplate(\r\n templateModel: IModelTemplate,\r\n settings: any,\r\n transforms: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n const timestamp = new Date().getTime();\r\n // Keep these around in case we encounter some old templates\r\n settings.agoenv = getPortalEnv(authentication);\r\n settings.smBase = getStoryMapSubdomain(authentication);\r\n settings.timestamp = new Date().getTime();\r\n // These are used in the oembed resource, as well as the item url\r\n // they have `{{appid}}` in them so that the id of the created item\r\n // will be interpolated into it after the item is created\r\n settings.storyMapBaseUrl = getStoryMapBaseUrl(authentication);\r\n settings.storyMapTemplateUrl = `${settings.storyMapBaseUrl}/stories/{{appid}}`;\r\n settings.storyMapThumnailUrl = `${authentication.portal}/content/items/{{appid}}/info/thumbnail/thumbnail.jpg/?w=400&d=${timestamp}`;\r\n\r\n const model = interpolate(templateModel, settings, transforms);\r\n\r\n return Promise.resolve(model);\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nexport function getPortalEnv(authentication: UserSession): string {\r\n const portalUrl =\r\n authentication.portal || \"https://www.arcgis.com/sharing/rest\";\r\n let result = \"portal\";\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"qaext\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"devext\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"www\";\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getStoryMapSubdomain } from \"./get-storymap-subdomain\";\r\n/**\r\n * For a given environment Prod/qa/dev/portal\r\n * return the correct storymaps base url\r\n *\r\n * @param authentication\r\n */\r\nexport function getStoryMapBaseUrl(authentication: UserSession): string {\r\n let baseUrl = \"\";\r\n\r\n const subdomain = getStoryMapSubdomain(authentication);\r\n if (subdomain) {\r\n baseUrl = `https://${subdomain}.arcgis.com`;\r\n } else {\r\n // we're on portal\r\n // chop off the /sharing/rest to get the baseUrl\r\n const portalBaseUrl = authentication.portal.replace(\"/sharing/rest\", \"\");\r\n baseUrl = `${portalBaseUrl}/apps/storymaps`;\r\n }\r\n\r\n return baseUrl;\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of Story Map item types.\r\n *\r\n * @module storymap\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse,\r\n EItemProgressStatus,\r\n UserSession,\r\n generateEmptyCreationResponse\r\n} from \"@esri/solution-common\";\r\nimport { IModel, failSafe } from \"@esri/hub-common\";\r\nimport { getItemData, removeItem } from \"@esri/arcgis-rest-portal\";\r\nimport { convertStoryMapToTemplate } from \"./helpers/convert-storymap-to-template\";\r\nimport { createStoryMapModelFromTemplate } from \"./helpers/create-storymap-model-from-template\";\r\nimport { createStoryMap } from \"./helpers/create-storymap\";\r\n\r\n/**\r\n * Convert a StoryMap to a template\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo\r\n * @param authentication\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n authentication: UserSession\r\n): Promise<IItemTemplate> {\r\n const model = {\r\n item: itemInfo,\r\n data: {}\r\n } as IModel;\r\n // fetch the data.json\r\n return getItemData(itemInfo.id, { authentication })\r\n .then(data => {\r\n // append into the model\r\n model.data = data;\r\n // and use that to create a template\r\n return convertStoryMapToTemplate(model);\r\n })\r\n .then(tmpl => {\r\n return tmpl;\r\n });\r\n}\r\n\r\n/**\r\n * Create a StoryMap from the passed in template\r\n *\r\n * @param template\r\n * @param templateDictionary\r\n * @param destinationAuthentication\r\n * @param itemProgressCallback\r\n */\r\nexport function createItemFromTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n // let the progress system know we've started...\r\n const startStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Started,\r\n 0\r\n );\r\n\r\n // and if it returned false, just resolve out\r\n if (!startStatus) {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n }\r\n\r\n // ensure we have a solution object in the templateDictionary hash\r\n if (!templateDictionary.solution) {\r\n templateDictionary.solution = {};\r\n }\r\n // .title should always be set on the templateDictionary\r\n templateDictionary.solution.title = templateDictionary.title;\r\n\r\n // TODO: Determine if we need any transforms in this new env\r\n const transforms = {};\r\n\r\n // create an object to hold the created site through\r\n // subsequent promise calls\r\n let model: IModel;\r\n\r\n // Create the \"siteModel\" from the template. Does not save the site item yet\r\n // Note: depending on licensing and user privs, will also create the team groups\r\n // and initiative item.\r\n return createStoryMapModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n transforms,\r\n destinationAuthentication\r\n )\r\n .then(interpolated => {\r\n const options = {\r\n assets: interpolated.assets || []\r\n };\r\n return createStoryMap(\r\n interpolated,\r\n templateDictionary.folderId,\r\n options,\r\n destinationAuthentication\r\n );\r\n })\r\n .then(createdModel => {\r\n model = createdModel;\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever receives\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: model.item.id\r\n };\r\n // call the progress callback, which also mutates templateDictionary\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n model.item.id\r\n );\r\n if (!finalStatus) {\r\n // clean up the site we just created\r\n const failSafeRemove = failSafe(removeItem, { success: true });\r\n return failSafeRemove({\r\n id: model.item.id,\r\n authentication: destinationAuthentication\r\n }).then(() => {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n });\r\n } else {\r\n // finally, return ICreateItemFromTemplateResponse\r\n const response: ICreateItemFromTemplateResponse = {\r\n item: {\r\n ...template,\r\n ...model\r\n },\r\n id: model.item.id,\r\n type: template.type,\r\n postProcess: false\r\n };\r\n response.item.itemId = model.item.id;\r\n return response;\r\n }\r\n })\r\n .catch(ex => {\r\n itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);\r\n throw ex;\r\n });\r\n}\r\n\r\nexport function isAStoryMap(itemType: string): boolean {\r\n let result = false;\r\n if (itemType === \"StoryMap\") {\r\n result = true;\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n// TODO ENSURE THIS CREATES IN THE TARGET FOLDER\r\nimport {\r\n IModel,\r\n failSafe,\r\n serializeModel,\r\n interpolateItemId,\r\n stringToBlob\r\n} from \"@esri/hub-common\";\r\n\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nimport {\r\n createItem,\r\n moveItem,\r\n addItemResource,\r\n updateItem,\r\n ICreateItemOptions,\r\n ICreateItemResponse\r\n} from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Create a StoryMap from an interpolated template\r\n *\r\n * @param model\r\n * @param options\r\n * @param authentication\r\n */\r\nexport function createStoryMap(\r\n model: IModel,\r\n folderId: string,\r\n options: any,\r\n authentication: UserSession\r\n): Promise<IModel> {\r\n // create an array to hold well-known resources\r\n // that we have to generate from the passed in model\r\n const resources: any[] = [];\r\n\r\n // For unknown reasons we can not seem to spy on createItemInFolder\r\n // so we will create-then-move for now\r\n const createOptions: ICreateItemOptions = {\r\n // need to serialize\r\n item: serializeModel(model),\r\n authentication\r\n };\r\n\r\n /* istanbul ignore else */\r\n if (model.item.thumbnail) {\r\n createOptions.params = {\r\n // Pass thumbnail file in via params because item property is serialized, which discards a blob\r\n thumbnail: model.item.thumbnail\r\n };\r\n delete createOptions.item.thumbnail;\r\n }\r\n\r\n // Create the item\r\n return createItem(createOptions)\r\n .then((createResponse: ICreateItemResponse) => {\r\n // hold the id in the model\r\n model.item.id = createResponse.id;\r\n // and re-interpolate the item id\r\n model = interpolateItemId(model);\r\n // Compute the item url based on current environment\r\n\r\n // Storymaps store draft data in a timestamped resource attached to the item\r\n // We'll just use the published data for the first \"draft\"\r\n resources.push({\r\n name: model.properties.draftFileName,\r\n file: stringToBlob(JSON.stringify(model.data))\r\n });\r\n resources.push({\r\n name: \"oembed.json\",\r\n file: stringToBlob(JSON.stringify(model.properties.oembed))\r\n });\r\n resources.push({\r\n name: \"oembed.xml\",\r\n file: stringToBlob(model.properties.oembedXML)\r\n });\r\n // remove the properties hash now that we've gotten what we need\r\n delete model.properties;\r\n // update the item with the newly re-interpolated model\r\n return Promise.all([\r\n updateItem({\r\n item: serializeModel(model),\r\n authentication\r\n }),\r\n authentication.getUsername()\r\n ]);\r\n })\r\n .then((responses: any[]) => {\r\n const username = responses[1];\r\n // add the resources\r\n const failSafeAddItemResource = failSafe(addItemResource, {\r\n success: true\r\n });\r\n const resourcePromises = resources.map(resource => {\r\n return failSafeAddItemResource({\r\n id: model.item.id,\r\n owner: username,\r\n resource: resource.file,\r\n name: resource.name,\r\n authentication\r\n });\r\n });\r\n // Fire and forget as these are not critical-path\r\n return Promise.all(resourcePromises);\r\n })\r\n .then(() => {\r\n // Move it\r\n return moveItem({\r\n itemId: model.item.id,\r\n folderId,\r\n authentication\r\n });\r\n })\r\n .then(() => {\r\n return model;\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of Story Map item types.\r\n *\r\n * @module storymap\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>((resolve, reject) => {\r\n if (isAStoryMap(itemInfo.type, itemInfo.url)) {\r\n reject(common.fail(\"Classic StoryMap is not yet implemented\"));\r\n } else {\r\n reject(common.fail(itemInfo.id + \" is not a StoryMap\"));\r\n }\r\n });\r\n}\r\n\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n if (isAStoryMap(template.type, template.item.url)) {\r\n // Not yet implemented\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n } else {\r\n // Not valid\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n }\r\n });\r\n}\r\n\r\nexport function isAStoryMap(itemType: string, itemUrl?: string): boolean {\r\n if (itemUrl) {\r\n return [\r\n /\\/apps\\/Cascade\\//i,\r\n /\\/apps\\/MapJournal\\//i,\r\n /\\/apps\\/MapSeries\\//i,\r\n /\\/apps\\/MapTour\\//i,\r\n /\\/apps\\/Shortlist\\//i,\r\n /\\/apps\\/StoryMap\\//i,\r\n /\\/apps\\/StoryMapBasic\\//i,\r\n /\\/apps\\/StorytellingSwipe\\//i\r\n ].some(pattern => pattern.test(itemUrl));\r\n }\r\n return false;\r\n}\r\n"],"names":["convertStoryMapToTemplate","model","tmpl","createPlaceholderTemplate","item","id","type","key","propifyString","title","createId","clone","cloneObject","data","normalizeSolutionTemplateItem","url","resources","webmapCounter","Object","keys","reduce","acc","getProp","push","original","updated","remapWebmapKeys","forEach","remap","nodes","deepStringReplace","typeKeywords","indexOf","unPublishedChangesKW","publishedChangesKW","concat","filter","word","properties","draftFileName","assign","oEmbedTemplates","dependencies","getStoryMapDependencies","Promise","resolve","oembed","version","provider_name","provider_url","width","height","thumbnail_url","thumbnail_height","thumbnail_width","html","cache_age","oembedXML","getStoryMapSubdomain","authentication","portalUrl","portal","result","match","createStoryMapModelFromTemplate","templateModel","settings","transforms","timestamp","Date","getTime","agoenv","getPortalEnv","smBase","storyMapBaseUrl","baseUrl","subdomain","replace","getStoryMapBaseUrl","storyMapTemplateUrl","storyMapThumnailUrl","interpolate","solutionItemId","itemInfo","getItemData","then","template","templateDictionary","destinationAuthentication","itemProgressCallback","itemId","EItemProgressStatus","Started","generateEmptyCreationResponse","solution","interpolated","assets","folderId","options","createOptions","serializeModel","thumbnail","params","createItem","createResponse","interpolateItemId","name","file","stringToBlob","JSON","stringify","all","updateItem","getUsername","responses","username","failSafeAddItemResource","failSafe","addItemResource","success","resourcePromises","map","resource","owner","moveItem","createStoryMap","createdModel","Finished","estimatedDeploymentCostFactor","response","postProcess","removeItem","failSafeRemove","catch","ex","Failed","itemType","isAStoryMap","itemUrl","some","pattern","test","reject","common.fail","common.EItemProgressStatus","common.generateEmptyCreationResponse"],"mappings":";;;;;;;;;;;;;;;;;8bAsCgBA,EACdC,GAEA,MAAMC,EAAOC,4BAA0BF,EAAMG,KAAKC,GAAIJ,EAAMG,KAAKE,MACjEJ,EAAKK,IAAM,GAAGC,gBAAcP,EAAMG,KAAKK,UAAUC,WAAS,OAE1D,MAAMC,EAAQC,cAAYX,GAC1BC,EAAKW,KAAOF,EAAME,KAClBX,EAAKE,KAAOU,gCAA8BH,EAAMP,MAEhDF,EAAKE,KAAKW,IAAM,oCCtBcC,EAAiB,IAC/C,IAAIC,EAAgB,EACpB,OAAOC,OAAOC,KAAKH,GAAWI,QAAO,CAACC,EAAKd,KACC,WAAtCe,UAAQN,EAAW,GAAGT,WACpBA,IAAQ,SAASU,MACnBI,EAAIE,KAAK,CACPC,SAAUjB,EACVkB,QAAS,SAASR,MAEpBA,KAGGI,IACN,KDYkBK,CAAgBxB,EAAKW,KAAKG,WAElCW,SAAQC,IACnB1B,EAAKW,KAAKG,UAAUY,EAAMH,SAAWb,cACnCV,EAAKW,KAAKG,UAAUY,EAAMJ,kBAErBtB,EAAKW,KAAKG,UAAUY,EAAMJ,UACjCtB,EAAKW,KAAKgB,MAAQC,oBAChB5B,EAAKW,KAAKgB,MACVD,EAAMJ,SACNI,EAAMH,YAqBV,OAdoD,IAD/BvB,EAAKE,KAAK2B,aACdC,QAAQC,KACvB/B,EAAKE,KAAK2B,aAAe,CAACG,GAAoBC,OAC5CjC,EAAKE,KAAK2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I,OAAQC,sBAAoB4C,OAAQ,GAC5DD,2BAIgBE,GAC1B,IAAI1E,GAAS,EAIb,MAHiB,aAAb0E,IACF1E,GAAS,GAEJA,cE7GO2E,EAAYD,EAAkBE,GAC5C,QAAIA,GACK,CACL,qBACA,wBACA,uBACA,qBACA,uBACA,sBACA,2BACA,gCACAC,MAAKC,GAAWA,EAAQC,KAAKH,wEAlDjCxD,EACAC,GAEA,OAAO,IAAIvC,SAA8B,CAACC,EAASiG,KAC7CL,EAAYtD,EAAS7E,KAAM6E,EAASpE,KACtC+H,EAAOC,OAAY,4CAEnBD,EAAOC,OAAY5D,EAAS9E,GAAK,2DAMrCiF,EACAC,EACAC,EACAC,GAEA,OAAO,IAAI7C,SAAgDC,IACrD4F,EAAYnD,EAAShF,KAAMgF,EAASlF,KAAKW,KAE3C0E,EACEH,EAASI,OACTsD,sBAA2BT,OAC3B,GAEF1F,EAAQoG,gCAAqC3D,EAAShF"}
|
|
1
|
+
{"version":3,"file":"storymap.umd.min.js","sources":["../../src/helpers/convert-storymap-to-template.ts","../../src/helpers/remap-webmap-keys.ts","../../src/helpers/get-storymap-dependencies.ts","../../src/helpers/get-storymap-subdomain.ts","../../src/helpers/create-storymap-model-from-template.ts","../../src/helpers/get-portal-env.ts","../../src/helpers/get-storymap-base-url.ts","../../src/storymap-processor.ts","../../src/helpers/create-storymap.ts","../../src/classic-storymap-processor.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n IModel,\r\n cloneObject,\r\n propifyString,\r\n createId,\r\n normalizeSolutionTemplateItem,\r\n deepStringReplace\r\n} from \"@esri/hub-common\";\r\nimport { IItem } from \"@esri/arcgis-rest-portal\";\r\nimport {\r\n IItemTemplate,\r\n createPlaceholderTemplate\r\n} from \"@esri/solution-common\";\r\nimport { remapWebmapKeys } from \"./remap-webmap-keys\";\r\nimport { getStoryMapDependencies } from \"./get-storymap-dependencies\";\r\n\r\n/**\r\n * Convert a StoryMap IModel to an IItemTemplate\r\n *\r\n * @param model\r\n * @param authentication\r\n */\r\nexport function convertStoryMapToTemplate(\r\n model: IModel\r\n): Promise<IItemTemplate> {\r\n const tmpl = createPlaceholderTemplate(model.item.id, model.item.type);\r\n tmpl.key = `${propifyString(model.item.title)}_${createId(\"i\")}`;\r\n\r\n const clone = cloneObject(model);\r\n tmpl.data = clone.data;\r\n\r\n // We need to save these properties in order to restore them after hub.js deletes them\r\n const created = clone.item.created;\r\n const modified = clone.item.modified;\r\n tmpl.item = normalizeSolutionTemplateItem(clone.item) as IItem;\r\n tmpl.item.created = created;\r\n tmpl.item.modified = modified;\r\n\r\n // templatize the url\r\n tmpl.item.url = \"{{storyMapTemplateUrl}}\";\r\n\r\n // Storymap Webmap Resources have complex keys that we need to remap\r\n const webmapRemaps = remapWebmapKeys(tmpl.data.resources);\r\n // and then replace in the rest of the structure\r\n webmapRemaps.forEach(remap => {\r\n tmpl.data.resources[remap.updated] = cloneObject(\r\n tmpl.data.resources[remap.original]\r\n );\r\n delete tmpl.data.resources[remap.original];\r\n tmpl.data.nodes = deepStringReplace(\r\n tmpl.data.nodes,\r\n remap.original,\r\n remap.updated\r\n );\r\n });\r\n\r\n // use typeKeyword to mark item as published\r\n // Note: Hub team decided to discard unpublished drafts when creating a template\r\n const typeKeywords = tmpl.item.typeKeywords;\r\n if (typeKeywords.indexOf(unPublishedChangesKW) !== -1) {\r\n tmpl.item.typeKeywords = [publishedChangesKW].concat(\r\n tmpl.item.typeKeywords.filter(\r\n (word: string) => word !== unPublishedChangesKW\r\n )\r\n );\r\n }\r\n\r\n tmpl.properties = {};\r\n tmpl.properties.draftFileName = \"draft_{{timestamp}}.json\";\r\n Object.assign(tmpl.properties, oEmbedTemplates);\r\n\r\n tmpl.dependencies = getStoryMapDependencies(model);\r\n\r\n return Promise.resolve(tmpl);\r\n // TODO: For now, we let the generic process handle item resources\r\n // However, many newer item types have complex type-specific resource handling\r\n // requirements so this code may be useful in the future\r\n // ------------------------------------------------------\r\n // return getItemResources(tmpl.itemId, hubRequestOptions)\r\n // .then((response) => {\r\n // tmpl.resources = response.resources.map(e => e.resource)\r\n // // Don't directly copy oembed resources because we need to template these\r\n // // Also, discard draft version of the storymap itself\r\n // .filter(filename => !filename.includes('oembed') && filename.search(/draft_[0-9]+.json/) === -1);\r\n // return tmpl;\r\n // });\r\n}\r\n\r\n// Internal constants\r\nconst unPublishedChangesKW = \"smstatusunpublishedchanges\";\r\nconst publishedChangesKW = \"smstatuspublished\";\r\n\r\n/**\r\n * Template for oEmbed\r\n */\r\nconst oEmbedTemplates = {\r\n oembed: {\r\n version: \"1.0\",\r\n type: \"rich\",\r\n title: \"Example StoryMap\",\r\n url: \"{{storyMapTemplateUrl}}\",\r\n provider_name: \"ArcGIS StoryMaps\",\r\n provider_url: \"{{storyMapBaseUrl}}\",\r\n width: 800,\r\n height: 600,\r\n thumbnail_url: \"{{storyMapThumbnailUrl}}\",\r\n thumbnail_height: \"100.5\",\r\n thumbnail_width: \"400\",\r\n html:\r\n '<iframe src=\"{{storyMapTemplateUrl}}\" width=\"800\" height=\"600\" scrolling=\"yes\" frameborder=\"0\" allowfullscreen></iframe>',\r\n cache_age: 86400\r\n },\r\n oembedXML:\r\n '<?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>'\r\n};\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { getProp } from \"@esri/hub-common\";\r\n\r\n/**\r\n * For some reason, the webmap resource key names are fancier than other resource keys\r\n * They look like this: r-<webmap-item-id>-<timestamp>\r\n * This interpolation is hard to accomplish given our current setup, so we're just overwriting\r\n * them with \"webmap0\", \"webmap1\" and so forth. This _seems_ to make no difference.\r\n *\r\n * @param model\r\n */\r\nexport function remapWebmapKeys(resources: any = {}): any[] {\r\n let webmapCounter = 0;\r\n return Object.keys(resources).reduce((acc, key) => {\r\n if (getProp(resources, `${key}.type`) === \"webmap\") {\r\n if (key !== `webmap${webmapCounter}`) {\r\n acc.push({\r\n original: key,\r\n updated: `webmap${webmapCounter}`\r\n });\r\n webmapCounter++;\r\n }\r\n }\r\n return acc;\r\n }, []);\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { IModel, getProp } from \"@esri/hub-common\";\r\n\r\n/**\r\n * Extract a list of Items this storymap depends on\r\n * At this point we are just extracting webmaps\r\n *\r\n * @param model IModel\r\n */\r\nexport function getStoryMapDependencies(model: IModel): any[] {\r\n const resources = getProp(model, \"data.resources\") || {};\r\n return Object.keys(resources).reduce((acc, key) => {\r\n if (getProp(resources, `${key}.type`) === \"webmap\") {\r\n acc.push(getProp(resources, `${key}.data.itemId`));\r\n }\r\n return acc;\r\n }, []);\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nexport function getStoryMapSubdomain(authentication: UserSession): string {\r\n const portalUrl =\r\n authentication.portal || \"https://www.arcgis.com/sharing/rest\";\r\n // TODO: Sort out how we locate storymaps on portal?\r\n let result;\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"storymapsqa\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"storymapsdev\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"storymaps\";\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n/**\r\n * Given a template, process it and interpolate it such that\r\n * we have a model that is ready to be sent to the Portal API\r\n */\r\n\r\nimport { interpolate, IModelTemplate } from \"@esri/hub-common\";\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getPortalEnv } from \"./get-portal-env\";\r\nimport { getStoryMapBaseUrl } from \"./get-storymap-base-url\";\r\nimport { getStoryMapSubdomain } from \"./get-storymap-subdomain\";\r\n\r\nexport function createStoryMapModelFromTemplate(\r\n templateModel: IModelTemplate,\r\n settings: any,\r\n transforms: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n const timestamp = new Date().getTime();\r\n // Keep these around in case we encounter some old templates\r\n settings.agoenv = getPortalEnv(authentication);\r\n settings.smBase = getStoryMapSubdomain(authentication);\r\n settings.timestamp = new Date().getTime();\r\n // These are used in the oembed resource, as well as the item url\r\n // they have `{{appid}}` in them so that the id of the created item\r\n // will be interpolated into it after the item is created\r\n settings.storyMapBaseUrl = getStoryMapBaseUrl(authentication);\r\n settings.storyMapTemplateUrl = `${settings.storyMapBaseUrl}/stories/{{appid}}`;\r\n settings.storyMapThumnailUrl = `${authentication.portal}/content/items/{{appid}}/info/thumbnail/thumbnail.jpg/?w=400&d=${timestamp}`;\r\n\r\n const model = interpolate(templateModel, settings, transforms);\r\n\r\n return Promise.resolve(model);\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nexport function getPortalEnv(authentication: UserSession): string {\r\n const portalUrl =\r\n authentication.portal || \"https://www.arcgis.com/sharing/rest\";\r\n let result = \"portal\";\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"qaext\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"devext\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"www\";\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getStoryMapSubdomain } from \"./get-storymap-subdomain\";\r\n/**\r\n * For a given environment Prod/qa/dev/portal\r\n * return the correct storymaps base url\r\n *\r\n * @param authentication\r\n */\r\nexport function getStoryMapBaseUrl(authentication: UserSession): string {\r\n let baseUrl = \"\";\r\n\r\n const subdomain = getStoryMapSubdomain(authentication);\r\n if (subdomain) {\r\n baseUrl = `https://${subdomain}.arcgis.com`;\r\n } else {\r\n // we're on portal\r\n // chop off the /sharing/rest to get the baseUrl\r\n const portalBaseUrl = authentication.portal.replace(\"/sharing/rest\", \"\");\r\n baseUrl = `${portalBaseUrl}/apps/storymaps`;\r\n }\r\n\r\n return baseUrl;\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of Story Map item types.\r\n *\r\n * @module storymap\r\n */\r\n\r\nimport {\r\n IItemTemplate,\r\n IItemProgressCallback,\r\n ICreateItemFromTemplateResponse,\r\n EItemProgressStatus,\r\n UserSession,\r\n generateEmptyCreationResponse\r\n} from \"@esri/solution-common\";\r\nimport { IModel, failSafe } from \"@esri/hub-common\";\r\nimport { getItemData, removeItem } from \"@esri/arcgis-rest-portal\";\r\nimport { convertStoryMapToTemplate } from \"./helpers/convert-storymap-to-template\";\r\nimport { createStoryMapModelFromTemplate } from \"./helpers/create-storymap-model-from-template\";\r\nimport { createStoryMap } from \"./helpers/create-storymap\";\r\n\r\n/**\r\n * Convert a StoryMap to a template\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: UserSession,\r\n srcAuthentication: UserSession\r\n): Promise<IItemTemplate> {\r\n const model = {\r\n item: itemInfo,\r\n data: {}\r\n } as IModel;\r\n // fetch the data.json\r\n return getItemData(itemInfo.id, { authentication: srcAuthentication })\r\n .then(data => {\r\n // append into the model\r\n model.data = data;\r\n // and use that to create a template\r\n return convertStoryMapToTemplate(model);\r\n })\r\n .then(tmpl => {\r\n return tmpl;\r\n });\r\n}\r\n\r\n/**\r\n * Create a StoryMap from the passed in template\r\n *\r\n * @param template\r\n * @param templateDictionary\r\n * @param destinationAuthentication\r\n * @param itemProgressCallback\r\n */\r\nexport function createItemFromTemplate(\r\n template: IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: UserSession,\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ICreateItemFromTemplateResponse> {\r\n // let the progress system know we've started...\r\n const startStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Started,\r\n 0\r\n );\r\n\r\n // and if it returned false, just resolve out\r\n if (!startStatus) {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n }\r\n\r\n // ensure we have a solution object in the templateDictionary hash\r\n if (!templateDictionary.solution) {\r\n templateDictionary.solution = {};\r\n }\r\n // .title should always be set on the templateDictionary\r\n templateDictionary.solution.title = templateDictionary.title;\r\n\r\n // TODO: Determine if we need any transforms in this new env\r\n const transforms = {};\r\n\r\n // create an object to hold the created site through\r\n // subsequent promise calls\r\n let model: IModel;\r\n\r\n // Create the \"siteModel\" from the template. Does not save the site item yet\r\n // Note: depending on licensing and user privs, will also create the team groups\r\n // and initiative item.\r\n return createStoryMapModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n transforms,\r\n destinationAuthentication\r\n )\r\n .then(interpolated => {\r\n const options = {\r\n assets: interpolated.assets || []\r\n };\r\n return createStoryMap(\r\n interpolated,\r\n templateDictionary.folderId,\r\n options,\r\n destinationAuthentication\r\n );\r\n })\r\n .then(createdModel => {\r\n model = createdModel;\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever receives\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: model.item.id\r\n };\r\n // call the progress callback, which also mutates templateDictionary\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n model.item.id\r\n );\r\n if (!finalStatus) {\r\n // clean up the site we just created\r\n const failSafeRemove = failSafe(removeItem, { success: true });\r\n return failSafeRemove({\r\n id: model.item.id,\r\n authentication: destinationAuthentication\r\n }).then(() => {\r\n return Promise.resolve(generateEmptyCreationResponse(template.type));\r\n });\r\n } else {\r\n // finally, return ICreateItemFromTemplateResponse\r\n const response: ICreateItemFromTemplateResponse = {\r\n item: {\r\n ...template,\r\n ...model\r\n },\r\n id: model.item.id,\r\n type: template.type,\r\n postProcess: false\r\n };\r\n response.item.itemId = model.item.id;\r\n return response;\r\n }\r\n })\r\n .catch(ex => {\r\n itemProgressCallback(template.itemId, EItemProgressStatus.Failed, 0);\r\n throw ex;\r\n });\r\n}\r\n\r\nexport function isAStoryMap(itemType: string): boolean {\r\n let result = false;\r\n if (itemType === \"StoryMap\") {\r\n result = true;\r\n }\r\n return result;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n// TODO ENSURE THIS CREATES IN THE TARGET FOLDER\r\nimport {\r\n IModel,\r\n failSafe,\r\n serializeModel,\r\n interpolateItemId,\r\n stringToBlob\r\n} from \"@esri/hub-common\";\r\n\r\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\nimport {\r\n createItem,\r\n moveItem,\r\n addItemResource,\r\n updateItem,\r\n ICreateItemOptions,\r\n ICreateItemResponse\r\n} from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Create a StoryMap from an interpolated template\r\n *\r\n * @param model\r\n * @param options\r\n * @param authentication\r\n */\r\nexport function createStoryMap(\r\n model: IModel,\r\n folderId: string,\r\n options: any,\r\n authentication: UserSession\r\n): Promise<IModel> {\r\n // create an array to hold well-known resources\r\n // that we have to generate from the passed in model\r\n const resources: any[] = [];\r\n\r\n // For unknown reasons we can not seem to spy on createItemInFolder\r\n // so we will create-then-move for now\r\n const createOptions: ICreateItemOptions = {\r\n // need to serialize\r\n item: serializeModel(model),\r\n authentication\r\n };\r\n\r\n /* istanbul ignore else */\r\n if (model.item.thumbnail) {\r\n createOptions.params = {\r\n // Pass thumbnail file in via params because item property is serialized, which discards a blob\r\n thumbnail: model.item.thumbnail\r\n };\r\n delete createOptions.item.thumbnail;\r\n }\r\n\r\n // Create the item\r\n return createItem(createOptions)\r\n .then((createResponse: ICreateItemResponse) => {\r\n // hold the id in the model\r\n model.item.id = createResponse.id;\r\n // and re-interpolate the item id\r\n model = interpolateItemId(model);\r\n // Compute the item url based on current environment\r\n\r\n // Storymaps store draft data in a timestamped resource attached to the item\r\n // We'll just use the published data for the first \"draft\"\r\n resources.push({\r\n name: model.properties.draftFileName,\r\n file: stringToBlob(JSON.stringify(model.data))\r\n });\r\n resources.push({\r\n name: \"oembed.json\",\r\n file: stringToBlob(JSON.stringify(model.properties.oembed))\r\n });\r\n resources.push({\r\n name: \"oembed.xml\",\r\n file: stringToBlob(model.properties.oembedXML)\r\n });\r\n // remove the properties hash now that we've gotten what we need\r\n delete model.properties;\r\n // update the item with the newly re-interpolated model\r\n return Promise.all([\r\n updateItem({\r\n item: serializeModel(model),\r\n authentication\r\n }),\r\n authentication.getUsername()\r\n ]);\r\n })\r\n .then((responses: any[]) => {\r\n const username = responses[1];\r\n // add the resources\r\n const failSafeAddItemResource = failSafe(addItemResource, {\r\n success: true\r\n });\r\n const resourcePromises = resources.map(resource => {\r\n return failSafeAddItemResource({\r\n id: model.item.id,\r\n owner: username,\r\n resource: resource.file,\r\n name: resource.name,\r\n authentication\r\n });\r\n });\r\n // Fire and forget as these are not critical-path\r\n return Promise.all(resourcePromises);\r\n })\r\n .then(() => {\r\n // Move it\r\n return moveItem({\r\n itemId: model.item.id,\r\n folderId,\r\n authentication\r\n });\r\n })\r\n .then(() => {\r\n return model;\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of Story Map item types.\r\n *\r\n * @module storymap\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>((resolve, reject) => {\r\n if (isAStoryMap(itemInfo.type, itemInfo.url)) {\r\n reject(common.fail(\"Classic StoryMap is not yet implemented\"));\r\n } else {\r\n reject(common.fail(itemInfo.id + \" is not a StoryMap\"));\r\n }\r\n });\r\n}\r\n\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n if (isAStoryMap(template.type, template.item.url)) {\r\n // Not yet implemented\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n } else {\r\n // Not valid\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n }\r\n });\r\n}\r\n\r\nexport function isAStoryMap(itemType: string, itemUrl?: string): boolean {\r\n if (itemUrl) {\r\n return [\r\n /\\/apps\\/Cascade\\//i,\r\n /\\/apps\\/MapJournal\\//i,\r\n /\\/apps\\/MapSeries\\//i,\r\n /\\/apps\\/MapTour\\//i,\r\n /\\/apps\\/Shortlist\\//i,\r\n /\\/apps\\/StoryMap\\//i,\r\n /\\/apps\\/StoryMapBasic\\//i,\r\n /\\/apps\\/StorytellingSwipe\\//i\r\n ].some(pattern => pattern.test(itemUrl));\r\n }\r\n return false;\r\n}\r\n"],"names":["convertStoryMapToTemplate","model","tmpl","createPlaceholderTemplate","item","id","type","key","propifyString","title","createId","clone","cloneObject","data","created","modified","normalizeSolutionTemplateItem","url","resources","webmapCounter","Object","keys","reduce","acc","getProp","push","original","updated","remapWebmapKeys","forEach","remap","nodes","deepStringReplace","typeKeywords","indexOf","unPublishedChangesKW","publishedChangesKW","concat","filter","word","properties","draftFileName","assign","oEmbedTemplates","dependencies","getStoryMapDependencies","Promise","resolve","oembed","version","provider_name","provider_url","width","height","thumbnail_url","thumbnail_height","thumbnail_width","html","cache_age","oembedXML","getStoryMapSubdomain","authentication","portalUrl","portal","result","match","createStoryMapModelFromTemplate","templateModel","settings","transforms","timestamp","Date","getTime","agoenv","getPortalEnv","smBase","storyMapBaseUrl","baseUrl","subdomain","replace","getStoryMapBaseUrl","storyMapTemplateUrl","storyMapThumnailUrl","interpolate","solutionItemId","itemInfo","destAuthentication","srcAuthentication","getItemData","then","template","templateDictionary","destinationAuthentication","itemProgressCallback","itemId","EItemProgressStatus","Started","generateEmptyCreationResponse","solution","interpolated","assets","folderId","options","createOptions","serializeModel","thumbnail","params","createItem","createResponse","interpolateItemId","name","file","stringToBlob","JSON","stringify","all","updateItem","getUsername","responses","username","failSafeAddItemResource","failSafe","addItemResource","success","resourcePromises","map","resource","owner","moveItem","createStoryMap","createdModel","Finished","estimatedDeploymentCostFactor","response","postProcess","removeItem","failSafeRemove","catch","ex","Failed","itemType","isAStoryMap","itemUrl","some","pattern","test","reject","common","fail"],"mappings":";;;;;;;;;;;;;;;;;kxBAsCgBA,EACdC,GAEA,MAAMC,EAAOC,4BAA0BF,EAAMG,KAAKC,GAAIJ,EAAMG,KAAKE,MACjEJ,EAAKK,IAAM,GAAGC,gBAAcP,EAAMG,KAAKK,UAAUC,WAAS,OAE1D,MAAMC,EAAQC,cAAYX,GAC1BC,EAAKW,KAAOF,EAAME,KAGlB,MAAMC,EAAUH,EAAMP,KAAKU,QACrBC,EAAWJ,EAAMP,KAAKW,SAC5Bb,EAAKE,KAAOY,gCAA8BL,EAAMP,MAChDF,EAAKE,KAAKU,QAAUA,EACpBZ,EAAKE,KAAKW,SAAWA,EAGrBb,EAAKE,KAAKa,IAAM,oCC7BcC,EAAiB,IAC/C,IAAIC,EAAgB,EACpB,OAAOC,OAAOC,KAAKH,GAAWI,QAAO,CAACC,EAAKhB,KACC,WAAtCiB,UAAQN,EAAW,GAAGX,WACpBA,IAAQ,SAASY,MACnBI,EAAIE,KAAK,CACPC,SAAUnB,EACVoB,QAAS,SAASR,MAEpBA,KAGGI,IACN,KDmBkBK,CAAgB1B,EAAKW,KAAKK,WAElCW,SAAQC,IACnB5B,EAAKW,KAAKK,UAAUY,EAAMH,SAAWf,cACnCV,EAAKW,KAAKK,UAAUY,EAAMJ,kBAErBxB,EAAKW,KAAKK,UAAUY,EAAMJ,UACjCxB,EAAKW,KAAKkB,MAAQC,oBAChB9B,EAAKW,KAAKkB,MACVD,EAAMJ,SACNI,EAAMH,YAqBV,OAdoD,IAD/BzB,EAAKE,KAAK6B,aACdC,QAAQC,KACvBjC,EAAKE,KAAK6B,aAAe,CAACG,GAAoBC,OAC5CnC,EAAKE,KAAK6B,aAAaK,QACpBC,GAAiBA,IAASJ,MAKjCjC,EAAKsC,WAAa,GAClBtC,EAAKsC,WAAWC,cAAgB,2BAChCrB,OAAOsB,OAAOx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AS,GAEJA,cE/GO6E,EAAYD,EAAkBE,GAC5C,QAAIA,GACK,CACL,qBACA,wBACA,uBACA,qBACA,uBACA,sBACA,2BACA,gCACAC,MAAKC,GAAWA,EAAQC,KAAKH,wEAlDjC1D,EACAC,GAEA,OAAO,IAAIvC,SAA8B,CAACC,EAASmG,KAC7CL,EAAYxD,EAAS/E,KAAM+E,EAASpE,KACtCiI,EAAOC,EAAOC,KAAK,4CAEnBF,EAAOC,EAAOC,KAAK/D,EAAShF,GAAK,2DAMrCqF,EACAC,EACAC,EACAC,GAEA,OAAO,IAAI/C,SAAgDC,IACrD8F,EAAYnD,EAASpF,KAAMoF,EAAStF,KAAKa,KAE3C4E,EACEH,EAASI,OACTqD,EAAOpD,oBAAoB4C,OAC3B,GAEF5F,EAAQoG,EAAOlD,8BAA8BP,EAASpF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-storymap",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Manages the creation and deployment of Story Map item types for @esri/solution.js.",
|
|
5
5
|
"main": "dist/node/index.js",
|
|
6
6
|
"unpkg": "dist/umd/storymap.umd.min.js",
|
|
@@ -13,22 +13,21 @@
|
|
|
13
13
|
"dist/**"
|
|
14
14
|
],
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@esri/arcgis-rest-auth": "3.4.
|
|
17
|
-
"@esri/arcgis-rest-portal": "3.4.
|
|
18
|
-
"@esri/arcgis-rest-request": "3.4.
|
|
19
|
-
"@esri/hub-common": "9.
|
|
20
|
-
"rollup": "^
|
|
21
|
-
"typescript": "^4.3.4"
|
|
16
|
+
"@esri/arcgis-rest-auth": "3.4.3",
|
|
17
|
+
"@esri/arcgis-rest-portal": "3.4.3",
|
|
18
|
+
"@esri/arcgis-rest-request": "3.4.3",
|
|
19
|
+
"@esri/hub-common": "9.15.0",
|
|
20
|
+
"rollup": "^2.60.0"
|
|
22
21
|
},
|
|
23
22
|
"peerDependencies": {
|
|
24
|
-
"@esri/arcgis-rest-auth": "3.4.
|
|
25
|
-
"@esri/arcgis-rest-portal": "3.4.
|
|
26
|
-
"@esri/arcgis-rest-request": "3.4.
|
|
27
|
-
"@esri/hub-common": "9.
|
|
23
|
+
"@esri/arcgis-rest-auth": "3.4.3",
|
|
24
|
+
"@esri/arcgis-rest-portal": "3.4.3",
|
|
25
|
+
"@esri/arcgis-rest-request": "3.4.3",
|
|
26
|
+
"@esri/hub-common": "9.15.0"
|
|
28
27
|
},
|
|
29
28
|
"dependencies": {
|
|
30
|
-
"@esri/solution-common": "^1.
|
|
31
|
-
"tslib": "
|
|
29
|
+
"@esri/solution-common": "^1.3.0",
|
|
30
|
+
"tslib": "1.13.0"
|
|
32
31
|
},
|
|
33
32
|
"scripts": {
|
|
34
33
|
"prepare": "npm run build",
|
|
@@ -80,5 +79,5 @@
|
|
|
80
79
|
"esri",
|
|
81
80
|
"ES6"
|
|
82
81
|
],
|
|
83
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "b8f04e56c71adb7aadaa0293f8708800cdaa9c81"
|
|
84
83
|
}
|