diff --git a/packages/common/src/core/traits/IWithViewSettings.ts b/packages/common/src/core/traits/IWithViewSettings.ts index c20027ec694..db2b66cbfe9 100644 --- a/packages/common/src/core/traits/IWithViewSettings.ts +++ b/packages/common/src/core/traits/IWithViewSettings.ts @@ -4,6 +4,7 @@ import { IMetricDisplayConfig, HubActionLink, IHubMapSettings, + HubEmbed, } from "../types"; /** @@ -58,4 +59,16 @@ export interface IWithViewSettings { * array of actions for action links */ heroActions?: HubActionLink[]; + + /** + * array of embedded content + * + * Note: for now, we are only allowing a single + * embed to be configured, but we've made this + * an array for future extensibility. If/when + * we do support configuring multiple embeds, + * we should revisit if/how this will map to a + * future layout system + */ + embeds?: HubEmbed[]; } diff --git a/packages/common/src/core/types/Embeds.ts b/packages/common/src/core/types/Embeds.ts new file mode 100644 index 00000000000..47141739418 --- /dev/null +++ b/packages/common/src/core/types/Embeds.ts @@ -0,0 +1,53 @@ +/** + * Type to represent a Hub embed. This is a discrminated + * union between app, map, survey, external, etc. embeds. + */ +export type HubEmbed = + | IHubEmbedApp + | IHubEmbedMap + | IHubEmbedSurvey + | IHubEmbedExternal; + +/** enum to discriminate between embed union members */ +export enum EmbedKind { + app = "app", + map = "map", + feedback = "feedback", + external = "external", +} + +/** base embed */ +interface IHubEmbedBase { + /** unique identifier */ + key: string; + /** embed height */ + height?: number; +} + +/** app-specific embed */ +export interface IHubEmbedApp extends IHubEmbedBase { + kind: EmbedKind.app; + /** application id */ + id: string; +} + +/** map-specific embed */ +export interface IHubEmbedMap extends IHubEmbedBase { + kind: EmbedKind.map; + /** web map/scene id */ + id: string; +} + +/** external embed */ +export interface IHubEmbedExternal extends IHubEmbedBase { + kind: EmbedKind.external; + /** embed url */ + url: string; +} + +/** survey-specific embed */ +export interface IHubEmbedSurvey extends IHubEmbedBase { + kind: EmbedKind.feedback; + /** survey123 id */ + id: string; +} diff --git a/packages/common/src/core/types/index.ts b/packages/common/src/core/types/index.ts index a11c5f874fd..c1dbc42e836 100644 --- a/packages/common/src/core/types/index.ts +++ b/packages/common/src/core/types/index.ts @@ -34,3 +34,4 @@ export * from "./IHubCardViewModel"; export * from "./Metrics"; export * from "./types"; export * from "./IHubUser"; +export * from "./Embeds";