diff --git a/package.json b/package.json index 5e297c2..f84dea0 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "@stackla/public-types", - "version": "1.0.8", + "version": "1.0.10", "description": "Public types for UGC Widgets", - "types": "dist/src/widgets/index.d.ts", + "types": "dist/widgets/index.d.ts", "repository": "https://github.com/Stackla/public-types", "publishConfig": { "registry": "https://npm.pkg.github.com/@stackla" diff --git a/src/widgets/components/index.ts b/src/widgets/components/index.ts new file mode 100644 index 0000000..5775e96 --- /dev/null +++ b/src/widgets/components/index.ts @@ -0,0 +1 @@ +export * from './ugc.component'; \ No newline at end of file diff --git a/src/widgets/components/ugc.component.ts b/src/widgets/components/ugc.component.ts new file mode 100644 index 0000000..1c73551 --- /dev/null +++ b/src/widgets/components/ugc.component.ts @@ -0,0 +1,8 @@ +import { IPlacement } from "../core/placement"; + +export interface IUgcComponent extends HTMLElement { + placement?: IPlacement; + getShadowRoot(): ShadowRoot; + getPlacement(): IPlacement; + getWidgetService(): any; +} diff --git a/src/widgets/core/index.ts b/src/widgets/core/index.ts new file mode 100644 index 0000000..820fe1f --- /dev/null +++ b/src/widgets/core/index.ts @@ -0,0 +1,4 @@ +export * from './placement'; +export * from './sdk'; +export * from './tile'; +export * from './widget-request'; \ No newline at end of file diff --git a/src/widgets/core/placement.ts b/src/widgets/core/placement.ts new file mode 100644 index 0000000..7df3a63 --- /dev/null +++ b/src/widgets/core/placement.ts @@ -0,0 +1,56 @@ +import { ITransformedWidgetRequest } from "./widget-request"; +import { IUgcComponent } from "../components/ugc.component"; +import { ITilesService } from "../services/tiles.service"; +import { IEventService } from "../services/event.service"; +import { Template } from "../types"; +import { Config, ExpandedTileOptions, Style, WidgetOptions, WidgetResponse } from "../widgets"; + +export interface IPlacement { + readonly selector: string; + readonly widgetContainer: WidgetResponse; + readonly widgetRequest: ITransformedWidgetRequest; + ugcComponent?: IUgcComponent; + tiles?: ITilesService; + sharedCssStyles: any; // Define a more specific type if possible + custom: any; // Define a more specific type if possible + events?: IEventService; + loadedComponents: string[]; + + attachServices(): void; + getStateFromGlobal(): any; + getEvents(): IEventService; + getLoadedComponents(): string[]; + addLoadedComponent(component: string): void; + addLoadedComponents(components: string[]): void; + getSelector(): string; + getWidgetId(): string; + getNodeName(): string; + getWidgetContainer(): WidgetResponse; + updateWidgetOptionsProperties(mutatedWidgetOptions: Partial): void; + updateWidgetStyle(mutatedStyle: Partial