@esri/solution-web-experience 0.24.0 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/esm/helpers/convert-web-experience-to-template.js +7 -7
  2. package/dist/esm/helpers/convert-web-experience-to-template.js.map +1 -1
  3. package/dist/esm/helpers/create-web-experience-model-from-template.js +1 -1
  4. package/dist/esm/helpers/create-web-experience-model-from-template.js.map +1 -1
  5. package/dist/esm/helpers/create-web-experience.js +24 -26
  6. package/dist/esm/helpers/create-web-experience.js.map +1 -1
  7. package/dist/esm/helpers/get-experience-subdomain.js +2 -2
  8. package/dist/esm/helpers/get-experience-subdomain.js.map +1 -1
  9. package/dist/esm/helpers/get-web-experience-dependencies.js +3 -3
  10. package/dist/esm/helpers/get-web-experience-dependencies.js.map +1 -1
  11. package/dist/esm/helpers/get-web-experience-url-template.js +5 -5
  12. package/dist/esm/helpers/get-web-experience-url-template.js.map +1 -1
  13. package/dist/esm/web-experience-processor.d.ts +12 -1
  14. package/dist/esm/web-experience-processor.js +28 -13
  15. package/dist/esm/web-experience-processor.js.map +1 -1
  16. package/dist/node/helpers/convert-web-experience-to-template.js +12 -12
  17. package/dist/node/helpers/convert-web-experience-to-template.js.map +1 -1
  18. package/dist/node/helpers/create-web-experience-model-from-template.js +4 -4
  19. package/dist/node/helpers/create-web-experience-model-from-template.js.map +1 -1
  20. package/dist/node/helpers/create-web-experience.js +34 -36
  21. package/dist/node/helpers/create-web-experience.js.map +1 -1
  22. package/dist/node/helpers/get-experience-subdomain.js +2 -2
  23. package/dist/node/helpers/get-experience-subdomain.js.map +1 -1
  24. package/dist/node/helpers/get-web-experience-dependencies.js +4 -4
  25. package/dist/node/helpers/get-web-experience-dependencies.js.map +1 -1
  26. package/dist/node/helpers/get-web-experience-url-template.js +6 -6
  27. package/dist/node/helpers/get-web-experience-url-template.js.map +1 -1
  28. package/dist/node/index.js +1 -1
  29. package/dist/node/index.js.map +1 -1
  30. package/dist/node/web-experience-processor.d.ts +12 -1
  31. package/dist/node/web-experience-processor.js +40 -24
  32. package/dist/node/web-experience-processor.js.map +1 -1
  33. package/dist/umd/web-experience-processor.d.ts +12 -1
  34. package/dist/umd/web-experience.umd.js +391 -402
  35. package/dist/umd/web-experience.umd.js.map +1 -1
  36. package/dist/umd/web-experience.umd.min.js +3 -3
  37. package/dist/umd/web-experience.umd.min.js.map +1 -1
  38. package/package.json +19 -19
@@ -26,18 +26,18 @@ import { getWebExperienceDependencies } from "./get-web-experience-dependencies"
26
26
  * @param authentication
27
27
  */
28
28
  export function convertWebExperienceToTemplate(model) {
29
- var tmpl = createPlaceholderTemplate(model.item.id, model.item.type);
30
- tmpl.key = propifyString(model.item.title) + "_" + createId("i");
31
- var clone = cloneObject(model);
29
+ const tmpl = createPlaceholderTemplate(model.item.id, model.item.type);
30
+ tmpl.key = `${propifyString(model.item.title)}_${createId("i")}`;
31
+ const clone = cloneObject(model);
32
32
  tmpl.data = clone.data;
33
33
  tmpl.item = normalizeSolutionTemplateItem(clone.item);
34
34
  // templatize the url. This is updated during the createModelFromTemplate phase
35
35
  // of the deployment process
36
36
  tmpl.item.url = "{{experienceUrlTemplate}}";
37
37
  // use typeKeyword to mark item as published (we decided to discard unpublished drafts)
38
- var typeKeywords = tmpl.item.typeKeywords;
38
+ const typeKeywords = tmpl.item.typeKeywords;
39
39
  if (typeKeywords.indexOf(changedTypeKW) !== -1) {
40
- tmpl.item.typeKeywords = [publishedTypeKW].concat(tmpl.item.typeKeywords.filter(function (word) { return word !== changedTypeKW; }));
40
+ tmpl.item.typeKeywords = [publishedTypeKW].concat(tmpl.item.typeKeywords.filter(word => word !== changedTypeKW));
41
41
  }
42
42
  tmpl.dependencies = getWebExperienceDependencies(model);
43
43
  return Promise.resolve(tmpl);
@@ -53,6 +53,6 @@ export function convertWebExperienceToTemplate(model) {
53
53
  // return tmpl;
54
54
  // });
55
55
  }
56
- var publishedTypeKW = "status: Published";
57
- var changedTypeKW = "status: Changed";
56
+ const publishedTypeKW = "status: Published";
57
+ const changedTypeKW = "status: Changed";
58
58
  //# sourceMappingURL=convert-web-experience-to-template.js.map
@@ -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,IAAM,IAAI,GAAG,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,GAAG,GAAM,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAI,QAAQ,CAAC,GAAG,CAAG,CAAC;IAEjE,IAAM,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,IAAM,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,UAAA,IAAI,IAAI,OAAA,IAAI,KAAK,aAAa,EAAtB,CAAsB,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,IAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,IAAM,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,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"}
@@ -26,7 +26,7 @@ import { getWebExperiencepUrlTemplate } from "./get-web-experience-url-template"
26
26
  export function createWebExperienceModelFromTemplate(templateModel, settings, transforms, authentication) {
27
27
  // get the experience base url
28
28
  settings.experienceUrlTemplate = getWebExperiencepUrlTemplate(authentication);
29
- var model = interpolate(templateModel, settings, transforms);
29
+ const model = interpolate(templateModel, settings, transforms);
30
30
  // ensure this is set - there may be some templates w/o `{{experienceTemplateUrl}}
31
31
  model.item.url = settings.experienceUrlTemplate;
32
32
  /* istanbul ignore else */
@@ -1 +1 @@
1
- {"version":3,"file":"create-web-experience-model-from-template.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience-model-from-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF;;;;;;;GAOG;AACH,MAAM,UAAU,oCAAoC,CAClD,aAA6B,EAC7B,QAAa,EACb,UAAe,EACf,cAA2B;IAE3B,8BAA8B;IAC9B,QAAQ,CAAC,qBAAqB,GAAG,4BAA4B,CAAC,cAAc,CAAC,CAAC;IAC9E,IAAM,KAAK,GAAG,WAAW,CAAC,aAAa,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/D,kFAAkF;IAClF,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,qBAAqB,CAAC;IAChD,0BAA0B;IAC1B,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE;QAChC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,yCAAyC;KAC/F;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"create-web-experience-model-from-template.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience-model-from-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAE/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF;;;;;;;GAOG;AACH,MAAM,UAAU,oCAAoC,CAClD,aAA6B,EAC7B,QAAa,EACb,UAAe,EACf,cAA2B;IAE3B,8BAA8B;IAC9B,QAAQ,CAAC,qBAAqB,GAAG,4BAA4B,CAAC,cAAc,CAAC,CAAC;IAC9E,MAAM,KAAK,GAAG,WAAW,CAAC,aAAa,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/D,kFAAkF;IAClF,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,qBAAqB,CAAC;IAChD,0BAA0B;IAC1B,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE;QAChC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,yCAAyC;KAC/F;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
@@ -23,13 +23,13 @@ import { createItem, updateItem, addItemResource, moveItem } from "@esri/arcgis-
23
23
  * @param authentication
24
24
  */
25
25
  export function createWebExperience(model, folderId, options, authentication) {
26
- var resources = [];
26
+ const resources = [];
27
27
  // For unkown reasons we can not seem to spy on createItemInFolder
28
28
  // so we will create-then-move for now
29
- var createOptions = {
29
+ const createOptions = {
30
30
  // need to serialize
31
31
  item: serializeModel(model),
32
- authentication: authentication
32
+ authentication
33
33
  };
34
34
  /* istanbul ignore else */
35
35
  if (model.item.thumbnail) {
@@ -41,21 +41,21 @@ export function createWebExperience(model, folderId, options, authentication) {
41
41
  }
42
42
  // Create the item
43
43
  return (createItem(createOptions)
44
- .then(function (createResponse) {
44
+ .then((createResponse) => {
45
45
  model.item.id = createResponse.id;
46
- var savedThumbnail = model.item.thumbnail;
46
+ const savedThumbnail = model.item.thumbnail;
47
47
  model = interpolateItemId(model);
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
- var draftResourceModel = cloneObject(model.data);
51
+ const draftResourceModel = cloneObject(model.data);
52
52
  resources.push({
53
53
  name: "config.json",
54
54
  prefix: "config",
55
55
  file: stringToBlob(JSON.stringify(draftResourceModel))
56
56
  });
57
57
  // there may also be this image resources list
58
- var imageListModel = cloneObject(model.properties.imageResourcesList);
58
+ const imageListModel = cloneObject(model.properties.imageResourcesList);
59
59
  if (imageListModel) {
60
60
  resources.push({
61
61
  name: "image-resources-list.json",
@@ -65,9 +65,9 @@ export function createWebExperience(model, folderId, options, authentication) {
65
65
  }
66
66
  delete model.properties;
67
67
  // update the experience with the newly interpolated model
68
- var updateOptions = {
68
+ const updateOptions = {
69
69
  item: serializeModel(model),
70
- authentication: authentication
70
+ authentication
71
71
  };
72
72
  if (model.item.thumbnail) {
73
73
  updateOptions.params = {
@@ -81,22 +81,20 @@ export function createWebExperience(model, folderId, options, authentication) {
81
81
  authentication.getUsername()
82
82
  ]);
83
83
  })
84
- .then(function (responses) {
85
- var username = responses[1];
86
- var failSafeAddItemResource = failSafe(addItemResource, {
84
+ .then((responses) => {
85
+ const username = responses[1];
86
+ const failSafeAddItemResource = failSafe(addItemResource, {
87
87
  success: true
88
88
  });
89
89
  // upload the data and oembed resources
90
- var resourceUploadPromises = resources.map(function (resource) {
91
- return failSafeAddItemResource({
92
- id: model.item.id,
93
- owner: username,
94
- resource: resource.file,
95
- name: resource.name,
96
- prefix: resource.prefix,
97
- authentication: authentication
98
- });
99
- });
90
+ const resourceUploadPromises = resources.map(resource => failSafeAddItemResource({
91
+ id: model.item.id,
92
+ owner: username,
93
+ resource: resource.file,
94
+ name: resource.name,
95
+ prefix: resource.prefix,
96
+ authentication
97
+ }));
100
98
  // fire and forget
101
99
  return Promise.all(resourceUploadPromises);
102
100
  })
@@ -104,15 +102,15 @@ export function createWebExperience(model, folderId, options, authentication) {
104
102
  // // TODO: Can we leave this to the main process?
105
103
  // return uploadResourcesFromUrl(model, options.assets || [], authentication);
106
104
  // })
107
- .then(function () {
105
+ .then(() => {
108
106
  // Move it
109
107
  return moveItem({
110
108
  itemId: model.item.id,
111
- folderId: folderId,
112
- authentication: authentication
109
+ folderId,
110
+ authentication
113
111
  });
114
112
  })
115
- .then(function () {
113
+ .then(() => {
116
114
  return model;
117
115
  }));
118
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-web-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AC,IAAI,CAAC,EAAE;gBACjB,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ,CAAC,IAAI;gBACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,cAAc,gBAAA;aACf,CAAC;QAPF,CAOE,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;QACJ,UAAU;QACV,OAAO,QAAQ,CAAC;YACd,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;YACrB,QAAQ,UAAA;YACR,cAAc,gBAAA;SACf,CAAC,CAAC;IACL,CAAC,CAAC;SACD,IAAI,CAAC;QACJ,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,EACb,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,EAA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AACJ,CAAC"}
@@ -5,9 +5,9 @@
5
5
  * @param authentication UserSession
6
6
  */
7
7
  export function getExperienceSubdomain(authentication) {
8
- var portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
8
+ const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
9
9
  // TODO: Sort out how we locate experiences on portal?
10
- var result;
10
+ let result;
11
11
  if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
12
12
  result = "experienceqa";
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-experience-subdomain.js","sourceRoot":"","sources":["../../../src/helpers/get-experience-subdomain.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,cAA2B;IAChE,IAAM,SAAS,GACb,cAAc,CAAC,MAAM,IAAI,qCAAqC,CAAC;IACjE,sDAAsD;IACtD,IAAI,MAAM,CAAC;IACX,IAAI,SAAS,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;QACnD,MAAM,GAAG,cAAc,CAAC;KACzB;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE;QAC/D,MAAM,GAAG,eAAe,CAAC;KAC1B;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE;QACtD,MAAM,GAAG,YAAY,CAAC;KACvB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"get-experience-subdomain.js","sourceRoot":"","sources":["../../../src/helpers/get-experience-subdomain.ts"],"names":[],"mappings":"AAiBA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,cAA2B;IAChE,MAAM,SAAS,GACb,cAAc,CAAC,MAAM,IAAI,qCAAqC,CAAC;IACjE,sDAAsD;IACtD,IAAI,MAAM,CAAC;IACX,IAAI,SAAS,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;QACnD,MAAM,GAAG,cAAc,CAAC;KACzB;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE;QAC/D,MAAM,GAAG,eAAe,CAAC;KAC1B;SAAM,IAAI,SAAS,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE;QACtD,MAAM,GAAG,YAAY,CAAC;KACvB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -21,9 +21,9 @@ import { getProp, maybePush } from "@esri/hub-common";
21
21
  * @param model IModel
22
22
  */
23
23
  export function getWebExperienceDependencies(model) {
24
- var dataSources = getProp(model, "data.dataSources") || {};
25
- return Object.keys(dataSources).reduce(function (acc, key) {
26
- return maybePush(getProp(dataSources, key + ".itemId"), acc);
24
+ const dataSources = getProp(model, "data.dataSources") || {};
25
+ return Object.keys(dataSources).reduce((acc, key) => {
26
+ return maybePush(getProp(dataSources, `${key}.itemId`), acc);
27
27
  }, []);
28
28
  }
29
29
  //# sourceMappingURL=get-web-experience-dependencies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-web-experience-dependencies.js","sourceRoot":"","sources":["../../../src/helpers/get-web-experience-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAU,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAa;IACxD,IAAM,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,GAAG;QAC9C,OAAO,SAAS,CAAC,OAAO,CAAC,WAAW,EAAK,GAAG,YAAS,CAAC,EAAE,GAAG,CAAC,CAAC;IAC/D,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
1
+ {"version":3,"file":"get-web-experience-dependencies.js","sourceRoot":"","sources":["../../../src/helpers/get-web-experience-dependencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAU,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAAa;IACxD,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QAClD,OAAO,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,GAAG,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;IAC/D,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
@@ -6,16 +6,16 @@ import { getExperienceSubdomain } from "./get-experience-subdomain";
6
6
  * @param authentication
7
7
  */
8
8
  export function getWebExperiencepUrlTemplate(authentication) {
9
- var baseUrl = "";
10
- var subdomain = getExperienceSubdomain(authentication);
9
+ let baseUrl = "";
10
+ const subdomain = getExperienceSubdomain(authentication);
11
11
  if (subdomain) {
12
- baseUrl = "https://" + subdomain + ".arcgis.com/experience/{{appid}}";
12
+ baseUrl = `https://${subdomain}.arcgis.com/experience/{{appid}}`;
13
13
  }
14
14
  else {
15
15
  // we're on portal
16
16
  // chop off the /sharing/rest to get the baseUrl
17
- var portalBaseUrl = authentication.portal.replace("/sharing/rest", "");
18
- baseUrl = portalBaseUrl + "/apps/experiencebuilder/?id={{appid}}";
17
+ const portalBaseUrl = authentication.portal.replace("/sharing/rest", "");
18
+ baseUrl = `${portalBaseUrl}/apps/experiencebuilder/?id={{appid}}`;
19
19
  }
20
20
  return baseUrl;
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-web-experience-url-template.js","sourceRoot":"","sources":["../../../src/helpers/get-web-experience-url-template.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,cAA2B;IAE3B,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,IAAM,SAAS,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACzD,IAAI,SAAS,EAAE;QACb,OAAO,GAAG,aAAW,SAAS,qCAAkC,CAAC;KAClE;SAAM;QACL,kBAAkB;QAClB,gDAAgD;QAChD,IAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QACzE,OAAO,GAAM,aAAa,0CAAuC,CAAC;KACnE;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"get-web-experience-url-template.js","sourceRoot":"","sources":["../../../src/helpers/get-web-experience-url-template.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,cAA2B;IAE3B,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,MAAM,SAAS,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACzD,IAAI,SAAS,EAAE;QACb,OAAO,GAAG,WAAW,SAAS,kCAAkC,CAAC;KAClE;SAAM;QACL,kBAAkB;QAClB,gDAAgD;QAChD,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QACzE,OAAO,GAAG,GAAG,aAAa,uCAAuC,CAAC;KACnE;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * @module solution-web-experience
20
20
  */
21
- import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse } from "@esri/solution-common";
21
+ import { UserSession, IItemProgressCallback, IItemTemplate, ICreateItemFromTemplateResponse, IUpdateItemResponse } from "@esri/solution-common";
22
22
  /**
23
23
  * Convert a Web Experience item into a Template
24
24
  *
@@ -37,3 +37,14 @@ export declare function convertItemToTemplate(solutionItemId: string, itemInfo:
37
37
  * @param itemProgressCallback
38
38
  */
39
39
  export declare function createItemFromTemplate(template: IItemTemplate, templateDictionary: any, destinationAuthentication: UserSession, itemProgressCallback: IItemProgressCallback): Promise<ICreateItemFromTemplateResponse>;
40
+ /**
41
+ * Post-Process an Experience
42
+ *
43
+ * @param {string} itemId The item ID
44
+ * @param {string} type The template type
45
+ * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
46
+ * @param {any} templateDictionary The template dictionary
47
+ * @param {UserSession} authentication The destination session info
48
+ * @returns Promise resolving to successfulness of update
49
+ */
50
+ export declare function postProcess(itemId: string, type: string, itemInfos: any[], template: IItemTemplate, templates: IItemTemplate[], templateDictionary: any, authentication: UserSession): Promise<IUpdateItemResponse>;
@@ -13,13 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { __assign } from "tslib";
17
16
  /**
18
17
  * Manages the creation and deployment of web-experience item types.
19
18
  *
20
19
  * @module solution-web-experience
21
20
  */
22
- import { EItemProgressStatus, generateEmptyCreationResponse } from "@esri/solution-common";
21
+ import { EItemProgressStatus, generateEmptyCreationResponse, updateItemTemplateFromDictionary } from "@esri/solution-common";
23
22
  import { failSafe } from "@esri/hub-common";
24
23
  import { getItemData, removeItem } from "@esri/arcgis-rest-portal";
25
24
  import { createWebExperienceModelFromTemplate } from "./helpers/create-web-experience-model-from-template";
@@ -35,12 +34,12 @@ import { convertWebExperienceToTemplate } from "./helpers/convert-web-experience
35
34
  */
36
35
  export function convertItemToTemplate(solutionItemId, itemInfo, authentication) {
37
36
  // use the itemInfo to setup a model
38
- var model = {
37
+ const model = {
39
38
  item: itemInfo,
40
39
  data: {}
41
40
  };
42
41
  // fetch the data.json
43
- return getItemData(itemInfo.id, { authentication: authentication }).then(function (data) {
42
+ return getItemData(itemInfo.id, { authentication }).then(data => {
44
43
  // append into the model
45
44
  model.data = data;
46
45
  // and use that to create a template
@@ -57,18 +56,18 @@ export function convertItemToTemplate(solutionItemId, itemInfo, authentication)
57
56
  */
58
57
  export function createItemFromTemplate(template, templateDictionary, destinationAuthentication, itemProgressCallback) {
59
58
  // let the progress system know we've started...
60
- var startStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Started, 0);
59
+ const startStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Started, 0);
61
60
  // and if it returned false, just resolve out
62
61
  if (!startStatus) {
63
62
  return Promise.resolve(generateEmptyCreationResponse(template.type));
64
63
  }
65
- var exbModel;
64
+ let exbModel;
66
65
  return createWebExperienceModelFromTemplate(template, templateDictionary, {}, destinationAuthentication)
67
- .then(function (model) {
66
+ .then(model => {
68
67
  exbModel = model;
69
68
  return createWebExperience(model, templateDictionary.folderId, {}, destinationAuthentication);
70
69
  })
71
- .then(function (createdModel) {
70
+ .then(createdModel => {
72
71
  exbModel.item.id = createdModel.item.id;
73
72
  exbModel.item.url = createdModel.item.url;
74
73
  // Update the template dictionary
@@ -77,21 +76,24 @@ export function createItemFromTemplate(template, templateDictionary, destination
77
76
  templateDictionary[template.itemId] = {
78
77
  itemId: createdModel.item.id
79
78
  };
80
- var finalStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, createdModel.item.id);
79
+ const finalStatus = itemProgressCallback(template.itemId, EItemProgressStatus.Finished, template.estimatedDeploymentCostFactor || 2, createdModel.item.id);
81
80
  if (!finalStatus) {
82
81
  // clean up the site we just created
83
- var failSafeRemove = failSafe(removeItem, { success: true });
82
+ const failSafeRemove = failSafe(removeItem, { success: true });
84
83
  return failSafeRemove({
85
84
  id: exbModel.item.id,
86
85
  authentication: destinationAuthentication
87
- }).then(function () {
86
+ }).then(() => {
88
87
  return Promise.resolve(generateEmptyCreationResponse(template.type));
89
88
  });
90
89
  }
91
90
  else {
92
91
  // finally, return ICreateItemFromTemplateResponse
93
- var response = {
94
- item: __assign(__assign({}, template), exbModel),
92
+ const response = {
93
+ item: {
94
+ ...template,
95
+ ...exbModel
96
+ },
95
97
  id: exbModel.item.id,
96
98
  type: template.type,
97
99
  postProcess: false
@@ -101,4 +103,17 @@ export function createItemFromTemplate(template, templateDictionary, destination
101
103
  }
102
104
  });
103
105
  }
106
+ /**
107
+ * Post-Process an Experience
108
+ *
109
+ * @param {string} itemId The item ID
110
+ * @param {string} type The template type
111
+ * @param {any[]} itemInfos Array of {id: 'ef3', type: 'Web Map'} objects
112
+ * @param {any} templateDictionary The template dictionary
113
+ * @param {UserSession} authentication The destination session info
114
+ * @returns Promise resolving to successfulness of update
115
+ */
116
+ export function postProcess(itemId, type, itemInfos, template, templates, templateDictionary, authentication) {
117
+ return updateItemTemplateFromDictionary(itemId, templateDictionary, authentication);
118
+ }
104
119
  //# sourceMappingURL=web-experience-processor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-experience-processor.js","sourceRoot":"","sources":["../../src/web-experience-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAEH;;;;GAIG;AAEH,OAAO,EAEL,mBAAmB,EAInB,6BAA6B,EAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAU,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,oCAAoC,EAAE,MAAM,qDAAqD,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAE9F;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,cAA2B;IAE3B,oCAAoC;IACpC,IAAM,KAAK,GAAG;QACZ,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,EAAE;KACC,CAAC;IACZ,sBAAsB;IACtB,OAAO,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,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"}
@@ -16,9 +16,9 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.convertWebExperienceToTemplate = void 0;
19
- var hub_common_1 = require("@esri/hub-common");
20
- var solution_common_1 = require("@esri/solution-common");
21
- var get_web_experience_dependencies_1 = require("./get-web-experience-dependencies");
19
+ const hub_common_1 = require("@esri/hub-common");
20
+ const solution_common_1 = require("@esri/solution-common");
21
+ const get_web_experience_dependencies_1 = require("./get-web-experience-dependencies");
22
22
  /**
23
23
  * Convert an Experience item into a template
24
24
  *
@@ -29,20 +29,20 @@ var get_web_experience_dependencies_1 = require("./get-web-experience-dependenci
29
29
  * @param authentication
30
30
  */
31
31
  function convertWebExperienceToTemplate(model) {
32
- var tmpl = solution_common_1.createPlaceholderTemplate(model.item.id, model.item.type);
33
- tmpl.key = hub_common_1.propifyString(model.item.title) + "_" + hub_common_1.createId("i");
34
- var clone = hub_common_1.cloneObject(model);
32
+ const tmpl = (0, solution_common_1.createPlaceholderTemplate)(model.item.id, model.item.type);
33
+ tmpl.key = `${(0, hub_common_1.propifyString)(model.item.title)}_${(0, hub_common_1.createId)("i")}`;
34
+ const clone = (0, hub_common_1.cloneObject)(model);
35
35
  tmpl.data = clone.data;
36
- tmpl.item = hub_common_1.normalizeSolutionTemplateItem(clone.item);
36
+ tmpl.item = (0, hub_common_1.normalizeSolutionTemplateItem)(clone.item);
37
37
  // templatize the url. This is updated during the createModelFromTemplate phase
38
38
  // of the deployment process
39
39
  tmpl.item.url = "{{experienceUrlTemplate}}";
40
40
  // use typeKeyword to mark item as published (we decided to discard unpublished drafts)
41
- var typeKeywords = tmpl.item.typeKeywords;
41
+ const typeKeywords = tmpl.item.typeKeywords;
42
42
  if (typeKeywords.indexOf(changedTypeKW) !== -1) {
43
- tmpl.item.typeKeywords = [publishedTypeKW].concat(tmpl.item.typeKeywords.filter(function (word) { return word !== changedTypeKW; }));
43
+ tmpl.item.typeKeywords = [publishedTypeKW].concat(tmpl.item.typeKeywords.filter(word => word !== changedTypeKW));
44
44
  }
45
- tmpl.dependencies = get_web_experience_dependencies_1.getWebExperienceDependencies(model);
45
+ tmpl.dependencies = (0, get_web_experience_dependencies_1.getWebExperienceDependencies)(model);
46
46
  return Promise.resolve(tmpl);
47
47
  // TODO: For now, we let the generic process handle item resources
48
48
  // However, many newer item types have complex type-specific resource handling
@@ -57,6 +57,6 @@ function convertWebExperienceToTemplate(model) {
57
57
  // });
58
58
  }
59
59
  exports.convertWebExperienceToTemplate = convertWebExperienceToTemplate;
60
- var publishedTypeKW = "status: Published";
61
- var changedTypeKW = "status: Changed";
60
+ const publishedTypeKW = "status: Published";
61
+ const changedTypeKW = "status: Changed";
62
62
  //# sourceMappingURL=convert-web-experience-to-template.js.map
@@ -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,+CAM0B;AAE1B,yDAG+B;AAE/B,qFAAiF;AAEjF;;;;;;;;GAQG;AACH,SAAgB,8BAA8B,CAC5C,KAAa;IAEb,IAAM,IAAI,GAAG,2CAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvE,IAAI,CAAC,GAAG,GAAM,0BAAa,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAI,qBAAQ,CAAC,GAAG,CAAG,CAAC;IAEjE,IAAM,KAAK,GAAG,wBAAW,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACvB,IAAI,CAAC,IAAI,GAAG,0CAA6B,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,IAAM,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,UAAA,IAAI,IAAI,OAAA,IAAI,KAAK,aAAa,EAAtB,CAAsB,CAAC,CAC9D,CAAC;KACH;IAED,IAAI,CAAC,YAAY,GAAG,8DAA4B,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;AAnCD,wEAmCC;AAED,IAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,IAAM,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;AAEj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V,CAAC;AAnCD,wEAmCC;AAED,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,aAAa,GAAG,iBAAiB,CAAC"}
@@ -16,8 +16,8 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.createWebExperienceModelFromTemplate = void 0;
19
- var hub_common_1 = require("@esri/hub-common");
20
- var get_web_experience_url_template_1 = require("./get-web-experience-url-template");
19
+ const hub_common_1 = require("@esri/hub-common");
20
+ const get_web_experience_url_template_1 = require("./get-web-experience-url-template");
21
21
  /**
22
22
  * Convert a Web Experience template into a Model that can be persisted to the Portal API
23
23
  *
@@ -28,8 +28,8 @@ var get_web_experience_url_template_1 = require("./get-web-experience-url-templa
28
28
  */
29
29
  function createWebExperienceModelFromTemplate(templateModel, settings, transforms, authentication) {
30
30
  // get the experience base url
31
- settings.experienceUrlTemplate = get_web_experience_url_template_1.getWebExperiencepUrlTemplate(authentication);
32
- var model = hub_common_1.interpolate(templateModel, settings, transforms);
31
+ settings.experienceUrlTemplate = (0, get_web_experience_url_template_1.getWebExperiencepUrlTemplate)(authentication);
32
+ const model = (0, hub_common_1.interpolate)(templateModel, settings, transforms);
33
33
  // ensure this is set - there may be some templates w/o `{{experienceTemplateUrl}}
34
34
  model.item.url = settings.experienceUrlTemplate;
35
35
  /* istanbul ignore else */
@@ -1 +1 @@
1
- {"version":3,"file":"create-web-experience-model-from-template.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience-model-from-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,+CAA+D;AAE/D,qFAAiF;AACjF;;;;;;;GAOG;AACH,SAAgB,oCAAoC,CAClD,aAA6B,EAC7B,QAAa,EACb,UAAe,EACf,cAA2B;IAE3B,8BAA8B;IAC9B,QAAQ,CAAC,qBAAqB,GAAG,8DAA4B,CAAC,cAAc,CAAC,CAAC;IAC9E,IAAM,KAAK,GAAG,wBAAW,CAAC,aAAa,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/D,kFAAkF;IAClF,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,qBAAqB,CAAC;IAChD,0BAA0B;IAC1B,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE;QAChC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,yCAAyC;KAC/F;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAjBD,oFAiBC"}
1
+ {"version":3,"file":"create-web-experience-model-from-template.js","sourceRoot":"","sources":["../../../src/helpers/create-web-experience-model-from-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,iDAA+D;AAE/D,uFAAiF;AACjF;;;;;;;GAOG;AACH,SAAgB,oCAAoC,CAClD,aAA6B,EAC7B,QAAa,EACb,UAAe,EACf,cAA2B;IAE3B,8BAA8B;IAC9B,QAAQ,CAAC,qBAAqB,GAAG,IAAA,8DAA4B,EAAC,cAAc,CAAC,CAAC;IAC9E,MAAM,KAAK,GAAG,IAAA,wBAAW,EAAC,aAAa,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/D,kFAAkF;IAClF,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,qBAAqB,CAAC;IAChD,0BAA0B;IAC1B,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE;QAChC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,yCAAyC;KAC/F;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAjBD,oFAiBC"}
@@ -16,8 +16,8 @@ exports.createWebExperience = void 0;
16
16
  * See the License for the specific language governing permissions and
17
17
  * limitations under the License.
18
18
  */
19
- var hub_common_1 = require("@esri/hub-common");
20
- var arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
19
+ const hub_common_1 = require("@esri/hub-common");
20
+ const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
21
21
  /**
22
22
  * Given a Model for a Web Experience, create the item in the Portal API
23
23
  *
@@ -26,13 +26,13 @@ var arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
26
26
  * @param authentication
27
27
  */
28
28
  function createWebExperience(model, folderId, options, authentication) {
29
- var resources = [];
29
+ const resources = [];
30
30
  // For unkown reasons we can not seem to spy on createItemInFolder
31
31
  // so we will create-then-move for now
32
- var createOptions = {
32
+ const createOptions = {
33
33
  // need to serialize
34
- item: hub_common_1.serializeModel(model),
35
- authentication: authentication
34
+ item: (0, hub_common_1.serializeModel)(model),
35
+ authentication
36
36
  };
37
37
  /* istanbul ignore else */
38
38
  if (model.item.thumbnail) {
@@ -43,34 +43,34 @@ function createWebExperience(model, folderId, options, authentication) {
43
43
  delete createOptions.item.thumbnail;
44
44
  }
45
45
  // Create the item
46
- return (arcgis_rest_portal_1.createItem(createOptions)
47
- .then(function (createResponse) {
46
+ return ((0, arcgis_rest_portal_1.createItem)(createOptions)
47
+ .then((createResponse) => {
48
48
  model.item.id = createResponse.id;
49
- var savedThumbnail = model.item.thumbnail;
50
- model = hub_common_1.interpolateItemId(model);
49
+ const savedThumbnail = model.item.thumbnail;
50
+ model = (0, hub_common_1.interpolateItemId)(model);
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
- var draftResourceModel = hub_common_1.cloneObject(model.data);
54
+ const draftResourceModel = (0, hub_common_1.cloneObject)(model.data);
55
55
  resources.push({
56
56
  name: "config.json",
57
57
  prefix: "config",
58
- file: hub_common_1.stringToBlob(JSON.stringify(draftResourceModel))
58
+ file: (0, hub_common_1.stringToBlob)(JSON.stringify(draftResourceModel))
59
59
  });
60
60
  // there may also be this image resources list
61
- var imageListModel = hub_common_1.cloneObject(model.properties.imageResourcesList);
61
+ const imageListModel = (0, hub_common_1.cloneObject)(model.properties.imageResourcesList);
62
62
  if (imageListModel) {
63
63
  resources.push({
64
64
  name: "image-resources-list.json",
65
65
  prefix: "images",
66
- file: hub_common_1.stringToBlob(JSON.stringify(imageListModel))
66
+ file: (0, hub_common_1.stringToBlob)(JSON.stringify(imageListModel))
67
67
  });
68
68
  }
69
69
  delete model.properties;
70
70
  // update the experience with the newly interpolated model
71
- var updateOptions = {
72
- item: hub_common_1.serializeModel(model),
73
- authentication: authentication
71
+ const updateOptions = {
72
+ item: (0, hub_common_1.serializeModel)(model),
73
+ authentication
74
74
  };
75
75
  if (model.item.thumbnail) {
76
76
  updateOptions.params = {
@@ -80,26 +80,24 @@ function createWebExperience(model, folderId, options, authentication) {
80
80
  delete updateOptions.item.thumbnail;
81
81
  }
82
82
  return Promise.all([
83
- arcgis_rest_portal_1.updateItem(updateOptions),
83
+ (0, arcgis_rest_portal_1.updateItem)(updateOptions),
84
84
  authentication.getUsername()
85
85
  ]);
86
86
  })
87
- .then(function (responses) {
88
- var username = responses[1];
89
- var failSafeAddItemResource = hub_common_1.failSafe(arcgis_rest_portal_1.addItemResource, {
87
+ .then((responses) => {
88
+ const username = responses[1];
89
+ const failSafeAddItemResource = (0, hub_common_1.failSafe)(arcgis_rest_portal_1.addItemResource, {
90
90
  success: true
91
91
  });
92
92
  // upload the data and oembed resources
93
- var resourceUploadPromises = resources.map(function (resource) {
94
- return failSafeAddItemResource({
95
- id: model.item.id,
96
- owner: username,
97
- resource: resource.file,
98
- name: resource.name,
99
- prefix: resource.prefix,
100
- authentication: authentication
101
- });
102
- });
93
+ const resourceUploadPromises = resources.map(resource => failSafeAddItemResource({
94
+ id: model.item.id,
95
+ owner: username,
96
+ resource: resource.file,
97
+ name: resource.name,
98
+ prefix: resource.prefix,
99
+ authentication
100
+ }));
103
101
  // fire and forget
104
102
  return Promise.all(resourceUploadPromises);
105
103
  })
@@ -107,15 +105,15 @@ function createWebExperience(model, folderId, options, authentication) {
107
105
  // // TODO: Can we leave this to the main process?
108
106
  // return uploadResourcesFromUrl(model, options.assets || [], authentication);
109
107
  // })
110
- .then(function () {
108
+ .then(() => {
111
109
  // Move it
112
- return arcgis_rest_portal_1.moveItem({
110
+ return (0, arcgis_rest_portal_1.moveItem)({
113
111
  itemId: model.item.id,
114
- folderId: folderId,
115
- authentication: authentication
112
+ folderId,
113
+ authentication
116
114
  });
117
115
  })
118
- .then(function () {
116
+ .then(() => {
119
117
  return model;
120
118
  }));
121
119
  }