genstudio-uix-sdk

@adobe/genstudio-uix-sdk


@adobe/genstudio-uix-sdk / ExperienceService

Class: ExperienceService

Manages experience data conversion and retrieval

Constructors

new ExperienceService()

new ExperienceService(): ExperienceService

Returns

ExperienceService

Methods

convertRawExperiencesToExperiences()

static convertRawExperiencesToExperiences(rawExperiences: any[]): Experience[]

Converts an array of raw experiences to Experience format

Parameters

rawExperiences

any[]

Array of raw experience data

Returns

Experience[]

Experience[] - Array of converted Experience objects


convertRawExperienceToExperience()

static convertRawExperienceToExperience(rawExperience: { fields: {}; id: string; }): Experience

Converts a raw experience object to Experience format

Parameters

rawExperience

Raw experience data from the host

fields

{}

id

string

Returns

Experience

Experience - Converted Experience object


getExperiences()

static getExperiences(connection: GuestUI<RightPanelApi>): Promise<Experience[]>

Fetches experiences from the connection

Parameters

connection

GuestUI<RightPanelApi>

The guest connection to the host

Returns

Promise<Experience[]>

Promise<Experience[]> Array of converted experiences

Throws

Error if connection is missing


getGenerationContext()

static getGenerationContext(connection: GuestUI<RightPanelApi>): Promise<GenerationContext>

Gets the generation context from the connection

Parameters

connection

GuestUI<RightPanelApi>

The guest connection to the host

Returns

Promise<GenerationContext>

The generation context

Throws

Error if connection is missing