@contrail/extensions-sdk
Advanced tools
Comparing version 1.0.2 to 1.0.3
import { User } from "@contrail/entity-types"; | ||
export declare enum VibeIQAppType { | ||
boards = "boards", | ||
plan = "plan", | ||
showcase = "showcase" | ||
BOARDS = "boards", | ||
PLAN = "plan", | ||
SHOWCASE = "showcase" | ||
} | ||
export interface AppContext { | ||
appContext?: { | ||
plan?: any; | ||
board?: any; | ||
plan?: PlanContext; | ||
board?: BoardContext; | ||
selectedElements?: any[]; | ||
@@ -16,4 +16,40 @@ vibeIQApp?: VibeIQAppType; | ||
} | ||
export interface PlanContext { | ||
id: string; | ||
name: string; | ||
orgId: string; | ||
targetAssortmentId: string; | ||
workspaceId: string; | ||
itemIds?: string[]; | ||
planPlaceholders?: any[]; | ||
filteredPlanPlaceholderIds?: string[]; | ||
hasFilter: boolean; | ||
} | ||
export interface BoardContext { | ||
id: string; | ||
name: string; | ||
orgId: string; | ||
backingAssortmentId: string; | ||
documentId: string; | ||
document: { | ||
id: string; | ||
name: string; | ||
orgId: string; | ||
ownedByReference: string; | ||
size: { | ||
width: string; | ||
height: string; | ||
}; | ||
elements: any[]; | ||
documentElementSortOrder: any; | ||
modelBindings: any; | ||
workspaceId: string; | ||
}; | ||
previewFileId: string; | ||
rootWorkspaceId: string; | ||
typeId: string; | ||
workspaceId: string; | ||
} | ||
export declare const CONTEXT: AppContext; | ||
export declare function setAppContext(context: AppContext): void; | ||
export declare function getAppContext(): AppContext; |
@@ -6,5 +6,5 @@ "use strict"; | ||
(function (VibeIQAppType) { | ||
VibeIQAppType["boards"] = "boards"; | ||
VibeIQAppType["plan"] = "plan"; | ||
VibeIQAppType["showcase"] = "showcase"; | ||
VibeIQAppType["BOARDS"] = "boards"; | ||
VibeIQAppType["PLAN"] = "plan"; | ||
VibeIQAppType["SHOWCASE"] = "showcase"; | ||
})(VibeIQAppType = exports.VibeIQAppType || (exports.VibeIQAppType = {})); | ||
@@ -11,0 +11,0 @@ exports.CONTEXT = {}; |
@@ -18,3 +18,3 @@ "use strict"; | ||
const context = (0, app_context_1.getAppContext)(); | ||
if (context.appContext.vibeIQApp !== app_context_1.VibeIQAppType.boards || !context.appContext.board) { | ||
if (context.appContext.vibeIQApp !== app_context_1.VibeIQAppType.BOARDS || !context.appContext.board) { | ||
throw new Error("App extension has not been initialized with Board context."); | ||
@@ -21,0 +21,0 @@ } |
@@ -0,3 +1,6 @@ | ||
import { PlanContext } from "./app-context"; | ||
export declare class PlanApp { | ||
static getCurrentPlan(): any; | ||
static getCurrentPlan(): PlanContext; | ||
static getAllPlanPlaceholders(): any[]; | ||
static getFilteredPlanPlaceholders(): any[]; | ||
static addRows(collectionElements: Array<any>): void; | ||
@@ -4,0 +7,0 @@ static clearSelectedRows(): void; |
@@ -11,2 +11,20 @@ "use strict"; | ||
} | ||
static getAllPlanPlaceholders() { | ||
var _a; | ||
PlanApp.validatePlanContext(); | ||
const plan = PlanApp.getCurrentPlan(); | ||
return (_a = plan === null || plan === void 0 ? void 0 : plan.planPlaceholders) !== null && _a !== void 0 ? _a : []; | ||
} | ||
static getFilteredPlanPlaceholders() { | ||
var _a; | ||
PlanApp.validatePlanContext(); | ||
const plan = PlanApp.getCurrentPlan(); | ||
const allPlanPlaceholders = PlanApp.getAllPlanPlaceholders(); | ||
if (!(plan === null || plan === void 0 ? void 0 : plan.hasFilter)) { | ||
return allPlanPlaceholders; | ||
} | ||
const filteredPlanPlaceholderIds = (_a = plan.filteredPlanPlaceholderIds) !== null && _a !== void 0 ? _a : []; | ||
const filteredResults = allPlanPlaceholders.filter((placeholder) => filteredPlanPlaceholderIds.includes(placeholder.id)); | ||
return filteredResults; | ||
} | ||
static addRows(collectionElements) { | ||
@@ -29,3 +47,3 @@ PlanApp.validatePlanContext(); | ||
const context = (0, app_context_1.getAppContext)(); | ||
if (context.appContext.vibeIQApp !== app_context_1.VibeIQAppType.plan || !context.appContext.plan) { | ||
if (context.appContext.vibeIQApp !== app_context_1.VibeIQAppType.PLAN || !context.appContext.plan) { | ||
throw new Error("App extension has not been initialized with Plan context."); | ||
@@ -32,0 +50,0 @@ } |
{ | ||
"name": "@contrail/extensions-sdk", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Client library for interfacing with VibeIQ's services and apps from an extension.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
28549
568