@esri/solution-web-experience 1.1.3 → 1.1.4

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.
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * @module solution-web-experience
20
20
  */
21
- import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse } from "@esri/solution-common";
21
+ import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse, IUpdateItemResponse } from "@esri/solution-common";
22
22
  /**
23
23
  * Convert a Web Experience item into a Template
24
24
  *
@@ -37,3 +37,14 @@ export declare function convertItemToTemplate(solutionItemId: string, itemInfo:
37
37
  * @param itemProgressCallback
38
38
  */
39
39
  export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
40
+ /**
41
+ * Post-Process an Experience
42
+ *
43
+ * @param {string} itemId The item ID
44
+ * @param {string} type The template type
45
+ * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
46
+ * @param {any} templateDictionary The template dictionary
47
+ * @param {UserSession} authentication The destination session info
48
+ * @returns Promise resolving to successfulness of update
49
+ */
50
+ export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: IItemTemplate, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<IUpdateItemResponse>;
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * @module solution-web-experience
20
20
  */
21
- import { EItemProgressStatus, generateEmptyCreationResponse } from "@esri/solution-common";
21
+ import { EItemProgressStatus, generateEmptyCreationResponse, updateItemTemplateFromDictionary } from "@esri/solution-common";
22
22
  import { failSafe } from "@esri/hub-common";
23
23
  import { getItemData, removeItem } from "@esri/arcgis-rest-portal";
24
24
  import { createWebExperienceModelFromTemplate } from "./helpers/create-web-experience-model-from-template";
@@ -103,4 +103,17 @@ export function createItemFromTemplate(template, templateDictionary, destination
103
103
  }
104
104
  });
105
105
  }
106
+ /**
107
+ * Post-Process an Experience
108
+ *
109
+ * @param {string} itemId The item ID
110
+ * @param {string} type The template type
111
+ * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
112
+ * @param {any} templateDictionary The template dictionary
113
+ * @param {UserSession} authentication The destination session info
114
+ * @returns Promise resolving to successfulness of update
115
+ */
116
+ export function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
117
+ return updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
118
+ }
106
119
  //# sourceMappingURL=web-experience-processor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-experience-processor.js","sourceRoot":"","sources":["../../src/web-experience-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,EAEL,mBAAmB,EAInB,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,oCAAoC,EAAE,MAAM,qDAAqD,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAE9F;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,cAA2B;IAE3B,oCAAoC;IACpC,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,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC9D,wBAAwB;QACxB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,oCAAoC;QACpC,OAAO,8BAA8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GASG;AACH,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAAuB,EACvB,SAA0B,EAC1B,kBAAuB,EACvB,cAA2B;IAE3B,OAAO,gCAAgC,CACrC,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf,CAAC;AACJ,CAAC"}
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * @module solution-web-experience
20
20
  */
21
- import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse } from "@esri/solution-common";
21
+ import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse, IUpdateItemResponse } from "@esri/solution-common";
22
22
  /**
23
23
  * Convert a Web Experience item into a Template
24
24
  *
@@ -37,3 +37,14 @@ export declare function convertItemToTemplate(solutionItemId: string, itemInfo:
37
37
  * @param itemProgressCallback
38
38
  */
39
39
  export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
40
+ /**
41
+ * Post-Process an Experience
42
+ *
43
+ * @param {string} itemId The item ID
44
+ * @param {string} type The template type
45
+ * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
46
+ * @param {any} templateDictionary The template dictionary
47
+ * @param {UserSession} authentication The destination session info
48
+ * @returns Promise resolving to successfulness of update
49
+ */
50
+ export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: IItemTemplate, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<IUpdateItemResponse>;
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
18
+ exports.postProcess = exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
19
19
  /**
20
20
  * Manages the creation and deployment of web-experience item types.
21
21
  *
@@ -108,4 +108,18 @@ function createItemFromTemplate(template, templateDictionary, destinationAuthent
108
108
  });
109
109
  }
110
110
  exports.createItemFromTemplate = createItemFromTemplate;
111
+ /**
112
+ * Post-Process an Experience
113
+ *
114
+ * @param {string} itemId The item ID
115
+ * @param {string} type The template type
116
+ * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
117
+ * @param {any} templateDictionary The template dictionary
118
+ * @param {UserSession} authentication The destination session info
119
+ * @returns Promise resolving to successfulness of update
120
+ */
121
+ function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
122
+ return (0, solution_common_1.updateItemTemplateFromDictionary)(itemId, templateDictionary, authentication);
123
+ }
124
+ exports.postProcess = postProcess;
111
125
  //# sourceMappingURL=web-experience-processor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-experience-processor.js","sourceRoot":"","sources":["../../src/web-experience-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,2DAO+B;AAC/B,iDAAoD;AACpD,iEAAmE;AACnE,mHAA2G;AAC3G,2EAAsE;AACtE,qGAA8F;AAE9F;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,cAA2B;IAE3B,oCAAoC;IACpC,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,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC9D,wBAAwB;QACxB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,oCAAoC;QACpC,OAAO,IAAA,mEAA8B,EAAC,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,sDAiBC;AAED;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACpC,QAAuB,EACvB,kBAAuB,EACvB,yBAAsC,EACtC,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ICreateItemFromTemplateResponse } from "@esri/solution-common";
21
+ import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse, IUpdateItemResponse } from "@esri/solution-common";
22
22
  /**
23
23
  * Convert a Web Experience item into a Template
24
24
  *
@@ -37,3 +37,14 @@ export declare function convertItemToTemplate(solutionItemId: string, itemInfo:
37
37
  * @param itemProgressCallback
38
38
  */
39
39
  export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
40
+ /**
41
+ * Post-Process an Experience
42
+ *
43
+ * @param {string} itemId The item ID
44
+ * @param {string} type The template type
45
+ * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
46
+ * @param {any} templateDictionary The template dictionary
47
+ * @param {UserSession} authentication The destination session info
48
+ * @returns Promise resolving to successfulness of update
49
+ */
50
+ export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: IItemTemplate, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<IUpdateItemResponse>;
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-web-experience - v1.1.3 - Apache-2.0
2
+ * @esri/solution-web-experience - v1.1.4 - Apache-2.0
3
3
  * Copyright (c) 2018-2021 Esri, Inc.
4
- * Mon Oct 18 2021 09:04:33 GMT-0700 (Pacific Daylight Time)
4
+ * Tue Oct 26 2021 15:16:00 GMT-0700 (Pacific Daylight Time)
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -391,12 +391,26 @@
391
391
  return response;
392
392
  }
393
393
  });
394
+ }
395
+ /**
396
+ * Post-Process an Experience
397
+ *
398
+ * @param {string} itemId The item ID
399
+ * @param {string} type The template type
400
+ * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
401
+ * @param {any} templateDictionary The template dictionary
402
+ * @param {UserSession} authentication The destination session info
403
+ * @returns Promise resolving to successfulness of update
404
+ */
405
+ function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
406
+ return solutionCommon.updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
394
407
  }
395
408
 
396
409
  var webExperienceProcessor = /*#__PURE__*/Object.freeze({
397
410
  __proto__: null,
398
411
  convertItemToTemplate: convertItemToTemplate,
399
- createItemFromTemplate: createItemFromTemplate
412
+ createItemFromTemplate: createItemFromTemplate,
413
+ postProcess: postProcess
400
414
  });
401
415
 
402
416
  exports.WebExperienceProcessor = webExperienceProcessor;
@@ -1 +1 @@
1
- {"version":3,"file":"web-experience.umd.js","sources":["../../src/helpers/get-experience-subdomain.ts","../../src/helpers/get-web-experience-url-template.ts","../../src/helpers/create-web-experience-model-from-template.ts","../../src/helpers/create-web-experience.ts","../../src/helpers/get-web-experience-dependencies.ts","../../src/helpers/convert-web-experience-to-template.ts","../../src/web-experience-processor.ts"],"sourcesContent":["/** @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\n/**\r\n * Returns the subdomain for an experience based on the api the session is\r\n * authenticated against\r\n *\r\n * @param authentication UserSession\r\n */\r\nexport function getExperienceSubdomain(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 experiences on portal?\r\n let result;\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"experienceqa\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"experiencedev\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"experience\";\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 { getExperienceSubdomain } from \"./get-experience-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 getWebExperiencepUrlTemplate(\r\n authentication: UserSession\r\n): string {\r\n let baseUrl = \"\";\r\n\r\n const subdomain = getExperienceSubdomain(authentication);\r\n if (subdomain) {\r\n baseUrl = `https://${subdomain}.arcgis.com/experience/{{appid}}`;\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/experiencebuilder/?id={{appid}}`;\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\nimport { interpolate, IModelTemplate } from \"@esri/hub-common\";\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getWebExperiencepUrlTemplate } from \"./get-web-experience-url-template\";\r\n/**\r\n * Convert a Web Experience template into a Model that can be persisted to the Portal API\r\n *\r\n * @param templateModel Template\r\n * @param settings Hash of values to interpolate into the template\r\n * @param transforms Hash of transform functions to use in the interpolation\r\n * @param authentication UserSession\r\n */\r\nexport function createWebExperienceModelFromTemplate(\r\n templateModel: IModelTemplate,\r\n settings: any,\r\n transforms: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n // get the experience base url\r\n settings.experienceUrlTemplate = getWebExperiencepUrlTemplate(authentication);\r\n const model = interpolate(templateModel, settings, transforms);\r\n // ensure this is set - there may be some templates w/o `{{experienceTemplateUrl}}\r\n model.item.url = settings.experienceUrlTemplate;\r\n /* istanbul ignore else */\r\n if (templateModel.item.thumbnail) {\r\n model.item.thumbnail = templateModel.item.thumbnail; // interpolation trashes thumbnail binary\r\n }\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 {\r\n IModel,\r\n cloneObject,\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 updateItem,\r\n addItemResource,\r\n ICreateItemOptions,\r\n ICreateItemResponse,\r\n IUpdateItemOptions,\r\n moveItem\r\n} from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Given a Model for a Web Experience, create the item in the Portal API\r\n *\r\n * @param model\r\n * @param options\r\n * @param authentication\r\n */\r\nexport function createWebExperience(\r\n model: IModel,\r\n folderId: string,\r\n options: any,\r\n authentication: UserSession\r\n): Promise<IModel> {\r\n const resources: any[] = [];\r\n\r\n // For unkown 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 (\r\n createItem(createOptions)\r\n .then((createResponse: ICreateItemResponse) => {\r\n model.item.id = createResponse.id;\r\n\r\n const savedThumbnail = model.item.thumbnail;\r\n model = interpolateItemId(model);\r\n model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary\r\n\r\n // Experiences store draft data in a resource attached to the item\r\n // We'll just use the published data for the first \"draft\"\r\n const draftResourceModel = cloneObject(model.data);\r\n resources.push({\r\n name: \"config.json\",\r\n prefix: \"config\",\r\n file: stringToBlob(JSON.stringify(draftResourceModel))\r\n });\r\n // there may also be this image resources list\r\n const imageListModel = cloneObject(model.properties.imageResourcesList);\r\n if (imageListModel) {\r\n resources.push({\r\n name: \"image-resources-list.json\",\r\n prefix: \"images\",\r\n file: stringToBlob(JSON.stringify(imageListModel))\r\n });\r\n }\r\n\r\n delete model.properties;\r\n // update the experience with the newly interpolated model\r\n const updateOptions: IUpdateItemOptions = {\r\n item: serializeModel(model),\r\n authentication\r\n };\r\n if (model.item.thumbnail) {\r\n updateOptions.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 updateOptions.item.thumbnail;\r\n }\r\n\r\n return Promise.all([\r\n updateItem(updateOptions),\r\n authentication.getUsername()\r\n ]);\r\n })\r\n .then((responses: any[]) => {\r\n const username = responses[1];\r\n const failSafeAddItemResource = failSafe(addItemResource, {\r\n success: true\r\n });\r\n // upload the data and oembed resources\r\n const resourceUploadPromises = resources.map(resource =>\r\n failSafeAddItemResource({\r\n id: model.item.id,\r\n owner: username,\r\n resource: resource.file,\r\n name: resource.name,\r\n prefix: resource.prefix,\r\n authentication\r\n })\r\n );\r\n // fire and forget\r\n return Promise.all(resourceUploadPromises);\r\n })\r\n // .then(() => {\r\n // // TODO: Can we leave this to the main process?\r\n // return uploadResourcesFromUrl(model, options.assets || [], authentication);\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}\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\nimport { IModel, getProp, maybePush } from \"@esri/hub-common\";\r\n\r\n/**\r\n * Given an Web Experience model, extract out all the\r\n * items it depends on from the `dataSources` hash\r\n *\r\n * @param model IModel\r\n */\r\nexport function getWebExperienceDependencies(model: IModel): any[] {\r\n const dataSources = getProp(model, \"data.dataSources\") || {};\r\n return Object.keys(dataSources).reduce((acc, key) => {\r\n return maybePush(getProp(dataSources, `${key}.itemId`), 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\n\r\nimport {\r\n IModel,\r\n normalizeSolutionTemplateItem,\r\n cloneObject,\r\n propifyString,\r\n createId\r\n} from \"@esri/hub-common\";\r\n\r\nimport {\r\n IItemTemplate,\r\n createPlaceholderTemplate\r\n} from \"@esri/solution-common\";\r\nimport { IItem } from \"@esri/arcgis-rest-portal\";\r\nimport { getWebExperienceDependencies } from \"./get-web-experience-dependencies\";\r\n\r\n/**\r\n * Convert an Experience item into a template\r\n *\r\n * Pretty simpler conversion - remove extra item props, extract out\r\n * items from the data.dataSources hash.\r\n *\r\n * @param model\r\n * @param authentication\r\n */\r\nexport function convertWebExperienceToTemplate(\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. This is updated during the createModelFromTemplate phase\r\n // of the deployment process\r\n tmpl.item.url = \"{{experienceUrlTemplate}}\";\r\n\r\n // use typeKeyword to mark item as published (we decided to discard unpublished drafts)\r\n const typeKeywords = tmpl.item.typeKeywords;\r\n if (typeKeywords.indexOf(changedTypeKW) !== -1) {\r\n tmpl.item.typeKeywords = [publishedTypeKW].concat(\r\n tmpl.item.typeKeywords.filter(word => word !== changedTypeKW)\r\n );\r\n }\r\n\r\n tmpl.dependencies = getWebExperienceDependencies(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, authentication)\r\n // .then((response) => {\r\n // tmpl.resources = response.resources.map(e => e.resource)\r\n // // Discard draft version\r\n // .filter(filename => filename !== 'config.json');\r\n // return tmpl;\r\n // });\r\n}\r\n\r\nconst publishedTypeKW = \"status: Published\";\r\nconst changedTypeKW = \"status: Changed\";\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 web-experience item types.\r\n *\r\n * @module solution-web-experience\r\n */\r\n\r\nimport {\r\n UserSession,\r\n EItemProgressStatus,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n ICreateItemFromTemplateResponse,\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 { createWebExperienceModelFromTemplate } from \"./helpers/create-web-experience-model-from-template\";\r\nimport { createWebExperience } from \"./helpers/create-web-experience\";\r\nimport { convertWebExperienceToTemplate } from \"./helpers/convert-web-experience-to-template\";\r\n\r\n/**\r\n * Convert a Web Experience item into a Template\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo\r\n * @param authentication\r\n * @param isGroup\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n authentication: UserSession\r\n): Promise<IItemTemplate> {\r\n // use the itemInfo to setup a model\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 }).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 convertWebExperienceToTemplate(model);\r\n });\r\n}\r\n\r\n/**\r\n * Create a Web Experience from a 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 let exbModel: IModel;\r\n return createWebExperienceModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n {},\r\n destinationAuthentication\r\n )\r\n .then(model => {\r\n exbModel = model;\r\n return createWebExperience(\r\n model,\r\n templateDictionary.folderId,\r\n {},\r\n destinationAuthentication\r\n );\r\n })\r\n .then(createdModel => {\r\n exbModel.item.id = createdModel.item.id;\r\n exbModel.item.url = createdModel.item.url;\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever recieves\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: createdModel.item.id\r\n };\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n createdModel.item.id\r\n );\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: exbModel.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 ...exbModel\r\n },\r\n id: exbModel.item.id,\r\n type: template.type,\r\n postProcess: false\r\n };\r\n response.item.itemId = exbModel.item.id;\r\n return response;\r\n }\r\n });\r\n}\r\n"],"names":["interpolate","serializeModel","createItem","interpolateItemId","cloneObject","stringToBlob","updateItem","failSafe","addItemResource","moveItem","getProp","maybePush","createPlaceholderTemplate","propifyString","createId","normalizeSolutionTemplateItem","getItemData","EItemProgressStatus","generateEmptyCreationResponse","removeItem"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAiBA;;;;;;WAMgB,sBAAsB,CAAC,cAA2B;MAChE,MAAM,SAAS,GACb,cAAc,CAAC,MAAM,IAAI,qCAAqC,CAAC;;MAEjE,IAAI,MAAM,CAAC;MACX,IAAI,SAAS,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;UACnD,MAAM,GAAG,cAAc,CAAC;OACzB;WAAM,IAAI,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE;UAC/D,MAAM,GAAG,eAAe,CAAC;OAC1B;WAAM,IAAI,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE;UACtD,MAAM,GAAG,YAAY,CAAC;OACvB;MACD,OAAO,MAAM,CAAC;EAChB;;ECnBA;;;;;;AAMA,WAAgB,4BAA4B,CAC1C,cAA2B;MAE3B,IAAI,OAAO,GAAG,EAAE,CAAC;MAEjB,MAAM,SAAS,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;MACzD,IAAI,SAAS,EAAE;UACb,OAAO,GAAG,WAAW,SAAS,kCAAkC,CAAC;OAClE;WAAM;;;UAGL,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;UACzE,OAAO,GAAG,GAAG,aAAa,uCAAuC,CAAC;OACnE;MAED,OAAO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AE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;cAC/D,OAAO,cAAc,CAAC;kBACpB,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;kBACpB,cAAc,EAAE,yBAAyB;eAC1C,CAAC,CAAC,IAAI,CAAC;kBACN,OAAO,OAAO,CAAC,OAAO,CAACD,4CAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;eACtE,CAAC,CAAC;WACJ;eAAM;;cAEL,MAAM,QAAQ,GAAoC;kBAChD,IAAI,EAAE;sBACJ,GAAG,QAAQ;sBACX,GAAG,QAAQ;mBACZ;kBACD,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;kBACpB,IAAI,EAAE,QAAQ,CAAC,IAAI;kBACnB,WAAW,EAAE,KAAK;eACnB,CAAC;cACF,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;cACxC,OAAO,QAAQ,CAAC;WACjB;OACF,CAAC,CAAC;EACP,CAAC;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"web-experience.umd.js","sources":["../../src/helpers/get-experience-subdomain.ts","../../src/helpers/get-web-experience-url-template.ts","../../src/helpers/create-web-experience-model-from-template.ts","../../src/helpers/create-web-experience.ts","../../src/helpers/get-web-experience-dependencies.ts","../../src/helpers/convert-web-experience-to-template.ts","../../src/web-experience-processor.ts"],"sourcesContent":["/** @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\n/**\r\n * Returns the subdomain for an experience based on the api the session is\r\n * authenticated against\r\n *\r\n * @param authentication UserSession\r\n */\r\nexport function getExperienceSubdomain(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 experiences on portal?\r\n let result;\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"experienceqa\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"experiencedev\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"experience\";\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 { getExperienceSubdomain } from \"./get-experience-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 getWebExperiencepUrlTemplate(\r\n authentication: UserSession\r\n): string {\r\n let baseUrl = \"\";\r\n\r\n const subdomain = getExperienceSubdomain(authentication);\r\n if (subdomain) {\r\n baseUrl = `https://${subdomain}.arcgis.com/experience/{{appid}}`;\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/experiencebuilder/?id={{appid}}`;\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\nimport { interpolate, IModelTemplate } from \"@esri/hub-common\";\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getWebExperiencepUrlTemplate } from \"./get-web-experience-url-template\";\r\n/**\r\n * Convert a Web Experience template into a Model that can be persisted to the Portal API\r\n *\r\n * @param templateModel Template\r\n * @param settings Hash of values to interpolate into the template\r\n * @param transforms Hash of transform functions to use in the interpolation\r\n * @param authentication UserSession\r\n */\r\nexport function createWebExperienceModelFromTemplate(\r\n templateModel: IModelTemplate,\r\n settings: any,\r\n transforms: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n // get the experience base url\r\n settings.experienceUrlTemplate = getWebExperiencepUrlTemplate(authentication);\r\n const model = interpolate(templateModel, settings, transforms);\r\n // ensure this is set - there may be some templates w/o `{{experienceTemplateUrl}}\r\n model.item.url = settings.experienceUrlTemplate;\r\n /* istanbul ignore else */\r\n if (templateModel.item.thumbnail) {\r\n model.item.thumbnail = templateModel.item.thumbnail; // interpolation trashes thumbnail binary\r\n }\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 {\r\n IModel,\r\n cloneObject,\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 updateItem,\r\n addItemResource,\r\n ICreateItemOptions,\r\n ICreateItemResponse,\r\n IUpdateItemOptions,\r\n moveItem\r\n} from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Given a Model for a Web Experience, create the item in the Portal API\r\n *\r\n * @param model\r\n * @param options\r\n * @param authentication\r\n */\r\nexport function createWebExperience(\r\n model: IModel,\r\n folderId: string,\r\n options: any,\r\n authentication: UserSession\r\n): Promise<IModel> {\r\n const resources: any[] = [];\r\n\r\n // For unkown 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 (\r\n createItem(createOptions)\r\n .then((createResponse: ICreateItemResponse) => {\r\n model.item.id = createResponse.id;\r\n\r\n const savedThumbnail = model.item.thumbnail;\r\n model = interpolateItemId(model);\r\n model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary\r\n\r\n // Experiences store draft data in a resource attached to the item\r\n // We'll just use the published data for the first \"draft\"\r\n const draftResourceModel = cloneObject(model.data);\r\n resources.push({\r\n name: \"config.json\",\r\n prefix: \"config\",\r\n file: stringToBlob(JSON.stringify(draftResourceModel))\r\n });\r\n // there may also be this image resources list\r\n const imageListModel = cloneObject(model.properties.imageResourcesList);\r\n if (imageListModel) {\r\n resources.push({\r\n name: \"image-resources-list.json\",\r\n prefix: \"images\",\r\n file: stringToBlob(JSON.stringify(imageListModel))\r\n });\r\n }\r\n\r\n delete model.properties;\r\n // update the experience with the newly interpolated model\r\n const updateOptions: IUpdateItemOptions = {\r\n item: serializeModel(model),\r\n authentication\r\n };\r\n if (model.item.thumbnail) {\r\n updateOptions.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 updateOptions.item.thumbnail;\r\n }\r\n\r\n return Promise.all([\r\n updateItem(updateOptions),\r\n authentication.getUsername()\r\n ]);\r\n })\r\n .then((responses: any[]) => {\r\n const username = responses[1];\r\n const failSafeAddItemResource = failSafe(addItemResource, {\r\n success: true\r\n });\r\n // upload the data and oembed resources\r\n const resourceUploadPromises = resources.map(resource =>\r\n failSafeAddItemResource({\r\n id: model.item.id,\r\n owner: username,\r\n resource: resource.file,\r\n name: resource.name,\r\n prefix: resource.prefix,\r\n authentication\r\n })\r\n );\r\n // fire and forget\r\n return Promise.all(resourceUploadPromises);\r\n })\r\n // .then(() => {\r\n // // TODO: Can we leave this to the main process?\r\n // return uploadResourcesFromUrl(model, options.assets || [], authentication);\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}\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\nimport { IModel, getProp, maybePush } from \"@esri/hub-common\";\r\n\r\n/**\r\n * Given an Web Experience model, extract out all the\r\n * items it depends on from the `dataSources` hash\r\n *\r\n * @param model IModel\r\n */\r\nexport function getWebExperienceDependencies(model: IModel): any[] {\r\n const dataSources = getProp(model, \"data.dataSources\") || {};\r\n return Object.keys(dataSources).reduce((acc, key) => {\r\n return maybePush(getProp(dataSources, `${key}.itemId`), 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\n\r\nimport {\r\n IModel,\r\n normalizeSolutionTemplateItem,\r\n cloneObject,\r\n propifyString,\r\n createId\r\n} from \"@esri/hub-common\";\r\n\r\nimport {\r\n IItemTemplate,\r\n createPlaceholderTemplate\r\n} from \"@esri/solution-common\";\r\nimport { IItem } from \"@esri/arcgis-rest-portal\";\r\nimport { getWebExperienceDependencies } from \"./get-web-experience-dependencies\";\r\n\r\n/**\r\n * Convert an Experience item into a template\r\n *\r\n * Pretty simpler conversion - remove extra item props, extract out\r\n * items from the data.dataSources hash.\r\n *\r\n * @param model\r\n * @param authentication\r\n */\r\nexport function convertWebExperienceToTemplate(\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. This is updated during the createModelFromTemplate phase\r\n // of the deployment process\r\n tmpl.item.url = \"{{experienceUrlTemplate}}\";\r\n\r\n // use typeKeyword to mark item as published (we decided to discard unpublished drafts)\r\n const typeKeywords = tmpl.item.typeKeywords;\r\n if (typeKeywords.indexOf(changedTypeKW) !== -1) {\r\n tmpl.item.typeKeywords = [publishedTypeKW].concat(\r\n tmpl.item.typeKeywords.filter(word => word !== changedTypeKW)\r\n );\r\n }\r\n\r\n tmpl.dependencies = getWebExperienceDependencies(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, authentication)\r\n // .then((response) => {\r\n // tmpl.resources = response.resources.map(e => e.resource)\r\n // // Discard draft version\r\n // .filter(filename => filename !== 'config.json');\r\n // return tmpl;\r\n // });\r\n}\r\n\r\nconst publishedTypeKW = \"status: Published\";\r\nconst changedTypeKW = \"status: Changed\";\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 web-experience item types.\r\n *\r\n * @module solution-web-experience\r\n */\r\n\r\nimport {\r\n UserSession,\r\n EItemProgressStatus,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n ICreateItemFromTemplateResponse,\r\n IUpdateItemResponse,\r\n generateEmptyCreationResponse,\r\n updateItemTemplateFromDictionary\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 { createWebExperienceModelFromTemplate } from \"./helpers/create-web-experience-model-from-template\";\r\nimport { createWebExperience } from \"./helpers/create-web-experience\";\r\nimport { convertWebExperienceToTemplate } from \"./helpers/convert-web-experience-to-template\";\r\n\r\n/**\r\n * Convert a Web Experience item into a Template\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo\r\n * @param authentication\r\n * @param isGroup\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n authentication: UserSession\r\n): Promise<IItemTemplate> {\r\n // use the itemInfo to setup a model\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 }).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 convertWebExperienceToTemplate(model);\r\n });\r\n}\r\n\r\n/**\r\n * Create a Web Experience from a 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 let exbModel: IModel;\r\n return createWebExperienceModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n {},\r\n destinationAuthentication\r\n )\r\n .then(model => {\r\n exbModel = model;\r\n return createWebExperience(\r\n model,\r\n templateDictionary.folderId,\r\n {},\r\n destinationAuthentication\r\n );\r\n })\r\n .then(createdModel => {\r\n exbModel.item.id = createdModel.item.id;\r\n exbModel.item.url = createdModel.item.url;\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever recieves\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: createdModel.item.id\r\n };\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n createdModel.item.id\r\n );\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: exbModel.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 ...exbModel\r\n },\r\n id: exbModel.item.id,\r\n type: template.type,\r\n postProcess: false\r\n };\r\n response.item.itemId = exbModel.item.id;\r\n return response;\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Post-Process an Experience\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template type\r\n * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns Promise resolving to successfulness of update\r\n */\r\nexport function postProcess(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: IItemTemplate,\r\n templates: IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: UserSession\r\n): Promise<IUpdateItemResponse> {\r\n return updateItemTemplateFromDictionary(\r\n itemId,\r\n templateDictionary,\r\n authentication\r\n );\r\n}\r\n"],"names":["interpolate","serializeModel","createItem","interpolateItemId","cloneObject","stringToBlob","updateItem","failSafe","addItemResource","moveItem","getProp","maybePush","createPlaceholderTemplate","propifyString","createId","normalizeSolutionTemplateItem","getItemData","EItemProgressStatus","generateEmptyCreationResponse","removeItem","updateItemTemplateFromDictionary"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAiBA;;;;;;WAMgB,sBAAsB,CAA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IAAI,EAAE,QAAQ,CAAC,IAAI;kBACnB,WAAW,EAAE,KAAK;eACnB,CAAC;cACF,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;cACxC,OAAO,QAAQ,CAAC;WACjB;OACF,CAAC,CAAC;EACP,CAAC;EAED;;;;;;;;;;AAUA,WAAgB,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAAuB,EACvB,SAA0B,EAC1B,kBAAuB,EACvB,cAA2B;MAE3B,OAAOE,+CAAgC,CACrC,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-web-experience - v1.1.3 - Apache-2.0
2
+ * @esri/solution-web-experience - v1.1.4 - Apache-2.0
3
3
  * Copyright (c) 2018-2021 Esri, Inc.
4
- * Mon Oct 18 2021 09:04:39 GMT-0700 (Pacific Daylight Time)
4
+ * Tue Oct 26 2021 15:16:05 GMT-0700 (Pacific Daylight Time)
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -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,i,r){"use strict";function n(e){const r=t.createPlaceholderTemplate(e.item.id,e.item.type);r.key=`${i.propifyString(e.item.title)}_${i.createId("i")}`;const n=i.cloneObject(e);r.data=n.data,r.item=i.normalizeSolutionTemplateItem(n.item),r.item.url="{{experienceUrlTemplate}}";return-1!==r.item.typeKeywords.indexOf(a)&&(r.item.typeKeywords=[o].concat(r.item.typeKeywords.filter((e=>e!==a)))),r.dependencies=function(e){const t=i.getProp(e,"data.dataSources")||{};return Object.keys(t).reduce(((e,r)=>i.maybePush(i.getProp(t,`${r}.itemId`),e)),[])}(e),Promise.resolve(r)}const o="status: Published",a="status: Changed";var s=Object.freeze({__proto__:null,convertItemToTemplate:function(e,t,i){const o={item:t,data:{}};return r.getItemData(t.id,{authentication:i}).then((e=>(o.data=e,n(o))))},createItemFromTemplate:function(e,n,o,a){if(!a(e.itemId,t.EItemProgressStatus.Started,0))return Promise.resolve(t.generateEmptyCreationResponse(e.type));let s;return function(e,t,r,n){t.experienceUrlTemplate=function(e){let t="";const i=function(e){const t=e.portal||"https://www.arcgis.com/sharing/rest";let i;return t.match(/(qaext|\.mapsqa)\.arcgis.com/)?i="experienceqa":t.match(/(devext|\.mapsdevext)\.arcgis.com/)?i="experiencedev":t.match(/(www|\.maps)\.arcgis.com/)&&(i="experience"),i}(e);return t=i?`https://${i}.arcgis.com/experience/{{appid}}`:`${e.portal.replace("/sharing/rest","")}/apps/experiencebuilder/?id={{appid}}`,t}(n);const o=i.interpolate(e,t,r);return o.item.url=t.experienceUrlTemplate,e.item.thumbnail&&(o.item.thumbnail=e.item.thumbnail),Promise.resolve(o)}(e,n,{},o).then((e=>(s=e,function(e,t,n,o){const a=[],s={item:i.serializeModel(e),authentication:o};return e.item.thumbnail&&(s.params={thumbnail:e.item.thumbnail},delete s.item.thumbnail),r.createItem(s).then((t=>{e.item.id=t.id;const n=e.item.thumbnail;(e=i.interpolateItemId(e)).item.thumbnail=n;const s=i.cloneObject(e.data);a.push({name:"config.json",prefix:"config",file:i.stringToBlob(JSON.stringify(s))});const m=i.cloneObject(e.properties.imageResourcesList);m&&a.push({name:"image-resources-list.json",prefix:"images",file:i.stringToBlob(JSON.stringify(m))}),delete e.properties;const c={item:i.serializeModel(e),authentication:o};return e.item.thumbnail&&(c.params={thumbnail:e.item.thumbnail},delete c.item.thumbnail),Promise.all([r.updateItem(c),o.getUsername()])})).then((t=>{const n=t[1],s=i.failSafe(r.addItemResource,{success:!0}),m=a.map((t=>s({id:e.item.id,owner:n,resource:t.file,name:t.name,prefix:t.prefix,authentication:o})));return Promise.all(m)})).then((()=>r.moveItem({itemId:e.item.id,folderId:t,authentication:o}))).then((()=>e))}(e,n.folderId,0,o)))).then((m=>{s.item.id=m.item.id,s.item.url=m.item.url,n[e.itemId]={itemId:m.item.id};if(a(e.itemId,t.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor||2,m.item.id)){const t={item:{...e,...s},id:s.item.id,type:e.type,postProcess:!1};return t.item.itemId=s.item.id,t}return i.failSafe(r.removeItem,{success:!0})({id:s.item.id,authentication:o}).then((()=>Promise.resolve(t.generateEmptyCreationResponse(e.type))))}))}});e.WebExperienceProcessor=s,Object.defineProperty(e,"__esModule",{value:!0})}));
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,i,r){"use strict";function n(e){const r=t.createPlaceholderTemplate(e.item.id,e.item.type);r.key=`${i.propifyString(e.item.title)}_${i.createId("i")}`;const n=i.cloneObject(e);r.data=n.data,r.item=i.normalizeSolutionTemplateItem(n.item),r.item.url="{{experienceUrlTemplate}}";return-1!==r.item.typeKeywords.indexOf(a)&&(r.item.typeKeywords=[o].concat(r.item.typeKeywords.filter((e=>e!==a)))),r.dependencies=function(e){const t=i.getProp(e,"data.dataSources")||{};return Object.keys(t).reduce(((e,r)=>i.maybePush(i.getProp(t,`${r}.itemId`),e)),[])}(e),Promise.resolve(r)}const o="status: Published",a="status: Changed";var s=Object.freeze({__proto__:null,convertItemToTemplate:function(e,t,i){const o={item:t,data:{}};return r.getItemData(t.id,{authentication:i}).then((e=>(o.data=e,n(o))))},createItemFromTemplate:function(e,n,o,a){if(!a(e.itemId,t.EItemProgressStatus.Started,0))return Promise.resolve(t.generateEmptyCreationResponse(e.type));let s;return function(e,t,r,n){t.experienceUrlTemplate=function(e){let t="";const i=function(e){const t=e.portal||"https://www.arcgis.com/sharing/rest";let i;return t.match(/(qaext|\.mapsqa)\.arcgis.com/)?i="experienceqa":t.match(/(devext|\.mapsdevext)\.arcgis.com/)?i="experiencedev":t.match(/(www|\.maps)\.arcgis.com/)&&(i="experience"),i}(e);return t=i?`https://${i}.arcgis.com/experience/{{appid}}`:`${e.portal.replace("/sharing/rest","")}/apps/experiencebuilder/?id={{appid}}`,t}(n);const o=i.interpolate(e,t,r);return o.item.url=t.experienceUrlTemplate,e.item.thumbnail&&(o.item.thumbnail=e.item.thumbnail),Promise.resolve(o)}(e,n,{},o).then((e=>(s=e,function(e,t,n,o){const a=[],s={item:i.serializeModel(e),authentication:o};return e.item.thumbnail&&(s.params={thumbnail:e.item.thumbnail},delete s.item.thumbnail),r.createItem(s).then((t=>{e.item.id=t.id;const n=e.item.thumbnail;(e=i.interpolateItemId(e)).item.thumbnail=n;const s=i.cloneObject(e.data);a.push({name:"config.json",prefix:"config",file:i.stringToBlob(JSON.stringify(s))});const m=i.cloneObject(e.properties.imageResourcesList);m&&a.push({name:"image-resources-list.json",prefix:"images",file:i.stringToBlob(JSON.stringify(m))}),delete e.properties;const c={item:i.serializeModel(e),authentication:o};return e.item.thumbnail&&(c.params={thumbnail:e.item.thumbnail},delete c.item.thumbnail),Promise.all([r.updateItem(c),o.getUsername()])})).then((t=>{const n=t[1],s=i.failSafe(r.addItemResource,{success:!0}),m=a.map((t=>s({id:e.item.id,owner:n,resource:t.file,name:t.name,prefix:t.prefix,authentication:o})));return Promise.all(m)})).then((()=>r.moveItem({itemId:e.item.id,folderId:t,authentication:o}))).then((()=>e))}(e,n.folderId,0,o)))).then((m=>{s.item.id=m.item.id,s.item.url=m.item.url,n[e.itemId]={itemId:m.item.id};if(a(e.itemId,t.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor||2,m.item.id)){const t={item:{...e,...s},id:s.item.id,type:e.type,postProcess:!1};return t.item.itemId=s.item.id,t}return i.failSafe(r.removeItem,{success:!0})({id:s.item.id,authentication:o}).then((()=>Promise.resolve(t.generateEmptyCreationResponse(e.type))))}))},postProcess:function(e,i,r,n,o,a,s){return t.updateItemTemplateFromDictionary(e,a,s)}});e.WebExperienceProcessor=s,Object.defineProperty(e,"__esModule",{value:!0})}));
19
19
  //# sourceMappingURL=web-experience.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-experience.umd.min.js","sources":["../../src/helpers/convert-web-experience-to-template.ts","../../src/helpers/get-web-experience-dependencies.ts","../../src/web-experience-processor.ts","../../src/helpers/create-web-experience-model-from-template.ts","../../src/helpers/get-web-experience-url-template.ts","../../src/helpers/get-experience-subdomain.ts","../../src/helpers/create-web-experience.ts"],"sourcesContent":["/** @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\nimport {\r\n IModel,\r\n normalizeSolutionTemplateItem,\r\n cloneObject,\r\n propifyString,\r\n createId\r\n} from \"@esri/hub-common\";\r\n\r\nimport {\r\n IItemTemplate,\r\n createPlaceholderTemplate\r\n} from \"@esri/solution-common\";\r\nimport { IItem } from \"@esri/arcgis-rest-portal\";\r\nimport { getWebExperienceDependencies } from \"./get-web-experience-dependencies\";\r\n\r\n/**\r\n * Convert an Experience item into a template\r\n *\r\n * Pretty simpler conversion - remove extra item props, extract out\r\n * items from the data.dataSources hash.\r\n *\r\n * @param model\r\n * @param authentication\r\n */\r\nexport function convertWebExperienceToTemplate(\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. This is updated during the createModelFromTemplate phase\r\n // of the deployment process\r\n tmpl.item.url = \"{{experienceUrlTemplate}}\";\r\n\r\n // use typeKeyword to mark item as published (we decided to discard unpublished drafts)\r\n const typeKeywords = tmpl.item.typeKeywords;\r\n if (typeKeywords.indexOf(changedTypeKW) !== -1) {\r\n tmpl.item.typeKeywords = [publishedTypeKW].concat(\r\n tmpl.item.typeKeywords.filter(word => word !== changedTypeKW)\r\n );\r\n }\r\n\r\n tmpl.dependencies = getWebExperienceDependencies(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, authentication)\r\n // .then((response) => {\r\n // tmpl.resources = response.resources.map(e => e.resource)\r\n // // Discard draft version\r\n // .filter(filename => filename !== 'config.json');\r\n // return tmpl;\r\n // });\r\n}\r\n\r\nconst publishedTypeKW = \"status: Published\";\r\nconst changedTypeKW = \"status: Changed\";\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\nimport { IModel, getProp, maybePush } from \"@esri/hub-common\";\r\n\r\n/**\r\n * Given an Web Experience model, extract out all the\r\n * items it depends on from the `dataSources` hash\r\n *\r\n * @param model IModel\r\n */\r\nexport function getWebExperienceDependencies(model: IModel): any[] {\r\n const dataSources = getProp(model, \"data.dataSources\") || {};\r\n return Object.keys(dataSources).reduce((acc, key) => {\r\n return maybePush(getProp(dataSources, `${key}.itemId`), 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\n/**\r\n * Manages the creation and deployment of web-experience item types.\r\n *\r\n * @module solution-web-experience\r\n */\r\n\r\nimport {\r\n UserSession,\r\n EItemProgressStatus,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n ICreateItemFromTemplateResponse,\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 { createWebExperienceModelFromTemplate } from \"./helpers/create-web-experience-model-from-template\";\r\nimport { createWebExperience } from \"./helpers/create-web-experience\";\r\nimport { convertWebExperienceToTemplate } from \"./helpers/convert-web-experience-to-template\";\r\n\r\n/**\r\n * Convert a Web Experience item into a Template\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo\r\n * @param authentication\r\n * @param isGroup\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n authentication: UserSession\r\n): Promise<IItemTemplate> {\r\n // use the itemInfo to setup a model\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 }).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 convertWebExperienceToTemplate(model);\r\n });\r\n}\r\n\r\n/**\r\n * Create a Web Experience from a 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 let exbModel: IModel;\r\n return createWebExperienceModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n {},\r\n destinationAuthentication\r\n )\r\n .then(model => {\r\n exbModel = model;\r\n return createWebExperience(\r\n model,\r\n templateDictionary.folderId,\r\n {},\r\n destinationAuthentication\r\n );\r\n })\r\n .then(createdModel => {\r\n exbModel.item.id = createdModel.item.id;\r\n exbModel.item.url = createdModel.item.url;\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever recieves\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: createdModel.item.id\r\n };\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n createdModel.item.id\r\n );\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: exbModel.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 ...exbModel\r\n },\r\n id: exbModel.item.id,\r\n type: template.type,\r\n postProcess: false\r\n };\r\n response.item.itemId = exbModel.item.id;\r\n return response;\r\n }\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\n\r\nimport { interpolate, IModelTemplate } from \"@esri/hub-common\";\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getWebExperiencepUrlTemplate } from \"./get-web-experience-url-template\";\r\n/**\r\n * Convert a Web Experience template into a Model that can be persisted to the Portal API\r\n *\r\n * @param templateModel Template\r\n * @param settings Hash of values to interpolate into the template\r\n * @param transforms Hash of transform functions to use in the interpolation\r\n * @param authentication UserSession\r\n */\r\nexport function createWebExperienceModelFromTemplate(\r\n templateModel: IModelTemplate,\r\n settings: any,\r\n transforms: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n // get the experience base url\r\n settings.experienceUrlTemplate = getWebExperiencepUrlTemplate(authentication);\r\n const model = interpolate(templateModel, settings, transforms);\r\n // ensure this is set - there may be some templates w/o `{{experienceTemplateUrl}}\r\n model.item.url = settings.experienceUrlTemplate;\r\n /* istanbul ignore else */\r\n if (templateModel.item.thumbnail) {\r\n model.item.thumbnail = templateModel.item.thumbnail; // interpolation trashes thumbnail binary\r\n }\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\nimport { getExperienceSubdomain } from \"./get-experience-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 getWebExperiencepUrlTemplate(\r\n authentication: UserSession\r\n): string {\r\n let baseUrl = \"\";\r\n\r\n const subdomain = getExperienceSubdomain(authentication);\r\n if (subdomain) {\r\n baseUrl = `https://${subdomain}.arcgis.com/experience/{{appid}}`;\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/experiencebuilder/?id={{appid}}`;\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\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\n/**\r\n * Returns the subdomain for an experience based on the api the session is\r\n * authenticated against\r\n *\r\n * @param authentication UserSession\r\n */\r\nexport function getExperienceSubdomain(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 experiences on portal?\r\n let result;\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"experienceqa\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"experiencedev\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"experience\";\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 {\r\n IModel,\r\n cloneObject,\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 updateItem,\r\n addItemResource,\r\n ICreateItemOptions,\r\n ICreateItemResponse,\r\n IUpdateItemOptions,\r\n moveItem\r\n} from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Given a Model for a Web Experience, create the item in the Portal API\r\n *\r\n * @param model\r\n * @param options\r\n * @param authentication\r\n */\r\nexport function createWebExperience(\r\n model: IModel,\r\n folderId: string,\r\n options: any,\r\n authentication: UserSession\r\n): Promise<IModel> {\r\n const resources: any[] = [];\r\n\r\n // For unkown 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 (\r\n createItem(createOptions)\r\n .then((createResponse: ICreateItemResponse) => {\r\n model.item.id = createResponse.id;\r\n\r\n const savedThumbnail = model.item.thumbnail;\r\n model = interpolateItemId(model);\r\n model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary\r\n\r\n // Experiences store draft data in a resource attached to the item\r\n // We'll just use the published data for the first \"draft\"\r\n const draftResourceModel = cloneObject(model.data);\r\n resources.push({\r\n name: \"config.json\",\r\n prefix: \"config\",\r\n file: stringToBlob(JSON.stringify(draftResourceModel))\r\n });\r\n // there may also be this image resources list\r\n const imageListModel = cloneObject(model.properties.imageResourcesList);\r\n if (imageListModel) {\r\n resources.push({\r\n name: \"image-resources-list.json\",\r\n prefix: \"images\",\r\n file: stringToBlob(JSON.stringify(imageListModel))\r\n });\r\n }\r\n\r\n delete model.properties;\r\n // update the experience with the newly interpolated model\r\n const updateOptions: IUpdateItemOptions = {\r\n item: serializeModel(model),\r\n authentication\r\n };\r\n if (model.item.thumbnail) {\r\n updateOptions.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 updateOptions.item.thumbnail;\r\n }\r\n\r\n return Promise.all([\r\n updateItem(updateOptions),\r\n authentication.getUsername()\r\n ]);\r\n })\r\n .then((responses: any[]) => {\r\n const username = responses[1];\r\n const failSafeAddItemResource = failSafe(addItemResource, {\r\n success: true\r\n });\r\n // upload the data and oembed resources\r\n const resourceUploadPromises = resources.map(resource =>\r\n failSafeAddItemResource({\r\n id: model.item.id,\r\n owner: username,\r\n resource: resource.file,\r\n name: resource.name,\r\n prefix: resource.prefix,\r\n authentication\r\n })\r\n );\r\n // fire and forget\r\n return Promise.all(resourceUploadPromises);\r\n })\r\n // .then(() => {\r\n // // TODO: Can we leave this to the main process?\r\n // return uploadResourcesFromUrl(model, options.assets || [], authentication);\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}\r\n"],"names":["convertWebExperienceToTemplate","model","tmpl","createPlaceholderTemplate","item","id","type","key","propifyString","title","createId","clone","cloneObject","data","normalizeSolutionTemplateItem","url","typeKeywords","indexOf","changedTypeKW","publishedTypeKW","concat","filter","word","dependencies","dataSources","getProp","Object","keys","reduce","acc","maybePush","getWebExperienceDependencies","Promise","resolve","solutionItemId","itemInfo","authentication","getItemData","then","template","templateDictionary","destinationAuthentication","itemProgressCallback","itemId","EItemProgressStatus","Started","generateEmptyCreationResponse","exbModel","templateModel","settings","transforms","experienceUrlTemplate","baseUrl","subdomain","portalUrl","portal","result","match","getExperienceSubdomain","replace","getWebExperiencepUrlTemplate","interpolate","thumbnail","createWebExperienceModelFromTemplate","folderId","options","resources","createOptions","serializeModel","params","createItem","createResponse","savedThumbnail","interpolateItemId","draftResourceModel","push","name","prefix","file","stringToBlob","JSON","stringify","imageListModel","properties","imageResourcesList","updateOptions","all","updateItem","getUsername","responses","username","failSafeAddItemResource","failSafe","addItemResource","success","resourceUploadPromises","map","resource","owner","moveItem","createWebExperience","createdModel","Finished","estimatedDeploymentCostFactor","response","postProcess","removeItem","failSafeRemove"],"mappings":";;;;;;;;;;;;;;;;;8bAwCgBA,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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AMG,KAAKC,GACf6F,MAAOR,EACPO,SAAUA,EAASnB,KACnBF,KAAMqB,EAASrB,KACfC,OAAQoB,EAASpB,OACjBzC,eAAAA,MAIJ,OAAOJ,QAAQsD,IAAIS,MAMpBzD,MAAK,IAEG6D,WAAS,CACdxD,OAAQ1C,EAAMG,KAAKC,GACnB2D,SAAAA,EACA5B,eAAAA,MAGHE,MAAK,IACGrC,IJjDFmG,CACLnG,EACAuC,EAAmBwB,SACnB,EACAvB,MAGHH,MAAK+D,IACJtD,EAAS3C,KAAKC,GAAKgG,EAAajG,KAAKC,GACrC0C,EAAS3C,KAAKW,IAAMsF,EAAajG,KAAKW,IAItCyB,EAAmBD,EAASI,QAAU,CACpCA,OAAQ0D,EAAajG,KAAKC,IAS5B,GAPoBqC,EAClBH,EAASI,OACTC,sBAAoB0D,SACpB/D,EAASgE,+BAAiC,EAC1CF,EAAajG,KAAKC,IAYb,CAEL,MAAMmG,EAA4C,CAChDpG,KAAM,IACDmC,KACAQ,GAEL1C,GAAI0C,EAAS3C,KAAKC,GAClBC,KAAMiC,EAASjC,KACfmG,aAAa,GAGf,OADAD,EAASpG,KAAKuC,OAASI,EAAS3C,KAAKC,GAC9BmG,EAlBP,OADuBZ,WAASc,aAAY,CAAEZ,SAAS,GAChDa,CAAe,CACpBtG,GAAI0C,EAAS3C,KAAKC,GAClB+B,eAAgBK,IACfH,MAAK,IACCN,QAAQC,QAAQa,gCAA8BP,EAASjC"}
1
+ {"version":3,"file":"web-experience.umd.min.js","sources":["../../src/helpers/convert-web-experience-to-template.ts","../../src/helpers/get-web-experience-dependencies.ts","../../src/web-experience-processor.ts","../../src/helpers/create-web-experience-model-from-template.ts","../../src/helpers/get-web-experience-url-template.ts","../../src/helpers/get-experience-subdomain.ts","../../src/helpers/create-web-experience.ts"],"sourcesContent":["/** @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\nimport {\r\n IModel,\r\n normalizeSolutionTemplateItem,\r\n cloneObject,\r\n propifyString,\r\n createId\r\n} from \"@esri/hub-common\";\r\n\r\nimport {\r\n IItemTemplate,\r\n createPlaceholderTemplate\r\n} from \"@esri/solution-common\";\r\nimport { IItem } from \"@esri/arcgis-rest-portal\";\r\nimport { getWebExperienceDependencies } from \"./get-web-experience-dependencies\";\r\n\r\n/**\r\n * Convert an Experience item into a template\r\n *\r\n * Pretty simpler conversion - remove extra item props, extract out\r\n * items from the data.dataSources hash.\r\n *\r\n * @param model\r\n * @param authentication\r\n */\r\nexport function convertWebExperienceToTemplate(\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. This is updated during the createModelFromTemplate phase\r\n // of the deployment process\r\n tmpl.item.url = \"{{experienceUrlTemplate}}\";\r\n\r\n // use typeKeyword to mark item as published (we decided to discard unpublished drafts)\r\n const typeKeywords = tmpl.item.typeKeywords;\r\n if (typeKeywords.indexOf(changedTypeKW) !== -1) {\r\n tmpl.item.typeKeywords = [publishedTypeKW].concat(\r\n tmpl.item.typeKeywords.filter(word => word !== changedTypeKW)\r\n );\r\n }\r\n\r\n tmpl.dependencies = getWebExperienceDependencies(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, authentication)\r\n // .then((response) => {\r\n // tmpl.resources = response.resources.map(e => e.resource)\r\n // // Discard draft version\r\n // .filter(filename => filename !== 'config.json');\r\n // return tmpl;\r\n // });\r\n}\r\n\r\nconst publishedTypeKW = \"status: Published\";\r\nconst changedTypeKW = \"status: Changed\";\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\nimport { IModel, getProp, maybePush } from \"@esri/hub-common\";\r\n\r\n/**\r\n * Given an Web Experience model, extract out all the\r\n * items it depends on from the `dataSources` hash\r\n *\r\n * @param model IModel\r\n */\r\nexport function getWebExperienceDependencies(model: IModel): any[] {\r\n const dataSources = getProp(model, \"data.dataSources\") || {};\r\n return Object.keys(dataSources).reduce((acc, key) => {\r\n return maybePush(getProp(dataSources, `${key}.itemId`), 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\n/**\r\n * Manages the creation and deployment of web-experience item types.\r\n *\r\n * @module solution-web-experience\r\n */\r\n\r\nimport {\r\n UserSession,\r\n EItemProgressStatus,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n ICreateItemFromTemplateResponse,\r\n IUpdateItemResponse,\r\n generateEmptyCreationResponse,\r\n updateItemTemplateFromDictionary\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 { createWebExperienceModelFromTemplate } from \"./helpers/create-web-experience-model-from-template\";\r\nimport { createWebExperience } from \"./helpers/create-web-experience\";\r\nimport { convertWebExperienceToTemplate } from \"./helpers/convert-web-experience-to-template\";\r\n\r\n/**\r\n * Convert a Web Experience item into a Template\r\n *\r\n * @param solutionItemId\r\n * @param itemInfo\r\n * @param authentication\r\n * @param isGroup\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n authentication: UserSession\r\n): Promise<IItemTemplate> {\r\n // use the itemInfo to setup a model\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 }).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 convertWebExperienceToTemplate(model);\r\n });\r\n}\r\n\r\n/**\r\n * Create a Web Experience from a 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 let exbModel: IModel;\r\n return createWebExperienceModelFromTemplate(\r\n template,\r\n templateDictionary,\r\n {},\r\n destinationAuthentication\r\n )\r\n .then(model => {\r\n exbModel = model;\r\n return createWebExperience(\r\n model,\r\n templateDictionary.folderId,\r\n {},\r\n destinationAuthentication\r\n );\r\n })\r\n .then(createdModel => {\r\n exbModel.item.id = createdModel.item.id;\r\n exbModel.item.url = createdModel.item.url;\r\n // Update the template dictionary\r\n // TODO: This should be done in whatever recieves\r\n // the outcome of this promise chain\r\n templateDictionary[template.itemId] = {\r\n itemId: createdModel.item.id\r\n };\r\n const finalStatus = itemProgressCallback(\r\n template.itemId,\r\n EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor || 2,\r\n createdModel.item.id\r\n );\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: exbModel.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 ...exbModel\r\n },\r\n id: exbModel.item.id,\r\n type: template.type,\r\n postProcess: false\r\n };\r\n response.item.itemId = exbModel.item.id;\r\n return response;\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Post-Process an Experience\r\n *\r\n * @param {string} itemId The item ID\r\n * @param {string} type The template type\r\n * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects\r\n * @param {any} templateDictionary The template dictionary\r\n * @param {UserSession} authentication The destination session info\r\n * @returns Promise resolving to successfulness of update\r\n */\r\nexport function postProcess(\r\n itemId: string,\r\n type: string,\r\n itemInfos: any[],\r\n template: IItemTemplate,\r\n templates: IItemTemplate[],\r\n templateDictionary: any,\r\n authentication: UserSession\r\n): Promise<IUpdateItemResponse> {\r\n return updateItemTemplateFromDictionary(\r\n itemId,\r\n templateDictionary,\r\n authentication\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\n\r\nimport { interpolate, IModelTemplate } from \"@esri/hub-common\";\r\nimport { UserSession } from \"@esri/solution-common\";\r\nimport { getWebExperiencepUrlTemplate } from \"./get-web-experience-url-template\";\r\n/**\r\n * Convert a Web Experience template into a Model that can be persisted to the Portal API\r\n *\r\n * @param templateModel Template\r\n * @param settings Hash of values to interpolate into the template\r\n * @param transforms Hash of transform functions to use in the interpolation\r\n * @param authentication UserSession\r\n */\r\nexport function createWebExperienceModelFromTemplate(\r\n templateModel: IModelTemplate,\r\n settings: any,\r\n transforms: any,\r\n authentication: UserSession\r\n): Promise<any> {\r\n // get the experience base url\r\n settings.experienceUrlTemplate = getWebExperiencepUrlTemplate(authentication);\r\n const model = interpolate(templateModel, settings, transforms);\r\n // ensure this is set - there may be some templates w/o `{{experienceTemplateUrl}}\r\n model.item.url = settings.experienceUrlTemplate;\r\n /* istanbul ignore else */\r\n if (templateModel.item.thumbnail) {\r\n model.item.thumbnail = templateModel.item.thumbnail; // interpolation trashes thumbnail binary\r\n }\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\nimport { getExperienceSubdomain } from \"./get-experience-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 getWebExperiencepUrlTemplate(\r\n authentication: UserSession\r\n): string {\r\n let baseUrl = \"\";\r\n\r\n const subdomain = getExperienceSubdomain(authentication);\r\n if (subdomain) {\r\n baseUrl = `https://${subdomain}.arcgis.com/experience/{{appid}}`;\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/experiencebuilder/?id={{appid}}`;\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\nimport { UserSession } from \"@esri/solution-common\";\r\n\r\n/**\r\n * Returns the subdomain for an experience based on the api the session is\r\n * authenticated against\r\n *\r\n * @param authentication UserSession\r\n */\r\nexport function getExperienceSubdomain(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 experiences on portal?\r\n let result;\r\n if (portalUrl.match(/(qaext|\\.mapsqa)\\.arcgis.com/)) {\r\n result = \"experienceqa\";\r\n } else if (portalUrl.match(/(devext|\\.mapsdevext)\\.arcgis.com/)) {\r\n result = \"experiencedev\";\r\n } else if (portalUrl.match(/(www|\\.maps)\\.arcgis.com/)) {\r\n result = \"experience\";\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 {\r\n IModel,\r\n cloneObject,\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 updateItem,\r\n addItemResource,\r\n ICreateItemOptions,\r\n ICreateItemResponse,\r\n IUpdateItemOptions,\r\n moveItem\r\n} from \"@esri/arcgis-rest-portal\";\r\n\r\n/**\r\n * Given a Model for a Web Experience, create the item in the Portal API\r\n *\r\n * @param model\r\n * @param options\r\n * @param authentication\r\n */\r\nexport function createWebExperience(\r\n model: IModel,\r\n folderId: string,\r\n options: any,\r\n authentication: UserSession\r\n): Promise<IModel> {\r\n const resources: any[] = [];\r\n\r\n // For unkown 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 (\r\n createItem(createOptions)\r\n .then((createResponse: ICreateItemResponse) => {\r\n model.item.id = createResponse.id;\r\n\r\n const savedThumbnail = model.item.thumbnail;\r\n model = interpolateItemId(model);\r\n model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary\r\n\r\n // Experiences store draft data in a resource attached to the item\r\n // We'll just use the published data for the first \"draft\"\r\n const draftResourceModel = cloneObject(model.data);\r\n resources.push({\r\n name: \"config.json\",\r\n prefix: \"config\",\r\n file: stringToBlob(JSON.stringify(draftResourceModel))\r\n });\r\n // there may also be this image resources list\r\n const imageListModel = cloneObject(model.properties.imageResourcesList);\r\n if (imageListModel) {\r\n resources.push({\r\n name: \"image-resources-list.json\",\r\n prefix: \"images\",\r\n file: stringToBlob(JSON.stringify(imageListModel))\r\n });\r\n }\r\n\r\n delete model.properties;\r\n // update the experience with the newly interpolated model\r\n const updateOptions: IUpdateItemOptions = {\r\n item: serializeModel(model),\r\n authentication\r\n };\r\n if (model.item.thumbnail) {\r\n updateOptions.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 updateOptions.item.thumbnail;\r\n }\r\n\r\n return Promise.all([\r\n updateItem(updateOptions),\r\n authentication.getUsername()\r\n ]);\r\n })\r\n .then((responses: any[]) => {\r\n const username = responses[1];\r\n const failSafeAddItemResource = failSafe(addItemResource, {\r\n success: true\r\n });\r\n // upload the data and oembed resources\r\n const resourceUploadPromises = resources.map(resource =>\r\n failSafeAddItemResource({\r\n id: model.item.id,\r\n owner: username,\r\n resource: resource.file,\r\n name: resource.name,\r\n prefix: resource.prefix,\r\n authentication\r\n })\r\n );\r\n // fire and forget\r\n return Promise.all(resourceUploadPromises);\r\n })\r\n // .then(() => {\r\n // // TODO: Can we leave this to the main process?\r\n // return uploadResourcesFromUrl(model, options.assets || [], authentication);\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}\r\n"],"names":["convertWebExperienceToTemplate","model","tmpl","createPlaceholderTemplate","item","id","type","key","propifyString","title","createId","clone","cloneObject","data","normalizeSolutionTemplateItem","url","typeKeywords","indexOf","changedTypeKW","publishedTypeKW","concat","filter","word","dependencies","dataSources","getProp","Object","keys","reduce","acc","maybePush","getWebExperienceDependencies","Promise","resolve","solutionItemId","itemInfo","authentication","getItemData","then","template","templateDictionary","destinationAuthentication","itemProgressCallback","itemId","EItemProgressStatus","Started","generateEmptyCreationResponse","exbModel","templateModel","settings","transforms","experienceUrlTemplate","baseUrl","subdomain","portalUrl","portal","result","match","getExperienceSubdomain","replace","getWebExperiencepUrlTemplate","interpolate","thumbnail","createWebExperienceModelFromTemplate","folderId","options","resources","createOptions","serializeModel","params","createItem","createResponse","savedThumbnail","interpolateItemId","draftResourceModel","push","name","prefix","file","stringToBlob","JSON","stringify","imageListModel","properties","imageResourcesList","updateOptions","all","updateItem","getUsername","responses","username","failSafeAddItemResource","failSafe","addItemResource","success","resourceUploadPromises","map","resource","owner","moveItem","createWebExperience","createdModel","Finished","estimatedDeploymentCostFactor","response","postProcess","removeItem","failSafeRemove","itemInfos","templates","updateItemTemplateFromDictionary"],"mappings":";;;;;;;;;;;;;;;;;8bAwCgBA,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,MAGhDF,EAAKE,KAAKW,IAAM,4BAYhB,OAR6C,IADxBb,EAAKE,KAAKY,aACdC,QAAQC,KACvBhB,EAAKE,KAAKY,aAAe,CAACG,GAAiBC,OACzClB,EAAKE,KAAKY,aAAaK,QAAOC,GAAQA,IAASJ,MAInDhB,EAAKqB,sBCrCsCtB,GAC3C,MAAMuB,EAAcC,UAAQxB,EAAO,qBAAuB,GAC1D,OAAOy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vB,MAGHH,MAAK+D,IACJtD,EAAS3C,KAAKC,GAAKgG,EAAajG,KAAKC,GACrC0C,EAAS3C,KAAKW,IAAMsF,EAAajG,KAAKW,IAItCyB,EAAmBD,EAASI,QAAU,CACpCA,OAAQ0D,EAAajG,KAAKC,IAS5B,GAPoBqC,EAClBH,EAASI,OACTC,sBAAoB0D,SACpB/D,EAASgE,+BAAiC,EAC1CF,EAAajG,KAAKC,IAYb,CAEL,MAAMmG,EAA4C,CAChDpG,KAAM,IACDmC,KACAQ,GAEL1C,GAAI0C,EAAS3C,KAAKC,GAClBC,KAAMiC,EAASjC,KACfmG,aAAa,GAGf,OADAD,EAASpG,KAAKuC,OAASI,EAAS3C,KAAKC,GAC9BmG,EAlBP,OADuBZ,WAASc,aAAY,CAAEZ,SAAS,GAChDa,CAAe,CACpBtG,GAAI0C,EAAS3C,KAAKC,GAClB+B,eAAgBK,IACfH,MAAK,IACCN,QAAQC,QAAQa,gCAA8BP,EAASjC,kCA8BtEqC,EACArC,EACAsG,EACArE,EACAsE,EACArE,EACAJ,GAEA,OAAO0E,mCACLnE,EACAH,EACAJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-web-experience",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Manages the creation and deployment of Web Experience item types for @esri/solution.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "unpkg": "dist/umd/web-experience.umd.min.js",
@@ -13,28 +13,28 @@
13
13
  "dist/**"
14
14
  ],
15
15
  "devDependencies": {
16
- "@esri/arcgis-rest-auth": "3.4.1",
17
- "@esri/arcgis-rest-feature-layer": "3.4.1",
18
- "@esri/arcgis-rest-portal": "3.4.1",
19
- "@esri/arcgis-rest-request": "3.4.1",
20
- "@esri/arcgis-rest-service-admin": "3.4.1",
21
- "@esri/hub-common": "9.1.1",
22
- "@esri/hub-initiatives": "9.1.1",
16
+ "@esri/arcgis-rest-auth": "3.4.2",
17
+ "@esri/arcgis-rest-feature-layer": "3.4.2",
18
+ "@esri/arcgis-rest-portal": "3.4.2",
19
+ "@esri/arcgis-rest-request": "3.4.2",
20
+ "@esri/arcgis-rest-service-admin": "3.4.2",
21
+ "@esri/hub-common": "9.2.0",
22
+ "@esri/hub-initiatives": "9.2.0",
23
23
  "rollup": "^1.22.0",
24
24
  "typescript": "^4.3.4"
25
25
  },
26
26
  "peerDependencies": {
27
- "@esri/arcgis-rest-auth": "3.4.1",
28
- "@esri/arcgis-rest-feature-layer": "3.4.1",
29
- "@esri/arcgis-rest-portal": "3.4.1",
30
- "@esri/arcgis-rest-request": "3.4.1",
31
- "@esri/arcgis-rest-service-admin": "3.4.1",
32
- "@esri/hub-common": "9.1.1",
33
- "@esri/hub-initiatives": "9.1.1"
27
+ "@esri/arcgis-rest-auth": "3.4.2",
28
+ "@esri/arcgis-rest-feature-layer": "3.4.2",
29
+ "@esri/arcgis-rest-portal": "3.4.2",
30
+ "@esri/arcgis-rest-request": "3.4.2",
31
+ "@esri/arcgis-rest-service-admin": "3.4.2",
32
+ "@esri/hub-common": "9.2.0",
33
+ "@esri/hub-initiatives": "9.2.0"
34
34
  },
35
35
  "dependencies": {
36
- "@esri/solution-common": "^1.1.3",
37
- "@esri/solution-simple-types": "^1.1.3",
36
+ "@esri/solution-common": "^1.1.4",
37
+ "@esri/solution-simple-types": "^1.1.4",
38
38
  "tslib": "^1.13.0"
39
39
  },
40
40
  "scripts": {
@@ -72,5 +72,5 @@
72
72
  "esri",
73
73
  "ES6"
74
74
  ],
75
- "gitHead": "49a1d019f09a153de90c23d4fff1be1af7d554c0"
75
+ "gitHead": "85775515ebd9e68d836d60ea1aa99ebdcde7771e"
76
76
  }