@esri/solution-web-experience 1.1.4 → 1.3.1

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.
@@ -30,7 +30,12 @@ export function convertWebExperienceToTemplate(model) {
30
30
  tmpl.key = `${propifyString(model.item.title)}_${createId("i")}`;
31
31
  const clone = cloneObject(model);
32
32
  tmpl.data = clone.data;
33
+ // We need to save these properties in order to restore them after hub.js deletes them
34
+ const created = clone.item.created;
35
+ const modified = clone.item.modified;
33
36
  tmpl.item = normalizeSolutionTemplateItem(clone.item);
37
+ tmpl.item.created = created;
38
+ tmpl.item.modified = modified;
34
39
  // templatize the url. This is updated during the createModelFromTemplate phase
35
40
  // of the deployment process
36
41
  tmpl.item.url = "{{experienceUrlTemplate}}";
@@ -1 +1 @@
1
- {"version":3,"file":"convert-web-experience-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-web-experience-to-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,6BAA6B,EAC7B,WAAW,EACX,aAAa,EACb,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF;;;;;;;;GAQG;AACH,MAAM,UAAU,8BAA8B,CAC5C,KAAa;IAEb,MAAM,IAAI,GAAG,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,GAAG,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;IAEjE,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACvB,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC,KAAK,CAAC,IAAI,CAAU,CAAC;IAC/D,+EAA+E;IAC/E,4BAA4B;IAC5B,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,2BAA2B,CAAC;IAE5C,uFAAuF;IACvF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;IAC5C,IAAI,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QAC9C,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAC/C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,aAAa,CAAC,CAC9D,CAAC;KACH;IAED,IAAI,CAAC,YAAY,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAC;IAExD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,kEAAkE;IAClE,8EAA8E;IAC9E,wDAAwD;IACxD,yDAAyD;IACzD,uDAAuD;IACvD,0BAA0B;IAC1B,+DAA+D;IAC/D,iCAAiC;IACjC,yDAAyD;IACzD,mBAAmB;IACnB,QAAQ;AACV,CAAC;AAED,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,aAAa,GAAG,iBAAiB,CAAC"}
1
+ {"version":3,"file":"convert-web-experience-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-web-experience-to-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,6BAA6B,EAC7B,WAAW,EACX,aAAa,EACb,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF;;;;;;;;GAQG;AACH,MAAM,UAAU,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IAAI,CAAC,CAAC;IAC7B,kEAAkE;IAClE,8EAA8E;IAC9E,wDAAwD;IACxD,yDAAyD;IACzD,uDAAuD;IACvD,0BAA0B;IAC1B,+DAA+D;IAC/D,iCAAiC;IACjC,yDAAyD;IACzD,mBAAmB;IACnB,QAAQ;AACV,CAAC;AAED,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,aAAa,GAAG,iBAAiB,CAAC"}
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { cloneObject, failSafe, serializeModel, interpolateItemId, stringToBlob } from "@esri/hub-common";
16
+ import { cloneObject, failSafe, serializeModel, interpolateItemId, stringToBlob, objectToJsonBlob } from "@esri/hub-common";
17
17
  import { createItem, updateItem, addItemResource, moveItem } from "@esri/arcgis-rest-portal";
18
18
  /**
19
19
  * Given a Model for a Web Experience, create the item in the Portal API
@@ -48,11 +48,12 @@ export function createWebExperience(model, folderId, options, authentication) {
48
48
  model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary
49
49
  // Experiences store draft data in a resource attached to the item
50
50
  // We'll just use the published data for the first "draft"
51
+ // changed from stringToBlob to objectToJsonBlob for issue #742
51
52
  const draftResourceModel = cloneObject(model.data);
52
53
  resources.push({
53
54
  name: "config.json",
54
55
  prefix: "config",
55
- file: stringToBlob(JSON.stringify(draftResourceModel))
56
+ file: objectToJsonBlob(draftResourceModel)
56
57
  });
57
58
  // there may also be this image resources list
58
59
  const imageListModel = cloneObject(model.properties.imageResourcesList);
@@ -1 +1 @@
1
- {"version":3,"file":"create-web-experience.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAEL,WAAW,EACX,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,YAAY,EACb,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,UAAU,EACV,UAAU,EACV,eAAe,EAIf,Q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AC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC,CAAC;QACF,gBAAgB;QAChB,oDAAoD;QACpD,gFAAgF;QAChF,KAAK;SACJ,IAAI,CAAC,GAAG,EAAE;QACT,UAAU;QACV,OAAO,QAAQ,CAAC;YACd,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;YACrB,QAAQ;YACR,cAAc;SACf,CAAC,CAAC;IACL,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,EAAE;QACT,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CACL,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"create-web-experience.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAEL,WAAW,EACX,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EACL,UAAU,EACV,UAAU,EACV,eAAe,EAIf,QAAQ,EACT,MAAM,0BAA0B,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,QAAgB,EAChB,OAAY,EACZ,cAA2B;IAE3B,MAAM,SAAS,GAAU,EAAE,CAAC;IAE5B,kEAAkE;IAClE,sCAAsC;IACtC,MAAM,aAAa,GAAuB;QACxC,oBAAoB;QACpB,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;QAC3B,cAAc;KACf,CAAC;IAEF,0BAA0B;IAC1B,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE;QACxB,aAAa,CAAC,MAAM,GAAG;YACrB,+FAA+F;YAC/F,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS;SAChC,CAAC;QACF,OAAO,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC;KACrC;IAED,kBAAkB;IAClB,OAAO,CACL,UAAU,CAAC,aAAa,CAAC;SACtB,IAAI,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AU,CAAC,aAAa,CAAC;YACzB,cAAc,CAAC,WAAW,EAAE;SAC7B,CAAC,CAAC;IACL,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,SAAgB,EAAE,EAAE;QACzB,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QAC9B,MAAM,uBAAuB,GAAG,QAAQ,CAAC,eAAe,EAAE;YACxD,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QACH,uCAAuC;QACvC,MAAM,sBAAsB,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CACtD,uBAAuB,CAAC;YACtB,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;YACjB,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ,CAAC,IAAI;YACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,cAAc;SACf,CAAC,CACH,CAAC;QACF,kBAAkB;QAClB,OAAO,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC,CAAC;QACF,gBAAgB;QAChB,oDAAoD;QACpD,gFAAgF;QAChF,KAAK;SACJ,IAAI,CAAC,GAAG,EAAE;QACT,UAAU;QACV,OAAO,QAAQ,CAAC;YACd,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;YACrB,QAAQ;YACR,cAAc;SACf,CAAC,CAAC;IACL,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,EAAE;QACT,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CACL,CAAC;AACJ,CAAC"}
@@ -24,10 +24,11 @@ import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTempl
24
24
  *
25
25
  * @param solutionItemId
26
26
  * @param itemInfo
27
- * @param authentication
27
+ * @param destAuthentication Credentials for requests to the destination organization
28
+ * @param srcAuthentication Credentials for requests to source items
28
29
  * @param isGroup
29
30
  */
30
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, authentication: UserSession): Promise<IItemTemplate>;
31
+ export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
31
32
  /**
32
33
  * Create a Web Experience from a Template
33
34
  *
@@ -29,17 +29,18 @@ import { convertWebExperienceToTemplate } from "./helpers/convert-web-experience
29
29
  *
30
30
  * @param solutionItemId
31
31
  * @param itemInfo
32
- * @param authentication
32
+ * @param destAuthentication Credentials for requests to the destination organization
33
+ * @param srcAuthentication Credentials for requests to source items
33
34
  * @param isGroup
34
35
  */
35
- export function convertItemToTemplate(solutionItemId, itemInfo, authentication) {
36
+ export function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
36
37
  // use the itemInfo to setup a model
37
38
  const model = {
38
39
  item: itemInfo,
39
40
  data: {}
40
41
  };
41
42
  // fetch the data.json
42
- return getItemData(itemInfo.id, { authentication }).then(data => {
43
+ return getItemData(itemInfo.id, { authentication: srcAuthentication }).then(data => {
43
44
  // append into the model
44
45
  model.data = data;
45
46
  // and use that to create a template
@@ -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,EAKnB,6BAA6B,EAC7B,gCAAgC,EACjC,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,CACn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A0B,EAC1B,kBAAuB,EACvB,cAA2B;IAE3B,OAAO,gCAAgC,CACrC,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf,CAAC;AACJ,CAAC"}
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,EAKnB,6BAA6B,EAC7B,gCAAgC,EACjC,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;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAA+B,EAC/B,iBAA8B;IAE9B,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,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACjF,wBAAwB;QACxB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAClB,oCAAoC;QACpC,OAAO,8BAA8B,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAAuB,EACvB,kBAAuB,EACvB,yBAAsC,EACtC,oBAA2C;IAE3C,gDAAgD;IAChD,MAAM,WAAW,GAAG,oBAA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C,EAAE;gBACpB,cAAc,EAAE,yBAAyB;aAC1C,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBACX,OAAO,OAAO,CAAC,OAAO,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YACvE,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,kDAAkD;YAClD,MAAM,QAAQ,GAAoC;gBAChD,IAAI,EAAE;oBACJ,GAAG,QAAQ;oBACX,GAAG,QAAQ;iBACZ;gBACD,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACpB,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,WAAW,EAAE,KAAK;aACnB,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,OAAO,QAAQ,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;;;;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"}
@@ -33,7 +33,12 @@ function convertWebExperienceToTemplate(model) {
33
33
  tmpl.key = `${(0, hub_common_1.propifyString)(model.item.title)}_${(0, hub_common_1.createId)("i")}`;
34
34
  const clone = (0, hub_common_1.cloneObject)(model);
35
35
  tmpl.data = clone.data;
36
+ // We need to save these properties in order to restore them after hub.js deletes them
37
+ const created = clone.item.created;
38
+ const modified = clone.item.modified;
36
39
  tmpl.item = (0, hub_common_1.normalizeSolutionTemplateItem)(clone.item);
40
+ tmpl.item.created = created;
41
+ tmpl.item.modified = modified;
37
42
  // templatize the url. This is updated during the createModelFromTemplate phase
38
43
  // of the deployment process
39
44
  tmpl.item.url = "{{experienceUrlTemplate}}";
@@ -1 +1 @@
1
- {"version":3,"file":"convert-web-experience-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-web-experience-to-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAM0B;AAE1B,2DAG+B;AAE/B,uFAAiF;AAEjF;;;;;;;;GAQG;AACH,SAAgB,8BAA8B,CAC5C,KAAa;IAEb,MAAM,IAAI,GAAG,IAAA,2CAAyB,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,GAAG,GAAG,GAAG,IAAA,0BAAa,EAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAA,qBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC;IAEjE,MAAM,KAAK,GAAG,IAAA,wBAAW,EAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACvB,IAAI,CAAC,IAAI,GAAG,IAAA,0CAA6B,EAAC,KAAK,CAAC,IAAI,CAAU,CAAC;IAC/D,+EAA+E;IAC/E,4BAA4B;IAC5B,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,2BAA2B,CAAC;IAE5C,uFAAuF;IACvF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;IAC5C,IAAI,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QAC9C,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAC/C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,aAAa,CAAC,CAC9D,CAAC;KACH;IAED,IAAI,CAAC,YAAY,GAAG,IAAA,8DAA4B,EAAC,KAAK,CAAC,CAAC;IAExD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,kEAAkE;IAClE,8EAA8E;IAC9E,wDAAwD;IACxD,yDAAyD;IACzD,uDAAuD;IACvD,0BAA0B;IAC1B,+DAA+D;IAC/D,iCAAiC;IACjC,yDAAyD;IACzD,mBAAmB;IACnB,QAAQ;AACV,CAAC;AAnCD,wEAmCC;AAED,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,aAAa,GAAG,iBAAiB,CAAC"}
1
+ {"version":3,"file":"convert-web-experience-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-web-experience-to-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAM0B;AAE1B,2DAG+B;AAE/B,uFAAiF;AAEjF;;;;;;;;GAQG;AACH,SAAgB,8BAA8B,CAC5C,KAAa;IAEb,MAAM,IAAI,GAAG,IAAA,2CAAyB,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,GAAG,GAAG,GAAG,IAAA,0BAAa,EAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAA,qBAAQ,EAAC,GAAG,CAAC,EAAE,CAAC;IAEjE,MAAM,KAAK,GAAG,IAAA,wBAAW,EAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IAEvB,sFAAsF;IACtF,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;IACnC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;IACrC,IAAI,CAAC,IAAI,GAAG,IAAA,0CAA6B,EAAC,KAAK,CAAC,IAAI,CAAU,CAAC;IAC/D,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC5B,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE9B,+EAA+E;IAC/E,4BAA4B;IAC5B,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,2BAA2B,CAAC;IAE5C,uFAAuF;IACvF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;IAC5C,IAAI,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE;QAC9C,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAC/C,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,aAAa,CAAC,CAC9D,CAAC;KACH;IAED,IAAI,CAAC,YAAY,GAAG,IAAA,8DAA4B,EAAC,KAAK,CAAC,CAAC;IAExD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,kEAAkE;IAClE,8EAA8E;IAC9E,wDAAwD;IACxD,yDAAyD;IACzD,uDAAuD;IACvD,0BAA0B;IAC1B,+DAA+D;IAC/D,iCAAiC;IACjC,yDAAyD;IACzD,mBAAmB;IACnB,QAAQ;AACV,CAAC;AA1CD,wEA0CC;AAED,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,aAAa,GAAG,iBAAiB,CAAC"}
@@ -51,11 +51,12 @@ function createWebExperience(model, folderId, options, authentication) {
51
51
  model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary
52
52
  // Experiences store draft data in a resource attached to the item
53
53
  // We'll just use the published data for the first "draft"
54
+ // changed from stringToBlob to objectToJsonBlob for issue #742
54
55
  const draftResourceModel = (0, hub_common_1.cloneObject)(model.data);
55
56
  resources.push({
56
57
  name: "config.json",
57
58
  prefix: "config",
58
- file: (0, hub_common_1.stringToBlob)(JSON.stringify(draftResourceModel))
59
+ file: (0, hub_common_1.objectToJsonBlob)(draftResourceModel)
59
60
  });
60
61
  // there may also be this image resources list
61
62
  const imageListModel = (0, hub_common_1.cloneObject)(model.properties.imageResourcesList);
@@ -1 +1 @@
1
- {"version":3,"file":"create-web-experience.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,iDAO0B;AAI1B,iEAQkC;AAElC;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,KAAa,EACb,QAAgB,EAChB,OAAY,EACZ,cAA2B;IAE3B,MAAM,SAAS,GAAU,EAAE,CAAC;IAE5B,kEAAkE;IAClE,sCAAsC;IACtC,MAAM,aAAa,GAAuB;QACxC,oBAAoB;QACpB,IAAI,EAAE,IAAA,2BAAc,EAAC,KAAK,CAAC;QAC3B,cAAc;KACf,CAAC;IAEF,0BAA0B;IAC1B,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE;QACxB,aAAa,CAAC,MAAM,GAAG;YACrB,+FAA+F;YAC/F,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS;SAChC,CAAC;QACF,OAAO,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC;KACrC;IAED,kBAAkB;IAClB,OAAO,CACL,IAAA,+BAAU,EAAC,aAAa,CAAC;SACtB,IAAI,CAAC,CAAC,cAAmC,EAAE,EAAE;QAC5C,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,cAAc,CAAC,EAAE,CAAC;QAElC,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;QAC5C,KAAK,GAAG,IAAA,8BAAiB,EAAC,KAAK,CAAC,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,cAAc,CAAC,CAAC,yCAAyC;QAEhF,kEAAkE;QAClE,0DAA0D;QAC1D,MAAM,kBAAkB,GAAG,IAAA,wBAAW,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnD,SAAS,CAAC,IAAI,CAAC;YACb,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,IAAA,yB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E;YACjB,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ,CAAC,IAAI;YACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,cAAc;SACf,CAAC,CACH,CAAC;QACF,kBAAkB;QAClB,OAAO,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC,CAAC;QACF,gBAAgB;QAChB,oDAAoD;QACpD,gFAAgF;QAChF,KAAK;SACJ,IAAI,CAAC,GAAG,EAAE;QACT,UAAU;QACV,OAAO,IAAA,6BAAQ,EAAC;YACd,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;YACrB,QAAQ;YACR,cAAc;SACf,CAAC,CAAC;IACL,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,EAAE;QACT,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CACL,CAAC;AACJ,CAAC;AA3GD,kDA2GC"}
1
+ {"version":3,"file":"create-web-experience.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,iDAQ0B;AAI1B,iEAQkC;AAElC;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,KAAa,EACb,QAAgB,EAChB,OAAY,EACZ,cAA2B;IAE3B,MAAM,SAAS,GAAU,EAAE,CAAC;IAE5B,kEAAkE;IAClE,sCAAsC;IACtC,MAAM,aAAa,GAAuB;QACxC,oBAAoB;QACpB,IAAI,EAAE,IAAA,2BAAc,EAAC,KAAK,CAAC;QAC3B,cAAc;KACf,CAAC;IAEF,0BAA0B;IAC1B,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE;QACxB,aAAa,CAAC,MAAM,GAAG;YACrB,+FAA+F;YAC/F,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS;SAChC,CAAC;QACF,OAAO,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC;KACr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exports.WebExperienceProcessor = void 0;
19
- const WebExperienceProcessor = require("./web-experience-processor");
19
+ const tslib_1 = require("tslib");
20
+ const WebExperienceProcessor = (0, tslib_1.__importStar)(require("./web-experience-processor"));
20
21
  exports.WebExperienceProcessor = WebExperienceProcessor;
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,qEAAqE;AAE5D,wDAAsB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,gGAAqE;AAE5D,wDAAsB"}
@@ -24,10 +24,11 @@ import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTempl
24
24
  *
25
25
  * @param solutionItemId
26
26
  * @param itemInfo
27
- * @param authentication
27
+ * @param destAuthentication Credentials for requests to the destination organization
28
+ * @param srcAuthentication Credentials for requests to source items
28
29
  * @param isGroup
29
30
  */
30
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, authentication: UserSession): Promise<IItemTemplate>;
31
+ export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
31
32
  /**
32
33
  * Create a Web Experience from a Template
33
34
  *
@@ -32,17 +32,18 @@ const convert_web_experience_to_template_1 = require("./helpers/convert-web-expe
32
32
  *
33
33
  * @param solutionItemId
34
34
  * @param itemInfo
35
- * @param authentication
35
+ * @param destAuthentication Credentials for requests to the destination organization
36
+ * @param srcAuthentication Credentials for requests to source items
36
37
  * @param isGroup
37
38
  */
38
- function convertItemToTemplate(solutionItemId, itemInfo, authentication) {
39
+ function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
39
40
  // use the itemInfo to setup a model
40
41
  const model = {
41
42
  item: itemInfo,
42
43
  data: {}
43
44
  };
44
45
  // fetch the data.json
45
- return (0, arcgis_rest_portal_1.getItemData)(itemInfo.id, { authentication }).then(data => {
46
+ return (0, arcgis_rest_portal_1.getItemData)(itemInfo.id, { authentication: srcAuthentication }).then(data => {
46
47
  // append into the model
47
48
  model.data = data;
48
49
  // and use that to create a template
@@ -1 +1 @@
1
- {"version":3,"file":"web-experience-processor.js","sourceRoot":"","sources":["../../src/web-experience-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,2DAS+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,oBAA2C;IAE3C,gDAAgD;IAChD,MAAM,WAAW,GAAG,oBAAoB,CACtC,QAAQ,CAAC,MAAM,EACf,qCAAmB,CAAC,OAAO,EAC3B,CAAC,CACF,CAAC;IAEF,6CAA6C;IAC7C,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAA,+CAA6B,EAAC,QAAQ,CAAC,IAAI,CAAC,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CAAC,CAAC,CAAC;SACJ;aAAM;YACL,kDAAkD;YAClD,MAAM,QAAQ,GAAoC;gBAChD,IAAI,EAAE;oBACJ,GAAG,QAAQ;oBACX,GAAG,QAAQ;iBACZ;gBACD,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACpB,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,WAAW,EAAE,KAAK;aACnB,CAAC;YACF,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACxC,OAAO,QAAQ,CAAC;SACjB;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AA1ED,wDA0EC;AAED;;;;;;;;;GASG;AACH,SAAgB,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAAuB,EACvB,SAA0B,EAC1B,kBAAuB,EACvB,cAA2B;IAE3B,OAAO,IAAA,kDAAgC,EACrC,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf,CAAC;AACJ,CAAC;AAdD,kCAcC"}
1
+ {"version":3,"file":"web-experience-processor.js","sourceRoot":"","sources":["../../src/web-experience-processor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,2DAS+B;AAC/B,iDAAoD;AACpD,iEAAmE;AACnE,mHAA2G;AAC3G,2EAAsE;AACtE,qGAA8F;AAE9F;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAA+B,EAC/B,iBAA8B;IAE9B,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,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QACjF,wBAAwB;QACxB,KAAK,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emId
26
26
  * @param itemInfo
27
- * @param authentication
27
+ * @param destAuthentication Credentials for requests to the destination organization
28
+ * @param srcAuthentication Credentials for requests to source items
28
29
  * @param isGroup
29
30
  */
30
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, authentication: UserSession): Promise<IItemTemplate>;
31
+ export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: UserSession, srcAuthentication: UserSession): Promise<IItemTemplate>;
31
32
  /**
32
33
  * Create a Web Experience from a Template
33
34
  *
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-web-experience - v1.1.4 - Apache-2.0
3
- * Copyright (c) 2018-2021 Esri, Inc.
4
- * Tue Oct 26 2021 15:16:00 GMT-0700 (Pacific Daylight Time)
2
+ * @esri/solution-web-experience - v1.3.1 - Apache-2.0
3
+ * Copyright (c) 2018-2022 Esri, Inc.
4
+ * Thu Feb 17 2022 10:46:24 GMT-0800 (Pacific Standard Time)
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -18,8 +18,8 @@
18
18
  (function (global, factory) {
19
19
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/solution-common'), require('@esri/hub-common'), require('@esri/arcgis-rest-portal')) :
20
20
  typeof define === 'function' && define.amd ? define(['exports', '@esri/solution-common', '@esri/hub-common', '@esri/arcgis-rest-portal'], factory) :
21
- (global = global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution, global.arcgisHub, global.arcgisRest));
22
- }(this, (function (exports, solutionCommon, hubCommon, arcgisRestPortal) { 'use strict';
21
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.arcgisSolution = global.arcgisSolution || {}, global.arcgisSolution, global.arcgisHub, global.arcgisRest));
22
+ })(this, (function (exports, solutionCommon, hubCommon, arcgisRestPortal) { 'use strict';
23
23
 
24
24
  /**
25
25
  * Returns the subdomain for an experience based on the api the session is
@@ -148,11 +148,12 @@
148
148
  model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary
149
149
  // Experiences store draft data in a resource attached to the item
150
150
  // We'll just use the published data for the first "draft"
151
+ // changed from stringToBlob to objectToJsonBlob for issue #742
151
152
  const draftResourceModel = hubCommon.cloneObject(model.data);
152
153
  resources.push({
153
154
  name: "config.json",
154
155
  prefix: "config",
155
- file: hubCommon.stringToBlob(JSON.stringify(draftResourceModel))
156
+ file: hubCommon.objectToJsonBlob(draftResourceModel)
156
157
  });
157
158
  // there may also be this image resources list
158
159
  const imageListModel = hubCommon.cloneObject(model.properties.imageResourcesList);
@@ -272,7 +273,12 @@
272
273
  tmpl.key = `${hubCommon.propifyString(model.item.title)}_${hubCommon.createId("i")}`;
273
274
  const clone = hubCommon.cloneObject(model);
274
275
  tmpl.data = clone.data;
276
+ // We need to save these properties in order to restore them after hub.js deletes them
277
+ const created = clone.item.created;
278
+ const modified = clone.item.modified;
275
279
  tmpl.item = hubCommon.normalizeSolutionTemplateItem(clone.item);
280
+ tmpl.item.created = created;
281
+ tmpl.item.modified = modified;
276
282
  // templatize the url. This is updated during the createModelFromTemplate phase
277
283
  // of the deployment process
278
284
  tmpl.item.url = "{{experienceUrlTemplate}}";
@@ -318,17 +324,18 @@
318
324
  *
319
325
  * @param solutionItemId
320
326
  * @param itemInfo
321
- * @param authentication
327
+ * @param destAuthentication Credentials for requests to the destination organization
328
+ * @param srcAuthentication Credentials for requests to source items
322
329
  * @param isGroup
323
330
  */
324
- function convertItemToTemplate(solutionItemId, itemInfo, authentication) {
331
+ function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication) {
325
332
  // use the itemInfo to setup a model
326
333
  const model = {
327
334
  item: itemInfo,
328
335
  data: {}
329
336
  };
330
337
  // fetch the data.json
331
- return arcgisRestPortal.getItemData(itemInfo.id, { authentication }).then(data => {
338
+ return arcgisRestPortal.getItemData(itemInfo.id, { authentication: srcAuthentication }).then(data => {
332
339
  // append into the model
333
340
  model.data = data;
334
341
  // and use that to create a template
@@ -417,5 +424,5 @@
417
424
 
418
425
  Object.defineProperty(exports, '__esModule', { value: true });
419
426
 
420
- })));
427
+ }));
421
428
  //# sourceMappingURL=web-experience.umd.js.map
@@ -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 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,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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;UACF,MAAM,WAAW,GAAG,oBAAoB,CACtC,QAAQ,CAAC,MAAM,EACfD,kCAAmB,CAAC,QAAQ,EAC5B,QAAQ,CAAC,6BAA6B,IAAI,CAAC,EAC3C,YAAY,CAAC,IAAI,CAAC,EAAE,CACrB,CAAC;UAEF,IAAI,CAAC,WAAW,EAAE;;cAEhB,MAAM,cAAc,GAAGV,kBAAQ,CAACY,2BAAU,EAAE,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;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
+ {"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 objectToJsonBlob\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 // changed from stringToBlob to objectToJsonBlob for issue #742\r\n const draftResourceModel = cloneObject(model.data);\r\n resources.push({\r\n name: \"config.json\",\r\n prefix: \"config\",\r\n file: objectToJsonBlob(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\r\n // We need to save these properties in order to restore them after hub.js deletes them\r\n const created = clone.item.created;\r\n const modified = clone.item.modified;\r\n tmpl.item = normalizeSolutionTemplateItem(clone.item) as IItem;\r\n tmpl.item.created = created;\r\n tmpl.item.modified = modified;\r\n\r\n // templatize the url. 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 destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param isGroup\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: UserSession,\r\n srcAuthentication: UserSession\r\n): Promise<IItemTemplate> {\r\n // 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: srcAuthentication }).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","objectToJsonBlob","stringToBlob","updateItem","failSafe","addItemResource","moveItem","getProp","maybePush","createPlaceholderTemplate","propifyString","createId","normalizeSolutionTemplateItem","getItemData","EItemProgressStatus","generateEmptyCreationResponse","removeItem","updateItemTemplateFromDictionary"],"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;;;;;;WAMgB,4BAA4B,CAC1C,cAA2B;MAE3B,IAAI,OAAO,GAAG,EAAE,CAAC;MAEjB,MAAM,SAAS,G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BAAkB,EAClB,cAAc,CACf,CAAC;EACJ;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-web-experience - v1.1.4 - Apache-2.0
3
- * Copyright (c) 2018-2021 Esri, Inc.
4
- * Tue Oct 26 2021 15:16:05 GMT-0700 (Pacific Daylight Time)
2
+ * @esri/solution-web-experience - v1.3.1 - Apache-2.0
3
+ * Copyright (c) 2018-2022 Esri, Inc.
4
+ * Thu Feb 17 2022 10:46:34 GMT-0800 (Pacific Standard Time)
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -15,5 +15,5 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common"),require("@esri/hub-common"),require("@esri/arcgis-rest-portal")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common","@esri/hub-common","@esri/arcgis-rest-portal"],t):t((e=e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution,e.arcgisHub,e.arcgisRest)}(this,(function(e,t,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})}));
18
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common"),require("@esri/hub-common"),require("@esri/arcgis-rest-portal")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common","@esri/hub-common","@esri/arcgis-rest-portal"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution,e.arcgisHub,e.arcgisRest)}(this,(function(e,t,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;const m=n.item.created,s=n.item.modified;r.item=i.normalizeSolutionTemplateItem(n.item),r.item.created=m,r.item.modified=s,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 m=Object.freeze({__proto__:null,convertItemToTemplate:function(e,t,i,o){const a={item:t,data:{}};return r.getItemData(t.id,{authentication:o}).then((e=>(a.data=e,n(a))))},createItemFromTemplate:function(e,n,o,a){if(!a(e.itemId,t.EItemProgressStatus.Started,0))return Promise.resolve(t.generateEmptyCreationResponse(e.type));let m;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=>(m=e,function(e,t,n,o){const a=[],m={item:i.serializeModel(e),authentication:o};return e.item.thumbnail&&(m.params={thumbnail:e.item.thumbnail},delete m.item.thumbnail),r.createItem(m).then((t=>{e.item.id=t.id;const n=e.item.thumbnail;(e=i.interpolateItemId(e)).item.thumbnail=n;const m=i.cloneObject(e.data);a.push({name:"config.json",prefix:"config",file:i.objectToJsonBlob(m)});const s=i.cloneObject(e.properties.imageResourcesList);s&&a.push({name:"image-resources-list.json",prefix:"images",file:i.stringToBlob(JSON.stringify(s))}),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],m=i.failSafe(r.addItemResource,{success:!0}),s=a.map((t=>m({id:e.item.id,owner:n,resource:t.file,name:t.name,prefix:t.prefix,authentication:o})));return Promise.all(s)})).then((()=>r.moveItem({itemId:e.item.id,folderId:t,authentication:o}))).then((()=>e))}(e,n.folderId,0,o)))).then((s=>{m.item.id=s.item.id,m.item.url=s.item.url,n[e.itemId]={itemId:s.item.id};if(a(e.itemId,t.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor||2,s.item.id)){const t={item:{...e,...m},id:m.item.id,type:e.type,postProcess:!1};return t.item.itemId=m.item.id,t}return i.failSafe(r.removeItem,{success:!0})({id:m.item.id,authentication:o}).then((()=>Promise.resolve(t.generateEmptyCreationResponse(e.type))))}))},postProcess:function(e,i,r,n,o,a,m){return t.updateItemTemplateFromDictionary(e,a,m)}});e.WebExperienceProcessor=m,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 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","updateItemTemplate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"}
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\r\n // We need to save these properties in order to restore them after hub.js deletes them\r\n const created = clone.item.created;\r\n const modified = clone.item.modified;\r\n tmpl.item = normalizeSolutionTemplateItem(clone.item) as IItem;\r\n tmpl.item.created = created;\r\n tmpl.item.modified = modified;\r\n\r\n // templatize the url. 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 destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param isGroup\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: UserSession,\r\n srcAuthentication: UserSession\r\n): Promise<IItemTemplate> {\r\n // 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: srcAuthentication }).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 objectToJsonBlob\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 // changed from stringToBlob to objectToJsonBlob for issue #742\r\n const draftResourceModel = cloneObject(model.data);\r\n resources.push({\r\n name: \"config.json\",\r\n prefix: \"config\",\r\n file: objectToJsonBlob(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","created","modified","normalizeSolutionTemplateItem","url","typeKeywords","indexOf","changedTypeKW","publishedTypeKW","concat","filter","word","dependencies","dataSources","getProp","Object","keys","reduce","acc","maybePush","getWebExperienceDependencies","Promise","resolve","solutionItemId","itemInfo","destAuthentication","srcAuthentication","getItemData","authentication","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","objectToJsonBlob","imageListModel","properties","imageResourcesList","stringToBlob","JSON","stringify","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":";;;;;;;;;;;;;;;;;weAwCgBA,EACdC,GAEA,MAAMC,EAAOC,4BAA0BF,EAAMG,KAAKC,GAAIJ,EAAMG,KAAKE,MACjEJ,EAAKK,IAAM,GAAGC,gBAAcP,EAAMG,KAAKK,UAAUC,WAAS,OAE1D,MAAMC,EAAQC,cAAYX,GAC1BC,EAAKW,KAAOF,EAAME,KAGlB,MAAMC,EAAUH,EAAMP,KAAKU,QACrBC,EAAWJ,EAAMP,KAAKW,SAC5Bb,EAAKE,KAAOY,gCAA8BL,EAAMP,MAChDF,EAAKE,KAAKU,QAAUA,EACpBZ,EAAKE,KAAKW,SAAWA,EAIrBb,EAAKE,KAAKa,IAAM,4BAYhB,OAR6C,IADxBf,EAAKE,KAAKc,aACdC,QAAQC,KACvBlB,EAAKE,KAAKc,aAAe,CAACG,GAAiBC,OACzCpB,EAAKE,KAAKc,aAAaK,QAAOC,GAAQA,IAASJ,MAInDlB,EAAKuB,sBC5CsCxB,GAC3C,MAAMyB,EAAcC,UAAQ1B,EAAO,qBAAuB,GAC1D,OAAO2B,OAAOC,KAAKH,GAAaI,QAAO,CAACC,EAAKxB,IACpCyB,YAAUL,UAAQD,EAAa,GAAGnB,YAAewB,IACvD,IDwCiBE,CAA6BhC,GAE1CiC,QAAQC,QAAQjC,GAczB,MAAMmB,EAAkB,oBAClBD,EAAgB,qFErCpBgB,EACAC,EACAC,EACAC,GAGA,MAAMtC,EAAQ,CACZG,KAAMiC,EACNxB,KAAM,IAGR,OAAO2B,cAAYH,EAAShC,GAAI,CAAEoC,eAAgBF,IAAqBG,MAAK7B,IAE1EZ,EAAMY,KAAOA,EAENb,EAA+BC,uCAaxC0C,EACAC,EACAC,EACAC,GAUA,IAPoBA,EAClBH,EAASI,OACTC,sBAAoBC,QACpB,GAKA,OAAOf,QAAQC,QAAQe,gCAA8BP,EAASrC,O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CACpB3G,GAAI8C,EAAS/C,KAAKC,GAClBoC,eAAgBI,IACfH,MAAK,IACCR,QAAQC,QAAQe,gCAA8BP,EAASrC,kCA8BtEyC,EACAzC,EACA2G,EACAtE,EACAuE,EACAtE,EACAH,GAEA,OAAO0E,mCACLpE,EACAH,EACAH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-web-experience",
3
- "version": "1.1.4",
3
+ "version": "1.3.1",
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,29 +13,28 @@
13
13
  "dist/**"
14
14
  ],
15
15
  "devDependencies": {
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
- "rollup": "^1.22.0",
24
- "typescript": "^4.3.4"
16
+ "@esri/arcgis-rest-auth": "3.4.3",
17
+ "@esri/arcgis-rest-feature-layer": "3.4.3",
18
+ "@esri/arcgis-rest-portal": "3.4.3",
19
+ "@esri/arcgis-rest-request": "3.4.3",
20
+ "@esri/arcgis-rest-service-admin": "3.4.3",
21
+ "@esri/hub-common": "9.15.0",
22
+ "@esri/hub-initiatives": "9.15.0",
23
+ "rollup": "^2.60.0"
25
24
  },
26
25
  "peerDependencies": {
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"
26
+ "@esri/arcgis-rest-auth": "3.4.3",
27
+ "@esri/arcgis-rest-feature-layer": "3.4.3",
28
+ "@esri/arcgis-rest-portal": "3.4.3",
29
+ "@esri/arcgis-rest-request": "3.4.3",
30
+ "@esri/arcgis-rest-service-admin": "3.4.3",
31
+ "@esri/hub-common": "9.15.0",
32
+ "@esri/hub-initiatives": "9.15.0"
34
33
  },
35
34
  "dependencies": {
36
- "@esri/solution-common": "^1.1.4",
37
- "@esri/solution-simple-types": "^1.1.4",
38
- "tslib": "^1.13.0"
35
+ "@esri/solution-common": "^1.3.1",
36
+ "@esri/solution-simple-types": "^1.3.1",
37
+ "tslib": "1.13.0"
39
38
  },
40
39
  "scripts": {
41
40
  "prepare": "npm run build",
@@ -72,5 +71,5 @@
72
71
  "esri",
73
72
  "ES6"
74
73
  ],
75
- "gitHead": "85775515ebd9e68d836d60ea1aa99ebdcde7771e"
74
+ "gitHead": "70c45e0eb9c745f7dbc0f8b6ce3654921cca11a0"
76
75
  }