-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add embed types/interfaces (#1585)
- Loading branch information
1 parent
c87ae73
commit 0529404
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters