@esri/hub-common 13.15.1 → 13.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/content/_internal/internalContentUtils.js +14 -0
- package/dist/esm/content/_internal/internalContentUtils.js.map +1 -1
- package/dist/esm/core/behaviors/IWithCardBehavior.js +1 -0
- package/dist/esm/core/behaviors/IWithCardBehavior.js.map +1 -0
- package/dist/esm/core/behaviors/index.js +1 -0
- package/dist/esm/core/behaviors/index.js.map +1 -1
- package/dist/esm/core/getRelativeWorkspaceUrl.js +23 -0
- package/dist/esm/core/getRelativeWorkspaceUrl.js.map +1 -0
- package/dist/esm/core/index.js +2 -0
- package/dist/esm/core/index.js.map +1 -1
- package/dist/esm/core/isValidEntityType.js +5 -0
- package/dist/esm/core/isValidEntityType.js.map +1 -0
- package/dist/esm/core/schemas/shared/HubItemEntitySchema.js +31 -0
- package/dist/esm/core/schemas/shared/HubItemEntitySchema.js.map +1 -0
- package/dist/esm/core/schemas/shared/subschemas.js +27 -6
- package/dist/esm/core/schemas/shared/subschemas.js.map +1 -1
- package/dist/esm/core/types/HubEntityType.js +9 -0
- package/dist/esm/core/types/HubEntityType.js.map +1 -1
- package/dist/esm/core/types/IHubCardViewModel.js +1 -0
- package/dist/esm/core/types/IHubCardViewModel.js.map +1 -0
- package/dist/esm/discussions/_internal/DiscussionSchema.js +3 -40
- package/dist/esm/discussions/_internal/DiscussionSchema.js.map +1 -1
- package/dist/esm/initiatives/_internal/InitiativeSchema.js +2 -26
- package/dist/esm/initiatives/_internal/InitiativeSchema.js.map +1 -1
- package/dist/esm/projects/HubProject.js +11 -0
- package/dist/esm/projects/HubProject.js.map +1 -1
- package/dist/esm/projects/_internal/ProjectSchema.js +5 -45
- package/dist/esm/projects/_internal/ProjectSchema.js.map +1 -1
- package/dist/esm/projects/fetch.js +3 -0
- package/dist/esm/projects/fetch.js.map +1 -1
- package/dist/esm/projects/index.js +1 -0
- package/dist/esm/projects/index.js.map +1 -1
- package/dist/esm/projects/view.js +89 -0
- package/dist/esm/projects/view.js.map +1 -0
- package/dist/esm/sites/_internal/SiteSchema.js +2 -26
- package/dist/esm/sites/_internal/SiteSchema.js.map +1 -1
- package/dist/node/content/_internal/internalContentUtils.js +15 -1
- package/dist/node/content/_internal/internalContentUtils.js.map +1 -1
- package/dist/node/core/behaviors/IWithCardBehavior.js +3 -0
- package/dist/node/core/behaviors/IWithCardBehavior.js.map +1 -0
- package/dist/node/core/behaviors/index.js +1 -0
- package/dist/node/core/behaviors/index.js.map +1 -1
- package/dist/node/core/getRelativeWorkspaceUrl.js +26 -0
- package/dist/node/core/getRelativeWorkspaceUrl.js.map +1 -0
- package/dist/node/core/index.js +2 -0
- package/dist/node/core/index.js.map +1 -1
- package/dist/node/core/isValidEntityType.js +8 -0
- package/dist/node/core/isValidEntityType.js.map +1 -0
- package/dist/node/core/schemas/shared/HubItemEntitySchema.js +34 -0
- package/dist/node/core/schemas/shared/HubItemEntitySchema.js.map +1 -0
- package/dist/node/core/schemas/shared/subschemas.js +28 -7
- package/dist/node/core/schemas/shared/subschemas.js.map +1 -1
- package/dist/node/core/types/HubEntityType.js +10 -0
- package/dist/node/core/types/HubEntityType.js.map +1 -1
- package/dist/node/core/types/IHubCardViewModel.js +3 -0
- package/dist/node/core/types/IHubCardViewModel.js.map +1 -0
- package/dist/node/discussions/_internal/DiscussionSchema.js +3 -40
- package/dist/node/discussions/_internal/DiscussionSchema.js.map +1 -1
- package/dist/node/initiatives/_internal/InitiativeSchema.js +2 -26
- package/dist/node/initiatives/_internal/InitiativeSchema.js.map +1 -1
- package/dist/node/projects/HubProject.js +11 -0
- package/dist/node/projects/HubProject.js.map +1 -1
- package/dist/node/projects/_internal/ProjectSchema.js +5 -45
- package/dist/node/projects/_internal/ProjectSchema.js.map +1 -1
- package/dist/node/projects/fetch.js +3 -0
- package/dist/node/projects/fetch.js.map +1 -1
- package/dist/node/projects/index.js +1 -0
- package/dist/node/projects/index.js.map +1 -1
- package/dist/node/projects/view.js +92 -0
- package/dist/node/projects/view.js.map +1 -0
- package/dist/node/sites/_internal/SiteSchema.js +2 -26
- package/dist/node/sites/_internal/SiteSchema.js.map +1 -1
- package/dist/types/content/_internal/internalContentUtils.d.ts +7 -0
- package/dist/types/core/behaviors/IWithCardBehavior.d.ts +11 -0
- package/dist/types/core/behaviors/index.d.ts +1 -0
- package/dist/types/core/getRelativeWorkspaceUrl.d.ts +8 -0
- package/dist/types/core/index.d.ts +2 -0
- package/dist/types/core/isValidEntityType.d.ts +1 -0
- package/dist/types/core/schemas/shared/HubItemEntitySchema.d.ts +7 -0
- package/dist/types/core/schemas/shared/subschemas.d.ts +34 -11
- package/dist/types/core/traits/IWithViewSettings.d.ts +4 -0
- package/dist/types/core/types/HubEntityType.d.ts +2 -1
- package/dist/types/core/types/IHubCardViewModel.d.ts +36 -0
- package/dist/types/projects/HubProject.d.ts +11 -2
- package/dist/types/projects/index.d.ts +1 -0
- package/dist/types/projects/view.d.ts +22 -0
- package/dist/types/search/types/IHubSearchResult.d.ts +4 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProjectSchema = exports.ProjectEditorTypes = void 0;
|
|
4
4
|
const core_1 = require("../../core");
|
|
5
|
-
const
|
|
5
|
+
const HubItemEntitySchema_1 = require("../../core/schemas/shared/HubItemEntitySchema");
|
|
6
6
|
exports.ProjectEditorTypes = [
|
|
7
7
|
"hub:project:create",
|
|
8
8
|
"hub:project:edit",
|
|
@@ -10,52 +10,12 @@ exports.ProjectEditorTypes = [
|
|
|
10
10
|
/**
|
|
11
11
|
* defines the JSON schema for a Hub Project's editable fields
|
|
12
12
|
*/
|
|
13
|
-
exports.ProjectSchema = {
|
|
14
|
-
required: ["name"],
|
|
15
|
-
type: "object",
|
|
16
|
-
properties: {
|
|
17
|
-
name: shared_1.ENTITY_NAME_SCHEMA,
|
|
18
|
-
summary: shared_1.ENTITY_SUMMARY_SCHEMA,
|
|
19
|
-
description: {
|
|
20
|
-
type: "string",
|
|
21
|
-
},
|
|
22
|
-
access: shared_1.ENTITY_ACCESS_SCHEMA,
|
|
23
|
-
groups: {
|
|
13
|
+
exports.ProjectSchema = Object.assign(Object.assign({}, HubItemEntitySchema_1.HubItemEntitySchema), { properties: Object.assign(Object.assign({}, HubItemEntitySchema_1.HubItemEntitySchema.properties), { groups: {
|
|
24
14
|
type: "array",
|
|
25
|
-
items: {
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
status: {
|
|
15
|
+
items: { type: "string" },
|
|
16
|
+
}, status: {
|
|
30
17
|
type: "string",
|
|
31
18
|
default: core_1.PROJECT_STATUSES.notStarted,
|
|
32
19
|
enum: Object.keys(core_1.PROJECT_STATUSES),
|
|
33
|
-
}
|
|
34
|
-
location: {
|
|
35
|
-
type: "object",
|
|
36
|
-
default: { type: "none" },
|
|
37
|
-
},
|
|
38
|
-
tags: shared_1.ENTITY_TAGS_SCHEMA,
|
|
39
|
-
categories: shared_1.ENTITY_CATEGORIES_SCHEMA,
|
|
40
|
-
view: {
|
|
41
|
-
type: "object",
|
|
42
|
-
properties: {
|
|
43
|
-
featuredContentIds: {
|
|
44
|
-
type: "array",
|
|
45
|
-
maxItems: 4,
|
|
46
|
-
items: {
|
|
47
|
-
type: "string",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
featuredImage: {
|
|
51
|
-
type: "object",
|
|
52
|
-
},
|
|
53
|
-
featuredImageAltText: {
|
|
54
|
-
type: "string",
|
|
55
|
-
},
|
|
56
|
-
timeline: shared_1.ENTITY_TIMELINE_SCHEMA,
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
};
|
|
20
|
+
} }) });
|
|
61
21
|
//# sourceMappingURL=ProjectSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectSchema.js","sourceRoot":"","sources":["../../../../src/projects/_internal/ProjectSchema.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"ProjectSchema.js","sourceRoot":"","sources":["../../../../src/projects/_internal/ProjectSchema.ts"],"names":[],"mappings":";;;AAAA,qCAAoE;AACpE,uFAAoF;AAGvE,QAAA,kBAAkB,GAAG;IAChC,oBAAoB;IACpB,kBAAkB;CACV,CAAC;AAEX;;GAEG;AACU,QAAA,aAAa,GAAyB,gCAC9C,yCAAmB,KACtB,UAAU,kCACL,yCAAmB,CAAC,UAAU,KACjC,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC1B,EACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,uBAAgB,CAAC,UAAU;YACpC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,uBAAgB,CAAC;SACpC,MAEoB,CAAC"}
|
|
@@ -17,6 +17,7 @@ const get_prop_1 = require("../objects/get-prop");
|
|
|
17
17
|
const get_item_thumbnail_url_1 = require("../resources/get-item-thumbnail-url");
|
|
18
18
|
const get_item_home_url_1 = require("../urls/get-item-home-url");
|
|
19
19
|
const items_1 = require("../items");
|
|
20
|
+
const getRelativeWorkspaceUrl_1 = require("../core/getRelativeWorkspaceUrl");
|
|
20
21
|
/**
|
|
21
22
|
* @private
|
|
22
23
|
* Get a Hub Project by id or slug
|
|
@@ -84,6 +85,7 @@ async function enrichProjectSearchResult(item, include, requestOptions) {
|
|
|
84
85
|
self: "not-implemented",
|
|
85
86
|
siteRelative: "not-implemented",
|
|
86
87
|
thumbnail: "not-implemented",
|
|
88
|
+
workspaceRelative: "not-implemented",
|
|
87
89
|
},
|
|
88
90
|
};
|
|
89
91
|
// default includes
|
|
@@ -110,6 +112,7 @@ async function enrichProjectSearchResult(item, include, requestOptions) {
|
|
|
110
112
|
result.links.self = get_item_home_url_1.getItemHomeUrl(result.id, requestOptions);
|
|
111
113
|
const identifier = items_1.getItemIdentifier(item);
|
|
112
114
|
result.links.siteRelative = internalContentUtils_1.getHubRelativeUrl(result.type, identifier, item.typeKeywords);
|
|
115
|
+
result.links.workspaceRelative = getRelativeWorkspaceUrl_1.getRelativeWorkspaceUrl(result.type, identifier);
|
|
113
116
|
return result;
|
|
114
117
|
}
|
|
115
118
|
exports.enrichProjectSearchResult = enrichProjectSearchResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/projects/fetch.ts"],"names":[],"mappings":";;;AACA,iEAA0D;AAE1D,sDAAkD;AAClD,oFAA8E;AAE9E,qEAAkE;AAClE,0CAA+C;AAE/C,wDAA6D;AAC7D,sCAAoE;AAEpE,mEAAgE;AAEhE,oCAAyC;AACzC,2DAAwD;AACxD,+DAA4D;AAC5D,kCAAiC;AACjC,kDAA8C;AAC9C,gFAA0E;AAC1E,iEAA2D;AAC3D,oCAA6C;
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/projects/fetch.ts"],"names":[],"mappings":";;;AACA,iEAA0D;AAE1D,sDAAkD;AAClD,oFAA8E;AAE9E,qEAAkE;AAClE,0CAA+C;AAE/C,wDAA6D;AAC7D,sCAAoE;AAEpE,mEAAgE;AAEhE,oCAAyC;AACzC,2DAAwD;AACxD,+DAA4D;AAC5D,kCAAiC;AACjC,kDAA8C;AAC9C,gFAA0E;AAC1E,iEAA2D;AAC3D,oCAA6C;AAC7C,6EAA0E;AAE1E;;;;;GAKG;AACI,KAAK,UAAU,YAAY,CAChC,UAAkB,EAClB,cAA+B;IAE/B,IAAI,OAAO,CAAC;IACZ,IAAI,cAAM,CAAC,UAAU,CAAC,EAAE;QACtB,iBAAiB;QACjB,OAAO,GAAG,4BAAO,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;KAC/C;SAAM;QACL,OAAO,GAAG,qBAAa,CAAC,UAAU,EAAE,cAAc,CA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iB,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,wCAAiB,CAC3C,MAAM,CAAC,IAAI,EACX,UAAU,EACV,IAAI,CAAC,YAAY,CAClB,CAAC;IACF,MAAM,CAAC,KAAK,CAAC,iBAAiB,GAAG,iDAAuB,CACtD,MAAM,CAAC,IAAI,EACX,UAAU,CACX,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAhED,8DAgEC"}
|
|
@@ -4,4 +4,5 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./HubProject"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./edit"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./fetch"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./view"), exports);
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/projects/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,iDAAuB;AACvB,kDAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/projects/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B;AAC7B,iDAAuB;AACvB,kDAAwB;AACxB,iDAAuB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertProjectSearchResultToCardViewModel = exports.convertProjectEntityToCardViewModel = void 0;
|
|
4
|
+
const content_1 = require("../content");
|
|
5
|
+
const internalContentUtils_1 = require("../content/_internal/internalContentUtils");
|
|
6
|
+
const getRelativeWorkspaceUrl_1 = require("../core/getRelativeWorkspaceUrl");
|
|
7
|
+
const get_item_home_url_1 = require("../urls/get-item-home-url");
|
|
8
|
+
/**
|
|
9
|
+
* Convert a project entity into a card view model that can
|
|
10
|
+
* be consumed by the suite of hub gallery components
|
|
11
|
+
*
|
|
12
|
+
* @param project project entity
|
|
13
|
+
* @param context auth & portal information
|
|
14
|
+
* @param target card link contextual target
|
|
15
|
+
* @param locale internationalization locale
|
|
16
|
+
*/
|
|
17
|
+
exports.convertProjectEntityToCardViewModel = (project, context, target = "ago", locale = "en-US") => {
|
|
18
|
+
const titleUrl = {
|
|
19
|
+
ago: get_item_home_url_1.getItemHomeUrl(project.id, context.hubRequestOptions),
|
|
20
|
+
view: internalContentUtils_1.getHubRelativeUrl(project.type, project.id),
|
|
21
|
+
workspace: getRelativeWorkspaceUrl_1.getRelativeWorkspaceUrl(project.type, project.id),
|
|
22
|
+
}[target];
|
|
23
|
+
return Object.assign(Object.assign(Object.assign({}, getSharedProjectCardViewModel(project, locale)), { titleUrl }), (project.thumbnailUrl && { thumbnailUrl: project.thumbnailUrl }));
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Convert a project hub search result into a card view model that
|
|
27
|
+
* can be consumed by the suite of hub gallery components
|
|
28
|
+
*
|
|
29
|
+
* @param searchResult hub project search result
|
|
30
|
+
* @param target card link contextual target
|
|
31
|
+
* @param locale internationalization locale
|
|
32
|
+
*/
|
|
33
|
+
exports.convertProjectSearchResultToCardViewModel = (searchResult, target = "ago", locale = "en-US") => {
|
|
34
|
+
const titleUrl = {
|
|
35
|
+
ago: searchResult.links.self,
|
|
36
|
+
view: searchResult.links.siteRelative,
|
|
37
|
+
workspace: searchResult.links.workspaceRelative,
|
|
38
|
+
}[target];
|
|
39
|
+
return Object.assign(Object.assign(Object.assign({}, getSharedProjectCardViewModel(searchResult, locale)), { titleUrl }), (searchResult.links.thumbnail && {
|
|
40
|
+
thumbnailUrl: searchResult.links.thumbnail,
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Given a project entity OR hub serach result, construct the
|
|
45
|
+
* project's shared card view model properties
|
|
46
|
+
*
|
|
47
|
+
* @param entityOrSearchResult project entity or hub search result
|
|
48
|
+
* @param locale internationalization locale
|
|
49
|
+
*/
|
|
50
|
+
const getSharedProjectCardViewModel = (entityOrSearchResult, locale) => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
const additionalInfo = [
|
|
53
|
+
{
|
|
54
|
+
i18nKey: "type",
|
|
55
|
+
value: entityOrSearchResult.type,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
i18nKey: "dateUpdated",
|
|
59
|
+
value: entityOrSearchResult.updatedDate.toLocaleDateString(locale),
|
|
60
|
+
},
|
|
61
|
+
...(((_a = entityOrSearchResult.tags) === null || _a === void 0 ? void 0 : _a.length) ? [
|
|
62
|
+
{
|
|
63
|
+
i18nKey: "tags",
|
|
64
|
+
value: entityOrSearchResult.tags.join(", "),
|
|
65
|
+
},
|
|
66
|
+
]
|
|
67
|
+
: []),
|
|
68
|
+
...(((_b = entityOrSearchResult.categories) === null || _b === void 0 ? void 0 : _b.length) ? [
|
|
69
|
+
{
|
|
70
|
+
i18nKey: "categories",
|
|
71
|
+
value: internalContentUtils_1.getShortenedCategories(entityOrSearchResult.categories).join(", "),
|
|
72
|
+
},
|
|
73
|
+
]
|
|
74
|
+
: []),
|
|
75
|
+
{
|
|
76
|
+
i18nKey: "dateCreated",
|
|
77
|
+
value: entityOrSearchResult.createdDate.toLocaleDateString(locale),
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
return {
|
|
81
|
+
access: entityOrSearchResult.access,
|
|
82
|
+
badges: [],
|
|
83
|
+
id: entityOrSearchResult.id,
|
|
84
|
+
family: content_1.getFamily(entityOrSearchResult.type),
|
|
85
|
+
source: entityOrSearchResult.owner,
|
|
86
|
+
summary: entityOrSearchResult.summary,
|
|
87
|
+
title: entityOrSearchResult.name,
|
|
88
|
+
type: entityOrSearchResult.type,
|
|
89
|
+
additionalInfo,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.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ict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SiteSchema = exports.SiteEditorTypes = void 0;
|
|
4
|
-
const
|
|
4
|
+
const HubItemEntitySchema_1 = require("../../core/schemas/shared/HubItemEntitySchema");
|
|
5
5
|
exports.SiteEditorTypes = ["hub:site:edit"];
|
|
6
6
|
/**
|
|
7
7
|
* defines the JSON schema for a Hub Site's editable fields
|
|
8
8
|
*/
|
|
9
|
-
exports.SiteSchema = {
|
|
10
|
-
required: ["name"],
|
|
11
|
-
type: "object",
|
|
12
|
-
properties: {
|
|
13
|
-
name: shared_1.ENTITY_NAME_SCHEMA,
|
|
14
|
-
summary: {
|
|
15
|
-
type: "string",
|
|
16
|
-
},
|
|
17
|
-
description: {
|
|
18
|
-
type: "string",
|
|
19
|
-
},
|
|
20
|
-
access: shared_1.ENTITY_ACCESS_SCHEMA,
|
|
21
|
-
groups: {
|
|
22
|
-
type: "array",
|
|
23
|
-
items: {
|
|
24
|
-
type: "string",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
location: {
|
|
28
|
-
type: "object",
|
|
29
|
-
},
|
|
30
|
-
tags: shared_1.ENTITY_TAGS_SCHEMA,
|
|
31
|
-
categories: shared_1.ENTITY_CATEGORIES_SCHEMA,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
9
|
+
exports.SiteSchema = Object.assign({}, HubItemEntitySchema_1.HubItemEntitySchema);
|
|
34
10
|
//# sourceMappingURL=SiteSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SiteSchema.js","sourceRoot":"","sources":["../../../../src/sites/_internal/SiteSchema.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"SiteSchema.js","sourceRoot":"","sources":["../../../../src/sites/_internal/SiteSchema.ts"],"names":[],"mappings":";;;AACA,uFAAoF;AAGvE,QAAA,eAAe,GAAG,CAAC,eAAe,CAAU,CAAC;AAE1D;;GAEG;AACU,QAAA,UAAU,GAAyB,kBAC3C,yCAAmB,CACC,CAAC"}
|
|
@@ -349,4 +349,11 @@ export declare const getItemOrgId: (item: IItem, ownerUser?: IUser) => any;
|
|
|
349
349
|
* @returns
|
|
350
350
|
*/
|
|
351
351
|
export declare const getPublisherInfo: (item: IItem, metadata?: any, org?: Partial<IPortal>, ownerUser?: IUser) => any;
|
|
352
|
+
/**
|
|
353
|
+
* returns the last section of each category path.
|
|
354
|
+
* Example: "/categories/parent/child" > "child"
|
|
355
|
+
*
|
|
356
|
+
* @param categories an item's categories
|
|
357
|
+
*/
|
|
358
|
+
export declare const getShortenedCategories: (categories: string[]) => string[];
|
|
352
359
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IHubCardViewModel } from "../types/IHubCardViewModel";
|
|
2
|
+
export interface IWithCardBehavior {
|
|
3
|
+
/**
|
|
4
|
+
* Convert an entity into a card view model that can
|
|
5
|
+
* be consumed by the suite of hub gallery components
|
|
6
|
+
*
|
|
7
|
+
* @param target card link contextual target
|
|
8
|
+
* @param locale internationalization locale
|
|
9
|
+
*/
|
|
10
|
+
convertToCardViewModel(target: "ago" | "view" | "workspace", locale: string): IHubCardViewModel;
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From within the context of a hub site, the following util
|
|
3
|
+
* returns an entity's relative workspace URL
|
|
4
|
+
*
|
|
5
|
+
* @param type entity type
|
|
6
|
+
* @param identifier entity id or slug
|
|
7
|
+
*/
|
|
8
|
+
export declare const getRelativeWorkspaceUrl: (type: string, identifier: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isValidEntityType: (type: string) => boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IConfigurationSchema } from "../types";
|
|
2
|
+
/**
|
|
3
|
+
* Defines a default schema for an IHubItemEntity's editiable fields.
|
|
4
|
+
* All item entity schemas should leverage this base schema.
|
|
5
|
+
* Reference the Project or Initiative schemas as an example
|
|
6
|
+
*/
|
|
7
|
+
export declare const HubItemEntitySchema: IConfigurationSchema;
|
|
@@ -28,23 +28,46 @@ export declare const ENTITY_CATEGORIES_SCHEMA: {
|
|
|
28
28
|
type: string;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
export declare const
|
|
31
|
+
export declare const ENTITY_IS_DISCUSSABLE_SCHEMA: {
|
|
32
|
+
type: string;
|
|
33
|
+
enum: boolean[];
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare const ENTITY_FEATURED_CONTENT_SCHEMA: {
|
|
37
|
+
type: string;
|
|
38
|
+
maxItems: number;
|
|
39
|
+
items: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export declare const ENTITY_LOCATION_SCHEMA: {
|
|
44
|
+
type: string;
|
|
45
|
+
default: {
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare const ENTITY_IMAGE_SCHEMA: {
|
|
32
50
|
type: string;
|
|
33
51
|
properties: {
|
|
34
|
-
|
|
52
|
+
base64: {
|
|
35
53
|
type: string;
|
|
36
54
|
};
|
|
37
|
-
|
|
38
|
-
type: string
|
|
39
|
-
};
|
|
40
|
-
xmin: {
|
|
41
|
-
type: string[];
|
|
55
|
+
format: {
|
|
56
|
+
type: string;
|
|
42
57
|
};
|
|
43
|
-
|
|
44
|
-
type: string
|
|
58
|
+
fileName: {
|
|
59
|
+
type: string;
|
|
45
60
|
};
|
|
46
|
-
|
|
47
|
-
type: string
|
|
61
|
+
blob: {
|
|
62
|
+
type: string;
|
|
63
|
+
properties: {
|
|
64
|
+
type: {
|
|
65
|
+
type: string;
|
|
66
|
+
};
|
|
67
|
+
size: {
|
|
68
|
+
type: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
48
71
|
};
|
|
49
72
|
};
|
|
50
73
|
};
|
|
@@ -20,6 +20,10 @@ export interface IWithViewSettings {
|
|
|
20
20
|
* alt text of an entity's featured image
|
|
21
21
|
*/
|
|
22
22
|
featuredImageAltText?: string;
|
|
23
|
+
/**
|
|
24
|
+
* name of an entity's featured image
|
|
25
|
+
*/
|
|
26
|
+
featuredImageName?: string;
|
|
23
27
|
/**
|
|
24
28
|
* whether the entity should render it's location on a map
|
|
25
29
|
*/
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const HUB_ENTITY_TYPES: readonly ["site", "project", "initiative", "page", "discussion", "content", "org"];
|
|
2
|
+
export declare type HubEntityType = (typeof HUB_ENTITY_TYPES)[number];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AccessLevel } from "./types";
|
|
2
|
+
export interface IHubCardViewModel {
|
|
3
|
+
access?: AccessLevel;
|
|
4
|
+
id?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
source?: string;
|
|
7
|
+
summary?: string;
|
|
8
|
+
thumbnailUrl?: string;
|
|
9
|
+
titleUrl?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
family?: string;
|
|
12
|
+
badges?: IBadgeConfig[];
|
|
13
|
+
additionalInfo?: IInfoConfig[];
|
|
14
|
+
actionLinks?: ICardActionLink[];
|
|
15
|
+
index?: number;
|
|
16
|
+
}
|
|
17
|
+
interface IBadgeConfig {
|
|
18
|
+
i18nKey?: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
icon?: string;
|
|
21
|
+
color: string;
|
|
22
|
+
}
|
|
23
|
+
interface IInfoConfig {
|
|
24
|
+
i18nKey?: string;
|
|
25
|
+
label?: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}
|
|
28
|
+
interface ICardActionLink {
|
|
29
|
+
action?: string;
|
|
30
|
+
href?: string;
|
|
31
|
+
i18nKey?: string;
|
|
32
|
+
label?: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
buttonStyle?: "outline" | "outline-fill" | "solid" | "transparent";
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { IHubProject, IWithCatalogBehavior, IWithStoreBehavior, IWithSharingBehavior, UiSchemaElementOptions, IResolvedMetric } from "../core";
|
|
1
|
+
import { IHubProject, IWithCatalogBehavior, IWithStoreBehavior, IWithSharingBehavior, UiSchemaElementOptions, IResolvedMetric, IWithCardBehavior } from "../core";
|
|
2
2
|
import { Catalog } from "../search";
|
|
3
3
|
import { IArcGISContext } from "../ArcGISContext";
|
|
4
4
|
import { HubItemEntity } from "../core/HubItemEntity";
|
|
5
5
|
import { IEditorConfig } from "../core/behaviors/IWithEditorBehavior";
|
|
6
6
|
import { ProjectEditorType } from "./_internal/ProjectSchema";
|
|
7
7
|
import { IWithMetricsBehavior } from "../core/behaviors/IWithMetricsBehavior";
|
|
8
|
+
import { IHubCardViewModel } from "../core/types/IHubCardViewModel";
|
|
8
9
|
/**
|
|
9
10
|
* Hub Project Class
|
|
10
11
|
*/
|
|
11
|
-
export declare class HubProject extends HubItemEntity<IHubProject> implements IWithStoreBehavior<IHubProject>, IWithCatalogBehavior, IWithMetricsBehavior, IWithSharingBehavior {
|
|
12
|
+
export declare class HubProject extends HubItemEntity<IHubProject> implements IWithStoreBehavior<IHubProject>, IWithCatalogBehavior, IWithMetricsBehavior, IWithSharingBehavior, IWithCardBehavior {
|
|
12
13
|
private _catalog;
|
|
13
14
|
/**
|
|
14
15
|
* Private constructor so we don't have `new` all over the place. Allows for
|
|
@@ -55,6 +56,14 @@ export declare class HubProject extends HubItemEntity<IHubProject> implements IW
|
|
|
55
56
|
*/
|
|
56
57
|
static getEditorConfig(i18nScope: string, type: ProjectEditorType, options?: UiSchemaElementOptions[]): Promise<IEditorConfig>;
|
|
57
58
|
private static applyDefaults;
|
|
59
|
+
/**
|
|
60
|
+
* Convert the project entity into a card view model that can
|
|
61
|
+
* be consumed by the suite of hub gallery components
|
|
62
|
+
*
|
|
63
|
+
* @param target card link contextual target
|
|
64
|
+
* @param locale internationalization locale
|
|
65
|
+
*/
|
|
66
|
+
convertToCardViewModel(target: "ago" | "view" | "workspace", locale: string): IHubCardViewModel;
|
|
58
67
|
/**
|
|
59
68
|
* Apply a new state to the instance
|
|
60
69
|
* @param changes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IArcGISContext, IHubSearchResult } from "..";
|
|
2
|
+
import { IHubProject } from "../core";
|
|
3
|
+
import { IHubCardViewModel } from "../core/types/IHubCardViewModel";
|
|
4
|
+
/**
|
|
5
|
+
* Convert a project entity into a card view model that can
|
|
6
|
+
* be consumed by the suite of hub gallery components
|
|
7
|
+
*
|
|
8
|
+
* @param project project entity
|
|
9
|
+
* @param context auth & portal information
|
|
10
|
+
* @param target card link contextual target
|
|
11
|
+
* @param locale internationalization locale
|
|
12
|
+
*/
|
|
13
|
+
export declare const convertProjectEntityToCardViewModel: (project: IHubProject, context: IArcGISContext, target?: "ago" | "view" | "workspace", locale?: string) => IHubCardViewModel;
|
|
14
|
+
/**
|
|
15
|
+
* Convert a project hub search result into a card view model that
|
|
16
|
+
* can be consumed by the suite of hub gallery components
|
|
17
|
+
*
|
|
18
|
+
* @param searchResult hub project search result
|
|
19
|
+
* @param target card link contextual target
|
|
20
|
+
* @param locale internationalization locale
|
|
21
|
+
*/
|
|
22
|
+
export declare const convertProjectSearchResultToCardViewModel: (searchResult: IHubSearchResult, target?: "ago" | "view" | "workspace", locale?: string) => IHubCardViewModel;
|
|
@@ -60,6 +60,10 @@ export interface IHubSearchResult extends IHubEntityBase {
|
|
|
60
60
|
* Relative url of the entity, within a site
|
|
61
61
|
*/
|
|
62
62
|
siteRelative: string;
|
|
63
|
+
/**
|
|
64
|
+
* Relative workspace url of the entity, within a site
|
|
65
|
+
*/
|
|
66
|
+
workspaceRelative?: string;
|
|
63
67
|
/**
|
|
64
68
|
* Additional urls
|
|
65
69
|
*/
|