@esri/solution-web-experience 4.1.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/helpers/convert-web-experience-to-template.d.ts +27 -27
- package/dist/cjs/helpers/convert-web-experience-to-template.js +66 -66
- package/dist/cjs/helpers/create-web-experience-model-from-template.d.ts +26 -26
- package/dist/cjs/helpers/create-web-experience-model-from-template.js +41 -41
- package/dist/cjs/helpers/create-web-experience.d.ts +25 -25
- package/dist/cjs/helpers/create-web-experience.js +121 -121
- package/dist/cjs/helpers/get-experience-subdomain.d.ts +23 -23
- package/dist/cjs/helpers/get-experience-subdomain.js +25 -25
- package/dist/cjs/helpers/get-web-experience-dependencies.d.ts +23 -23
- package/dist/cjs/helpers/get-web-experience-dependencies.js +32 -32
- package/dist/cjs/helpers/get-web-experience-url-template.d.ts +23 -23
- package/dist/cjs/helpers/get-web-experience-url-template.js +25 -25
- package/dist/cjs/index.d.ts +17 -17
- package/dist/cjs/index.js +21 -21
- package/dist/cjs/web-experience-processor.d.ts +51 -51
- package/dist/cjs/web-experience-processor.js +125 -125
- package/dist/esm/helpers/convert-web-experience-to-template.d.ts +27 -27
- package/dist/esm/helpers/convert-web-experience-to-template.js +62 -62
- package/dist/esm/helpers/create-web-experience-model-from-template.d.ts +26 -26
- package/dist/esm/helpers/create-web-experience-model-from-template.js +37 -37
- package/dist/esm/helpers/create-web-experience.d.ts +25 -25
- package/dist/esm/helpers/create-web-experience.js +117 -117
- package/dist/esm/helpers/get-experience-subdomain.d.ts +23 -23
- package/dist/esm/helpers/get-experience-subdomain.js +21 -21
- package/dist/esm/helpers/get-web-experience-dependencies.d.ts +23 -23
- package/dist/esm/helpers/get-web-experience-dependencies.js +28 -28
- package/dist/esm/helpers/get-web-experience-url-template.d.ts +23 -23
- package/dist/esm/helpers/get-web-experience-url-template.js +21 -21
- package/dist/esm/index.d.ts +17 -17
- package/dist/esm/index.js +17 -17
- package/dist/esm/web-experience-processor.d.ts +51 -51
- package/dist/esm/web-experience-processor.js +119 -119
- package/package.json +4 -4
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { cloneObject, failSafe, serializeModel, interpolateItemId, stringToBlob, objectToJsonBlob } from "@esri/hub-common";
|
|
17
|
-
import { createItem, updateItem, addItemResource, moveItem } from "@esri/arcgis-rest-portal";
|
|
18
|
-
/**
|
|
19
|
-
* Given a Model for a Web Experience, create the item in the Portal API
|
|
20
|
-
*
|
|
21
|
-
* @param model
|
|
22
|
-
* @param options
|
|
23
|
-
* @param authentication
|
|
24
|
-
*/
|
|
25
|
-
export function createWebExperience(model, folderId, options, authentication) {
|
|
26
|
-
const resources = [];
|
|
27
|
-
// For unkown reasons we can not seem to spy on createItemInFolder
|
|
28
|
-
// so we will create-then-move for now
|
|
29
|
-
const createOptions = {
|
|
30
|
-
// need to serialize
|
|
31
|
-
item: serializeModel(model),
|
|
32
|
-
authentication
|
|
33
|
-
};
|
|
34
|
-
/* istanbul ignore else */
|
|
35
|
-
if (model.item.thumbnail) {
|
|
36
|
-
createOptions.params = {
|
|
37
|
-
// Pass thumbnail file in via params because item property is serialized, which discards a blob
|
|
38
|
-
thumbnail: model.item.thumbnail
|
|
39
|
-
};
|
|
40
|
-
delete createOptions.item.thumbnail;
|
|
41
|
-
}
|
|
42
|
-
// Create the item
|
|
43
|
-
return (createItem(createOptions)
|
|
44
|
-
.then((createResponse) => {
|
|
45
|
-
model.item.id = createResponse.id;
|
|
46
|
-
const savedThumbnail = model.item.thumbnail;
|
|
47
|
-
model = interpolateItemId(model);
|
|
48
|
-
model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary
|
|
49
|
-
// Experiences store draft data in a resource attached to the item
|
|
50
|
-
// We'll just use the published data for the first "draft"
|
|
51
|
-
// changed from stringToBlob to objectToJsonBlob for issue #742
|
|
52
|
-
const draftResourceModel = cloneObject(model.data);
|
|
53
|
-
resources.push({
|
|
54
|
-
name: "config.json",
|
|
55
|
-
prefix: "config",
|
|
56
|
-
file: objectToJsonBlob(draftResourceModel)
|
|
57
|
-
});
|
|
58
|
-
// there may also be this image resources list
|
|
59
|
-
const imageListModel = cloneObject(model.properties.imageResourcesList);
|
|
60
|
-
if (imageListModel) {
|
|
61
|
-
resources.push({
|
|
62
|
-
name: "image-resources-list.json",
|
|
63
|
-
prefix: "images",
|
|
64
|
-
file: stringToBlob(JSON.stringify(imageListModel))
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
delete model.properties;
|
|
68
|
-
// update the experience with the newly interpolated model
|
|
69
|
-
const updateOptions = {
|
|
70
|
-
item: serializeModel(model),
|
|
71
|
-
authentication
|
|
72
|
-
};
|
|
73
|
-
if (model.item.thumbnail) {
|
|
74
|
-
updateOptions.params = {
|
|
75
|
-
// Pass thumbnail file in via params because item property is serialized, which discards a blob
|
|
76
|
-
thumbnail: model.item.thumbnail
|
|
77
|
-
};
|
|
78
|
-
delete updateOptions.item.thumbnail;
|
|
79
|
-
}
|
|
80
|
-
return Promise.all([
|
|
81
|
-
updateItem(updateOptions),
|
|
82
|
-
authentication.getUsername()
|
|
83
|
-
]);
|
|
84
|
-
})
|
|
85
|
-
.then((responses) => {
|
|
86
|
-
const username = responses[1];
|
|
87
|
-
const failSafeAddItemResource = failSafe(addItemResource, {
|
|
88
|
-
success: true
|
|
89
|
-
});
|
|
90
|
-
// upload the data and oembed resources
|
|
91
|
-
const resourceUploadPromises = resources.map(resource => failSafeAddItemResource({
|
|
92
|
-
id: model.item.id,
|
|
93
|
-
owner: username,
|
|
94
|
-
resource: resource.file,
|
|
95
|
-
name: resource.name,
|
|
96
|
-
prefix: resource.prefix,
|
|
97
|
-
authentication
|
|
98
|
-
}));
|
|
99
|
-
// fire and forget
|
|
100
|
-
return Promise.all(resourceUploadPromises);
|
|
101
|
-
})
|
|
102
|
-
// .then(() => {
|
|
103
|
-
// // TODO: Can we leave this to the main process?
|
|
104
|
-
// return uploadResourcesFromUrl(model, options.assets || [], authentication);
|
|
105
|
-
// })
|
|
106
|
-
.then(() => {
|
|
107
|
-
// Move it
|
|
108
|
-
return moveItem({
|
|
109
|
-
itemId: model.item.id,
|
|
110
|
-
folderId,
|
|
111
|
-
authentication
|
|
112
|
-
});
|
|
113
|
-
})
|
|
114
|
-
.then(() => {
|
|
115
|
-
return model;
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2020 Esri
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { cloneObject, failSafe, serializeModel, interpolateItemId, stringToBlob, objectToJsonBlob } from "@esri/hub-common";
|
|
17
|
+
import { createItem, updateItem, addItemResource, moveItem } from "@esri/arcgis-rest-portal";
|
|
18
|
+
/**
|
|
19
|
+
* Given a Model for a Web Experience, create the item in the Portal API
|
|
20
|
+
*
|
|
21
|
+
* @param model
|
|
22
|
+
* @param options
|
|
23
|
+
* @param authentication
|
|
24
|
+
*/
|
|
25
|
+
export function createWebExperience(model, folderId, options, authentication) {
|
|
26
|
+
const resources = [];
|
|
27
|
+
// For unkown reasons we can not seem to spy on createItemInFolder
|
|
28
|
+
// so we will create-then-move for now
|
|
29
|
+
const createOptions = {
|
|
30
|
+
// need to serialize
|
|
31
|
+
item: serializeModel(model),
|
|
32
|
+
authentication
|
|
33
|
+
};
|
|
34
|
+
/* istanbul ignore else */
|
|
35
|
+
if (model.item.thumbnail) {
|
|
36
|
+
createOptions.params = {
|
|
37
|
+
// Pass thumbnail file in via params because item property is serialized, which discards a blob
|
|
38
|
+
thumbnail: model.item.thumbnail
|
|
39
|
+
};
|
|
40
|
+
delete createOptions.item.thumbnail;
|
|
41
|
+
}
|
|
42
|
+
// Create the item
|
|
43
|
+
return (createItem(createOptions)
|
|
44
|
+
.then((createResponse) => {
|
|
45
|
+
model.item.id = createResponse.id;
|
|
46
|
+
const savedThumbnail = model.item.thumbnail;
|
|
47
|
+
model = interpolateItemId(model);
|
|
48
|
+
model.item.thumbnail = savedThumbnail; // interpolation trashes thumbnail binary
|
|
49
|
+
// Experiences store draft data in a resource attached to the item
|
|
50
|
+
// We'll just use the published data for the first "draft"
|
|
51
|
+
// changed from stringToBlob to objectToJsonBlob for issue #742
|
|
52
|
+
const draftResourceModel = cloneObject(model.data);
|
|
53
|
+
resources.push({
|
|
54
|
+
name: "config.json",
|
|
55
|
+
prefix: "config",
|
|
56
|
+
file: objectToJsonBlob(draftResourceModel)
|
|
57
|
+
});
|
|
58
|
+
// there may also be this image resources list
|
|
59
|
+
const imageListModel = cloneObject(model.properties.imageResourcesList);
|
|
60
|
+
if (imageListModel) {
|
|
61
|
+
resources.push({
|
|
62
|
+
name: "image-resources-list.json",
|
|
63
|
+
prefix: "images",
|
|
64
|
+
file: stringToBlob(JSON.stringify(imageListModel))
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
delete model.properties;
|
|
68
|
+
// update the experience with the newly interpolated model
|
|
69
|
+
const updateOptions = {
|
|
70
|
+
item: serializeModel(model),
|
|
71
|
+
authentication
|
|
72
|
+
};
|
|
73
|
+
if (model.item.thumbnail) {
|
|
74
|
+
updateOptions.params = {
|
|
75
|
+
// Pass thumbnail file in via params because item property is serialized, which discards a blob
|
|
76
|
+
thumbnail: model.item.thumbnail
|
|
77
|
+
};
|
|
78
|
+
delete updateOptions.item.thumbnail;
|
|
79
|
+
}
|
|
80
|
+
return Promise.all([
|
|
81
|
+
updateItem(updateOptions),
|
|
82
|
+
authentication.getUsername()
|
|
83
|
+
]);
|
|
84
|
+
})
|
|
85
|
+
.then((responses) => {
|
|
86
|
+
const username = responses[1];
|
|
87
|
+
const failSafeAddItemResource = failSafe(addItemResource, {
|
|
88
|
+
success: true
|
|
89
|
+
});
|
|
90
|
+
// upload the data and oembed resources
|
|
91
|
+
const resourceUploadPromises = resources.map(resource => failSafeAddItemResource({
|
|
92
|
+
id: model.item.id,
|
|
93
|
+
owner: username,
|
|
94
|
+
resource: resource.file,
|
|
95
|
+
name: resource.name,
|
|
96
|
+
prefix: resource.prefix,
|
|
97
|
+
authentication
|
|
98
|
+
}));
|
|
99
|
+
// fire and forget
|
|
100
|
+
return Promise.all(resourceUploadPromises);
|
|
101
|
+
})
|
|
102
|
+
// .then(() => {
|
|
103
|
+
// // TODO: Can we leave this to the main process?
|
|
104
|
+
// return uploadResourcesFromUrl(model, options.assets || [], authentication);
|
|
105
|
+
// })
|
|
106
|
+
.then(() => {
|
|
107
|
+
// Move it
|
|
108
|
+
return moveItem({
|
|
109
|
+
itemId: model.item.id,
|
|
110
|
+
folderId,
|
|
111
|
+
authentication
|
|
112
|
+
});
|
|
113
|
+
})
|
|
114
|
+
.then(() => {
|
|
115
|
+
return model;
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
118
|
//# sourceMappingURL=create-web-experience.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { UserSession } from "@esri/solution-common";
|
|
17
|
-
/**
|
|
18
|
-
* Returns the subdomain for an experience based on the api the session is
|
|
19
|
-
* authenticated against
|
|
20
|
-
*
|
|
21
|
-
* @param authentication UserSession
|
|
22
|
-
*/
|
|
23
|
-
export declare function getExperienceSubdomain(authentication: UserSession): string;
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2020 Esri
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { UserSession } from "@esri/solution-common";
|
|
17
|
+
/**
|
|
18
|
+
* Returns the subdomain for an experience based on the api the session is
|
|
19
|
+
* authenticated against
|
|
20
|
+
*
|
|
21
|
+
* @param authentication UserSession
|
|
22
|
+
*/
|
|
23
|
+
export declare function getExperienceSubdomain(authentication: UserSession): string;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the subdomain for an experience based on the api the session is
|
|
3
|
-
* authenticated against
|
|
4
|
-
*
|
|
5
|
-
* @param authentication UserSession
|
|
6
|
-
*/
|
|
7
|
-
export function getExperienceSubdomain(authentication) {
|
|
8
|
-
const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
|
|
9
|
-
// TODO: Sort out how we locate experiences on portal?
|
|
10
|
-
let result;
|
|
11
|
-
if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
12
|
-
result = "experienceqa";
|
|
13
|
-
}
|
|
14
|
-
else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
15
|
-
result = "experiencedev";
|
|
16
|
-
}
|
|
17
|
-
else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
18
|
-
result = "experience";
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Returns the subdomain for an experience based on the api the session is
|
|
3
|
+
* authenticated against
|
|
4
|
+
*
|
|
5
|
+
* @param authentication UserSession
|
|
6
|
+
*/
|
|
7
|
+
export function getExperienceSubdomain(authentication) {
|
|
8
|
+
const portalUrl = authentication.portal || "https://www.arcgis.com/sharing/rest";
|
|
9
|
+
// TODO: Sort out how we locate experiences on portal?
|
|
10
|
+
let result;
|
|
11
|
+
if (portalUrl.match(/(qaext|\.mapsqa)\.arcgis.com/)) {
|
|
12
|
+
result = "experienceqa";
|
|
13
|
+
}
|
|
14
|
+
else if (portalUrl.match(/(devext|\.mapsdevext)\.arcgis.com/)) {
|
|
15
|
+
result = "experiencedev";
|
|
16
|
+
}
|
|
17
|
+
else if (portalUrl.match(/(www|\.maps)\.arcgis.com/)) {
|
|
18
|
+
result = "experience";
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
22
|
//# sourceMappingURL=get-experience-subdomain.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { IModel } from "@esri/hub-common";
|
|
17
|
-
/**
|
|
18
|
-
* Given an Web Experience model, extract out all the
|
|
19
|
-
* items it depends on from the `dataSources` hash
|
|
20
|
-
*
|
|
21
|
-
* @param model IModel
|
|
22
|
-
*/
|
|
23
|
-
export declare function getWebExperienceDependencies(model: IModel): any[];
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2020 Esri
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { IModel } from "@esri/hub-common";
|
|
17
|
+
/**
|
|
18
|
+
* Given an Web Experience model, extract out all the
|
|
19
|
+
* items it depends on from the `dataSources` hash
|
|
20
|
+
*
|
|
21
|
+
* @param model IModel
|
|
22
|
+
*/
|
|
23
|
+
export declare function getWebExperienceDependencies(model: IModel): any[];
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { getProp, maybePush } from "@esri/hub-common";
|
|
17
|
-
/**
|
|
18
|
-
* Given an Web Experience model, extract out all the
|
|
19
|
-
* items it depends on from the `dataSources` hash
|
|
20
|
-
*
|
|
21
|
-
* @param model IModel
|
|
22
|
-
*/
|
|
23
|
-
export function getWebExperienceDependencies(model) {
|
|
24
|
-
const dataSources = getProp(model, "data.dataSources") || {};
|
|
25
|
-
return Object.keys(dataSources).reduce((acc, key) => {
|
|
26
|
-
return maybePush(getProp(dataSources, `${key}.itemId`), acc);
|
|
27
|
-
}, []);
|
|
28
|
-
}
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2020 Esri
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { getProp, maybePush } from "@esri/hub-common";
|
|
17
|
+
/**
|
|
18
|
+
* Given an Web Experience model, extract out all the
|
|
19
|
+
* items it depends on from the `dataSources` hash
|
|
20
|
+
*
|
|
21
|
+
* @param model IModel
|
|
22
|
+
*/
|
|
23
|
+
export function getWebExperienceDependencies(model) {
|
|
24
|
+
const dataSources = getProp(model, "data.dataSources") || {};
|
|
25
|
+
return Object.keys(dataSources).reduce((acc, key) => {
|
|
26
|
+
return maybePush(getProp(dataSources, `${key}.itemId`), acc);
|
|
27
|
+
}, []);
|
|
28
|
+
}
|
|
29
29
|
//# sourceMappingURL=get-web-experience-dependencies.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { UserSession } from "@esri/solution-common";
|
|
17
|
-
/**
|
|
18
|
-
* For a given environment Prod/qa/dev/portal
|
|
19
|
-
* return the correct storymaps base url
|
|
20
|
-
*
|
|
21
|
-
* @param authentication
|
|
22
|
-
*/
|
|
23
|
-
export declare function getWebExperiencepUrlTemplate(authentication: UserSession): string;
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2020 Esri
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { UserSession } from "@esri/solution-common";
|
|
17
|
+
/**
|
|
18
|
+
* For a given environment Prod/qa/dev/portal
|
|
19
|
+
* return the correct storymaps base url
|
|
20
|
+
*
|
|
21
|
+
* @param authentication
|
|
22
|
+
*/
|
|
23
|
+
export declare function getWebExperiencepUrlTemplate(authentication: UserSession): string;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { getExperienceSubdomain } from "./get-experience-subdomain";
|
|
2
|
-
/**
|
|
3
|
-
* For a given environment Prod/qa/dev/portal
|
|
4
|
-
* return the correct storymaps base url
|
|
5
|
-
*
|
|
6
|
-
* @param authentication
|
|
7
|
-
*/
|
|
8
|
-
export function getWebExperiencepUrlTemplate(authentication) {
|
|
9
|
-
let baseUrl = "";
|
|
10
|
-
const subdomain = getExperienceSubdomain(authentication);
|
|
11
|
-
if (subdomain) {
|
|
12
|
-
baseUrl = `https://${subdomain}.arcgis.com/experience/{{appid}}`;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
// we're on portal
|
|
16
|
-
// chop off the /sharing/rest to get the baseUrl
|
|
17
|
-
const portalBaseUrl = authentication.portal.replace("/sharing/rest", "");
|
|
18
|
-
baseUrl = `${portalBaseUrl}/apps/experiencebuilder/?id={{appid}}`;
|
|
19
|
-
}
|
|
20
|
-
return baseUrl;
|
|
21
|
-
}
|
|
1
|
+
import { getExperienceSubdomain } from "./get-experience-subdomain";
|
|
2
|
+
/**
|
|
3
|
+
* For a given environment Prod/qa/dev/portal
|
|
4
|
+
* return the correct storymaps base url
|
|
5
|
+
*
|
|
6
|
+
* @param authentication
|
|
7
|
+
*/
|
|
8
|
+
export function getWebExperiencepUrlTemplate(authentication) {
|
|
9
|
+
let baseUrl = "";
|
|
10
|
+
const subdomain = getExperienceSubdomain(authentication);
|
|
11
|
+
if (subdomain) {
|
|
12
|
+
baseUrl = `https://${subdomain}.arcgis.com/experience/{{appid}}`;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
// we're on portal
|
|
16
|
+
// chop off the /sharing/rest to get the baseUrl
|
|
17
|
+
const portalBaseUrl = authentication.portal.replace("/sharing/rest", "");
|
|
18
|
+
baseUrl = `${portalBaseUrl}/apps/experiencebuilder/?id={{appid}}`;
|
|
19
|
+
}
|
|
20
|
+
return baseUrl;
|
|
21
|
+
}
|
|
22
22
|
//# sourceMappingURL=get-web-experience-url-template.js.map
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import * as WebExperienceProcessor from "./web-experience-processor";
|
|
17
|
-
export { WebExperienceProcessor };
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2018 Esri
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import * as WebExperienceProcessor from "./web-experience-processor";
|
|
17
|
+
export { WebExperienceProcessor };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import * as WebExperienceProcessor from "./web-experience-processor";
|
|
17
|
-
export { WebExperienceProcessor };
|
|
1
|
+
/** @license
|
|
2
|
+
* Copyright 2018 Esri
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import * as WebExperienceProcessor from "./web-experience-processor";
|
|
17
|
+
export { WebExperienceProcessor };
|
|
18
18
|
//# sourceMappingURL=index.js.map
|