### Install Client SDK Package Source: https://github.com/sitecore/marketplace-sdk/blob/main/README.md Install the core client package required for all Marketplace applications. ```bash npm install @sitecore-marketplace-sdk/client ``` -------------------------------- ### Install Dependencies for XMC Integration Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/experimental-xmc.md Install the necessary Auth0 and Sitecore XMC SDK packages using npm. ```bash npm install @auth0/nextjs-auth0 @sitecore-marketplace-sdk/xmc ``` -------------------------------- ### Install Dependencies for Demo App Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/experimental-ai.md Install the necessary packages for integrating Sitecore's experimental AI functionality into a Next.js application. This includes Auth0 and the Sitecore Marketplace SDK. ```bash npm install @auth0/nextjs-auth0 @sitecore-marketplace-sdk/ai ``` -------------------------------- ### Install Dependencies Source: https://github.com/sitecore/marketplace-sdk/blob/main/CONTRIBUTING.md Install project dependencies using pnpm. This command should be run after forking the repository and creating a new branch. ```bash pnpm install ``` -------------------------------- ### Install AI SDK Package Source: https://github.com/sitecore/marketplace-sdk/blob/main/README.md Install the ai package if your app needs to interact with AI skills APIs. ```bash npm install @sitecore-marketplace-sdk/ai ``` -------------------------------- ### Install XMC SDK Package Source: https://github.com/sitecore/marketplace-sdk/blob/main/README.md Install the xmc package if your app needs to interact with Sitecore XM Cloud APIs. ```bash npm install @sitecore-marketplace-sdk/xmc ``` -------------------------------- ### Server-Side Token Provider Example Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/experimental-xmc.md Implement a server-side token provider for the XMC client, fetching user access tokens from a secure source. ```typescript // Example: Next.js server-side with user token const xmc = await experimental_createXMCClient({ getAccessToken: async () => { // Your server-side token logic (e.g., from session, database, etc.) return await getUserAccessToken(); }, }); ``` -------------------------------- ### Server-Side Token Provider Setup Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/experimental-ai.md Implement a server-side token provider using `experimental_createAIClient` to fetch user access tokens. This is essential for authenticating requests from your backend. ```typescript // Example: Next.js server-side with user token const ai = await experimental_createAIClient({ getAccessToken: async () => { // Your server-side token logic (e.g., from session, database, etc.) return await getUserAccessToken(); }, }); ``` -------------------------------- ### App Component Using Marketplace Client Source: https://github.com/sitecore/marketplace-sdk/blob/main/packages/client/README.md Example of a React component that uses the `useMarketplaceClient` hook to initialize the SDK and fetch application context. Handles initialization success and errors. ```typescript // src/pages/index.tsx import { useState, useEffect } from "react"; import type { ApplicationContext } from "@sitecore-marketplace-sdk/client"; import { useMarketplaceClient } from "@/utils/hooks/useMarketplaceClient"; function App() { const { client, error, isInitialized } = useMarketplaceClient(); const [appContext, setAppContext] = useState(); useEffect(() => { if (!error && isInitialized && client) { console.log("Marketplace client initialized successfully."); // Make a query to retrieve the application context client.query("application.context") .then((res) => { console.log("Success retrieving application.context:", res.data); setAppContext(res.data); }) .catch((error) => { console.error("Error retrieving application.context:", error); }); } else if (error) { console.error("Error initializing Marketplace client:", error); } }, [client, error, isInitialized]); return ( <>

Welcome to {appContext?.name}

); } export default App; ``` -------------------------------- ### Create and Use AI Client in API Route Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/experimental-ai.md Set up an API route to create an AI client using `experimental_createAIClient`. This requires an access token obtained via `auth0.getAccessToken()`. Demonstrates an example API call for generating a brand review. ```javascript import { NextResponse } from 'next/server'; import { auth0 } from '../../../lib/auth0'; import { experimental_createAIClient } from '@sitecore-marketplace-sdk/ai'; export const GET = async function aiApi() { try { const session = await auth0.getSession(); if (!session) { return NextResponse.json({ error: 'Not authenticated' }, { status: 401 }); } // Create AI client const ai = await experimental_createAIClient({ getAccessToken: async () => { const { token: accessToken } = await auth0.getAccessToken(); return accessToken; }, }); // Example API call - Brand Review const contextId = 'your-context-id'; // Replace with actual context ID const response = await ai.skills.generateBrandReview({ body: { brandkitId: 'your-brandkit-id', input: { headline: 'Your headline text', }, }, query: { sitecoreContextId: contextId }, }); return NextResponse.json(response.data); } catch (error) { return NextResponse.json({ error: error.message }, { status: error.status || 500 }); } }; ``` -------------------------------- ### xmc.sites.listSiteTemplates Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/QueryMap.md Gets the site templates available in the environment that can be used for creating sites. This method is not available for subscription. ```APIDOC ## xmc.sites.listSiteTemplates ### Description Gets the site templates available in the environment that can be used for creating sites. Learn more about [site templates](https://doc.sitecore.com/xmc/en/developers/xm-cloud/create-a-site-template-for-the-xm-cloud-dashboard.html). ### Method Not specified (likely a SDK method call) ### Parameters #### Query Parameters - **params** (Options | undefined) - Optional - Options for listing site templates. ### Response #### Success Response - **data** (SiteTemplate[]) - A list of site templates. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Error Response - **data** (undefined) - **error** (ProblemDetails) - Details about the error. ### Response Example ```json { "data": [ { "id": "string", "name": "string" } ], "request": {}, "response": {} } ``` ``` -------------------------------- ### Auth0 Integration Client-Side Example Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/experimental-xmc.md Integrate Auth0 for client-side authentication with the XMC client, using `getAccessTokenSilently` for token retrieval. ```typescript import { useUser } from '@auth0/nextjs-auth0'; const { user } = useUser(); const xmc = await experimental_createXMCClient({ getAccessToken: () => getAccessTokenSilently(), }); ``` -------------------------------- ### Example BodyAssetsUploadAsset Upload Request Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/@sitecore-marketplace-sdk/namespaces/Agent/type-aliases/BodyAssetsUploadAsset.md An example of a JSON string that can be used for the 'upload_request' property, demonstrating the expected values for asset name, item path, language, extension, and site name. ```json { "name": "example.jpg", "itemPath": "/sitecore/Media Library/Images", "language": "en", "extension": "jpg", "siteName": "MySite" } ``` -------------------------------- ### xmc.xmapp.listSiteTemplates Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/QueryMap.md Gets the site templates available in the environment that can be used for creating sites. This method is deprecated and will be removed in a future version. Use 'xmc.sites' or 'xmc.pages' instead. ```APIDOC ## xmc.xmapp.listSiteTemplates ### Description Gets the site templates available in the environment that can be used for creating sites. Learn more about [site templates](https://doc.sitecore.com/xmc/en/developers/xm-cloud/create-a-site-template-for-the-xm-cloud-dashboard.html). ### Method (Not specified, likely a SDK method call) ### Parameters #### Query Parameters - **params** (Options) - Optional - Options for listing site templates. ### Response #### Success Response - **data** (SiteTemplate[]) - A list of available site templates. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Error Response - **data** (undefined) - **error** (ProblemDetails) - Details about the error. - **request** (Request) - The request object. - **response** (Response) - The response object. ### Deprecated The 'xmc.xmapp' namespace is deprecated. Use 'xmc.sites' or 'xmc.pages' instead. Will be removed in later version. ``` -------------------------------- ### ClientSDK.init() Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/client/classes/ClientSDK.md Initializes and returns a ready-to-use ClientSDK instance. This is the entry point for setting up the SDK. ```APIDOC ## ClientSDK.init() ### Description Creates and initializes a ClientSDK instance. This static method encapsulates the logic that was formerly in create-client.ts. It builds the necessary configuration, instantiates the ClientSDK, performs the handshake, and returns an instance that is ready to execute requests. ### Parameters #### Parameters - **config** (ClientSDKInitConfig) - The configuration for the client SDK. Includes the host origin, the target window (typically window.parent), and an optional timeout. ### Returns `Promise` A Promise that resolves with an initialized and ready-to-use ClientSDK instance. ### Example ```typescript const client = await ClientSDK.init({ origin: 'https://host.app', target: window.parent, timeout: 5000 }); ``` ``` -------------------------------- ### Get Context ID using Client SDK Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/experimental-xmc.md Example of using the Sitecore Client SDK within a standalone application to retrieve context information, specifically the sitecoreContextId, which is needed for XMC package configuration. ```typescript // Using Client SDK to get context information const contextInfo = await client.query('application.context'); const contextId = contextInfo.sitecoreContextId; ``` -------------------------------- ### initialize() Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/core-sdk/classes/CoreSDK.md Initializes the SDK with basic configuration. This method sets up event listeners but doesn't perform the handshake yet. ```APIDOC ## initialize() ### Description Initializes the SDK with basic configuration. This method sets up event listeners but doesn't perform the handshake yet. For the host, this allows listening for handshake messages before the iframe is fully loaded. ### Parameters #### Parameters - **config** (`HandshakeConfig`) - Required - Handshake configuration ### Returns - `void` ### Throws - If already initialized or handshake fails ``` -------------------------------- ### experimental_createXMCClient() Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/functions/experimental_createXMCClient.md Initializes an experimental XMC client with the provided configuration. ```APIDOC ## Function: experimental_createXMCClient() > **experimental_createXMCClient**(`config`): `Promise` Defined in: [packages/xmc/src/experimental_xmc.ts:33](https://github.com/Sitecore/marketplace-sdk/blob/main/packages/xmc/src/experimental_xmc.ts#L33) ### Parameters #### Parameters - **config** (`experimental_XMCConfig`) - Required - Configuration object for the XMC client. ### Returns `Promise` - A Promise that resolves to an experimental XMC client instance. ``` -------------------------------- ### Constructor Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/core-sdk/classes/CoreSDK.md Creates a new instance of the Core SDK. If no target is provided in the config, the SDK will be initialized in "listener mode". ```APIDOC ## Constructor ### Description Creates a new instance of the Core SDK. Note: If no target is provided in the config, the SDK will be initialized in "listener mode" where it can receive messages but cannot send them until a target is set using setTarget(). ### Parameters #### Parameters - **config** (`CoreSDKConfig`) - Required - Configuration options for the SDK. ### Returns - `CoreSDK` ``` -------------------------------- ### Initialize Client SDK Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/client/classes/ClientSDK.md This static method is used to create and initialize the ClientSDK instance. It requires configuration including the host origin and target window. ```typescript const client = await ClientSDK.init({ origin: 'https://host.app', target: window.parent, timeout: 5000 }); ``` -------------------------------- ### xmc.contentTransfer.consumeFile Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/QueryMap.md Starts consuming a .raif file in the specified database. ```APIDOC ## xmc.contentTransfer.consumeFile ### Description Starts consuming a `.raif` file in the specified database. ### Method Not specified (likely POST or GET based on typical SDK patterns) ### Endpoint Not specified ### Parameters #### Query Parameters - **params** (Options) - Required - Options for the request, including data for consuming the file. ### Response #### Success Response - **data** (any) - The result of consuming the file. Specific type not detailed. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Error Response - **data** (undefined) - **error** (HttpValidationError) - Details of the HTTP validation error. ### Subscribe `false` ``` -------------------------------- ### connect() Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/core-sdk/classes/CoreSDK.md Connects the SDK by performing the handshake with the other side. For the client, this sends the handshake init message. For the host, this completes the connection once a handshake init message is received and responded to. ```APIDOC ## connect() ### Description Connects the SDK by performing the handshake with the other side. For the client, this sends the handshake init message. For the host, this completes the connection once a handshake init message is received and responded to. ### Returns - `Promise` - Promise that resolves when the connection is established ### Throws - If already initialized ``` -------------------------------- ### xmc.sites.listHosts Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/QueryMap.md Retrieves the list of hosts for a site. This method is used to get all associated hosts for a given site. ```APIDOC ## xmc.sites.listHosts ### Description Retrieves the list of hosts for a site. ### Method (Not specified, likely a SDK method call) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body - **params** (Options) - Required - Options for listing hosts. ### Request Example (Not specified) ### Response #### Success Response (200) - **data** (Host[]) - A list of Host objects. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Response Example (Not specified) ``` -------------------------------- ### xmc.pages.listPageVariants Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/QueryMap.md Fetches the identifiers of currently active personalization variants for a page. Use this to get a list of active variants. ```APIDOC ## xmc.pages.listPageVariants ### Description Fetches the identifiers of currently active personalization variants for a page. ### Method (Not specified, likely a SDK method call) ### Parameters #### Query Parameters - **params** (Options) - Required - Options for listing page variants, including data and subscription preference. ### Response #### Success Response - **data** (string[]) - An array of identifiers for active personalization variants. - **request** (Request) - The original request object. - **response** (Response) - The response object from the server. #### Error Response - **data** (string[]) - An array of identifiers for active personalization variants if available, otherwise undefined. - **error** (ProblemDetails) - Contains problem details if an error occurred. - **request** (Request) - The original request object. - **response** (Response) - The response object from the server. ``` -------------------------------- ### xmc.contentTransfer.getContentTransferStatus Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/QueryMap.md Gets the status of a content transfer by its transfer ID. This is useful for monitoring the progress of large data transfers. ```APIDOC ## xmc.contentTransfer.getContentTransferStatus ### Description Gets the status of the created content transfer by transfer ID. ### Method (Not specified, likely a SDK method call) ### Parameters #### Query Parameters - **params** (Options) - Required - Options for retrieving content transfer status, including data and subscription preference. ### Response #### Success Response - **data** (object) - Contains the state and metadata of chunk sets for the transfer. - **State** (string) - The current state of the content transfer. - **ChunkSetsMetadata** (object[]) - An array of metadata for each chunk set. - **request** (Request) - The original request object. - **response** (Response) - The response object from the server. #### Error Response - **data** (object) - Contains the state and metadata of chunk sets if available, otherwise undefined. - **error** (unknown) - Contains information about the error if data is undefined. - **request** (Request) - The original request object. - **response** (Response) - The response object from the server. ``` -------------------------------- ### ApplicationRuntimeContext Interface Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/core-sdk/interfaces/ApplicationRuntimeContext.md Represents the runtime context of an application, including details about the application itself, installation, organization, permissions, and extension points. ```APIDOC ## Interface: ApplicationRuntimeContext Represents the runtime context of an application. ### Properties - **installationId** (string) - The unique identifier for the application installation. - **MarketplaceAppTenantId?** (string) - Optional. The tenant ID associated with the Marketplace application. - **organizationId?** (string) - Optional. The ID of the organization the application belongs to. ### application An object containing details about the application. - **id** (string) - The unique identifier for the application. - **name** (string) - The name of the application. - **state** (string) - The current state of the application. - **type** (string) - The type of the application. - **url** (string) - The URL of the application. - **iconUrl?** (string) - Optional. The URL of the application's icon. ### permissions? Optional. Information about the permissions granted to the application. ### extensionPoints? Optional. An array of ApplicationExtensionPointContext objects, representing extension points available to the application. ### resourceAccess? Optional. An array of ApplicationResourceContext objects, detailing resource access for the application. ``` -------------------------------- ### ClientOptions Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/@sitecore-marketplace-sdk/namespaces/ContentTransfer/type-aliases/ClientOptions.md Defines the configuration options for the ContentTransfer client. It includes the baseUrl property, which can be a specific example URL or a general string. ```APIDOC ## Type Alias: ClientOptions > **ClientOptions** = `object` ### Properties #### baseUrl > **baseUrl**: `"https://example.com/authoring/transfer"` | `string` & `object` This property specifies the base URL for the content transfer operations. It can be set to a default example URL or a custom string representing the target URL. ``` -------------------------------- ### Navigate to Core SDK Package Source: https://github.com/sitecore/marketplace-sdk/blob/main/README.md Change the current directory to the Core SDK package folder to work with its specific scripts. ```bash cd packages/core ``` -------------------------------- ### Build All Packages Source: https://github.com/sitecore/marketplace-sdk/blob/main/README.md Transpile TypeScript and build all packages within the monorepo. ```bash pnpm build ``` -------------------------------- ### PagesGetAllowedComponentsByPlaceholderResponses Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/@sitecore-marketplace-sdk/namespaces/Agent/type-aliases/PagesGetAllowedComponentsByPlaceholderResponses.md Represents the successful response structure for an API call to get allowed components by placeholder. It is an array of ComponentShortInfo objects. ```APIDOC ## Type Alias: PagesGetAllowedComponentsByPlaceholderResponses > **PagesGetAllowedComponentsByPlaceholderResponses** = `object` This type alias represents the successful response from an API operation that retrieves a list of allowed components for a given placeholder. The response is an array of `ComponentShortInfo` objects. ### Properties #### 200 (Success Response) - **200** (ComponentShortInfo[]) - An array of `ComponentShortInfo` objects, detailing the components that are allowed to be placed in a specific placeholder. ``` -------------------------------- ### Get Value from Host Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/client/classes/ClientSDK.md Requests the current value from the host application. Returns a Promise that resolves to the value returned by the host. ```typescript const data = await client.getValue(); ``` -------------------------------- ### initialize() Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/client/classes/ClientSDK.md Initializes the client SDK by performing a handshake with the host application. This method must be called after the client script loads when running inside an iframe. ```APIDOC ## initialize() ### Description Initializes the client SDK by performing a handshake with the host application. Must be called after the client script loads (when running inside an iframe). ### Returns * `Promise` - A Promise that resolves once the handshake is successfully completed. ### Example ```typescript await client.initialize(); ``` ``` -------------------------------- ### xmc.contentTransfer.deleteContentTransfer Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/MutationMap.md Deletes the content transfer by transfer ID. Starts a clean-up of all resources related to content transfer in Source or Target environments. ```APIDOC ## xmc.contentTransfer.deleteContentTransfer ### Description Deletes the content transfer by transfer ID. Starts a clean-up of all resources related to content transfer in Source or Target environments. ### Method Not specified (likely a SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **params** (Options) - Description not specified ### Request Example None specified ### Response #### Success Response - **data** (unknown) - Description not specified - **request** (Request) - Description not specified - **response** (Response) - Description not specified #### Response Example None specified ``` -------------------------------- ### Initialize XMC Module Source: https://github.com/sitecore/marketplace-sdk/blob/main/packages/xmc/README.md Extend the Client SDK configuration to include the XMC module. This is necessary before making queries or mutations. ```typescript import { XMC } from '@sitecore-marketplace-sdk/xmc'; // ... const config = { // ... modules: [XMC] // Extend Client SDK with `XMC` }; ``` -------------------------------- ### Initialize ClientSDK Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/client/classes/ClientSDK.md Initializes the client SDK by performing a handshake with the host application. This must be called after the client script loads when running inside an iframe. ```typescript await client.initialize(); ``` -------------------------------- ### xmc.agent.pagesGetPagePathByLiveUrl Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/QueryMap.md Get the page item path corresponding to a live URL. You can use this endpoint to find the page item that corresponds to a specific live URL on your website. ```APIDOC ## xmc.agent.pagesGetPagePathByLiveUrl ### Description Get the page item path corresponding to a live URL. You can use this endpoint to find the page item that corresponds to a specific live URL on your website. ### Method (Not specified, likely a SDK method call) ### Parameters #### Path Parameters (Not specified) #### Query Parameters (Not specified) #### Request Body - **params** (Options) - Required - Options for retrieving page path by live URL. ### Request Example (Not specified) ### Response #### Success Response - **data** (PagePathByLiveUrlResponse) - The page item path corresponding to the live URL. - **request** (Request) - The original request object. - **response** (Response) - The response object. #### Response Example (Not specified) ``` -------------------------------- ### ClientSDK Constructor Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/client/classes/ClientSDK.md Initializes a new instance of the ClientSDK. This constructor is used internally and typically not called directly by users. ```APIDOC ## Constructor ### `new ClientSDK(config: ClientSDKConfig)` Initializes a new instance of the ClientSDK. #### Parameters * **config** (`ClientSDKConfig`) - The configuration object for the SDK. ``` -------------------------------- ### Variables Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/README.md Exposes the main XMC entry point or configuration variable. ```APIDOC ## Variables - [XMC](variables/XMC.md) ``` -------------------------------- ### Query Specific Page Information Source: https://github.com/sitecore/marketplace-sdk/blob/main/packages/xmc/README.md Use the `query` method with 'xmc.pages.retrievePage' to get details about a specific page. Provide the page ID and other required query parameters. ```typescript client.query("xmc.pages.retrievePage", { params: { path: { pageId, }, query: { site, sitecoreContextId, language, }, }, }).then((res) => { console.log( "Success retrieving xmc.pages.retrievePage:", res.data ); }).catch((error) => { console.error( "Error retrieving xmc.pages.retrievePage:", error ); }); ``` -------------------------------- ### xmc.sites.retrieveSitemapConfiguration Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/QueryMap.md Fetches a sitemap configuration for a given site. ```APIDOC ## xmc.sites.retrieveSitemapConfiguration ### Description Fetches a sitemap configuration. ### Method (Not explicitly defined, inferred as a query operation) ### Endpoint (Not explicitly defined) ### Parameters #### Query Parameters - **params** (Options) - Required - Options for retrieving sitemap configuration data. ### Response #### Success Response - **data** (SitemapConfiguration) - The sitemap configuration. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Error Response - **data** (undefined) - **error** (ProblemDetails) - Details about the error if the request fails. #### Response Example (Not provided in source) ``` -------------------------------- ### experimental_XMC Constructor Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/classes/EXPERIMENTAL_XMC.md Initializes a new instance of the experimental_XMC class. It requires a configuration object to set up the necessary parameters for its modules. ```APIDOC ## new experimental_XMC(config: experimental_XMCConfig) ### Description Initializes a new instance of the experimental_XMC class. ### Parameters #### Parameters - **config** (experimental_XMCConfig) - The configuration object for the experimental_XMC instance. ### Returns - experimental_XMC - A new instance of the experimental_XMC class. ``` -------------------------------- ### experimental_AI Constructor Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/ai/classes/experimental_AI.md Initializes a new instance of the experimental_AI class. This constructor requires a configuration object. ```APIDOC ## new experimental_AI(config) ### Description Initializes a new instance of the experimental_AI class. ### Parameters #### Parameters - **config** (experimental_AIConfig) - Required - The configuration object for experimental_AI. ### Returns `experimental_AI` - An instance of the experimental_AI class. ``` -------------------------------- ### SitesGetSiteIdFromItemData Structure Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/@sitecore-marketplace-sdk/namespaces/experimental_Agent/type-aliases/SitesGetSiteIdFromItemData.md Defines the structure for data used to get a site ID from item data, including optional headers, required path parameters, and optional query parameters. ```APIDOC ## Type Alias: SitesGetSiteIdFromItemData > **SitesGetSiteIdFromItemData** = `object` ### Description This type alias defines the structure for the data payload used to retrieve a site ID from item data. It includes optional `body` and `headers`, a required `path` object containing `itemId`, and an optional `query` object. ### Properties #### body > `optional` **body**: `never` #### headers > `optional` **headers**: `object` ##### x-sc-job-id > `optional` **x-sc-job-id**: `unknown` - Job ID for auditing purposes #### path > **path**: `object` ##### itemId > **itemId**: `string` #### query > `optional` **query**: `object` ##### sitecoreContextId > `optional` **sitecoreContextId**: `string` - The Sitecore context ID. #### url > **url**: `"/api/v1/sites/site-id-from-item/{itemId}"` ``` -------------------------------- ### experimental_createAIClient Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/ai/functions/experimental_createAIClient.md Creates and returns a promise that resolves to an experimental AI client instance. This function requires a configuration object to be passed as an argument. ```APIDOC ## Function: experimental_createAIClient() ### Description Initializes and returns an instance of the experimental AI client. This function is experimental and may change in future versions. ### Parameters #### Request Body - **config** (experimental_AIConfig) - Required - Configuration object for the experimental AI client. ### Returns - **Promise** - A promise that resolves to an instance of the experimental AI client. ``` -------------------------------- ### GetFavoriteSiteTemplatesErrors Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/@sitecore-marketplace-sdk/namespaces/EXPERIMENTAL_Sites/type-aliases/GetFavoriteSiteTemplatesErrors.md This type alias represents the error structure for a 'Bad request' when attempting to get favorite site templates. It maps HTTP status code 400 to a ProblemDetails object. ```APIDOC ## Type Alias: GetFavoriteSiteTemplatesErrors > **GetFavoriteSiteTemplatesErrors** = `object` This type alias defines the structure for error responses when a bad request is made to retrieve favorite site templates. It specifically details the error structure for an HTTP 400 status code. ### Properties #### 400 > **400**: [`ProblemDetails`](ProblemDetails.md) Description: Represents a "Bad request" error. This property returns a `ProblemDetails` object, which provides standardized details about the error. Defined in: [packages/xmc/src/experimental/client-sites/types.gen.ts:2016](https://github.com/Sitecore/marketplace-sdk/blob/main/packages/xmc/src/experimental/client-sites/types.gen.ts#L2016) ``` -------------------------------- ### PagesGetPageScreenshotData Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/@sitecore-marketplace-sdk/namespaces/Agent/type-aliases/PagesGetPageScreenshotData.md Defines the structure for the data required to get a page screenshot. This includes path parameters like pageId, optional query parameters for dimensions and context, and optional headers. ```APIDOC ## PagesGetPageScreenshotData ### Description This type alias defines the structure for the data payload used when requesting a screenshot of a page. It specifies the necessary path parameters, optional query parameters, and optional headers. ### Type `object` ### Properties #### path - **pageId** (string) - Required - The unique identifier of the page for which to capture a screenshot. #### query - **width** (number) - Optional - The desired width of the screenshot. - **height** (number) - Optional - The desired height of the screenshot. - **language** (string) - Optional - The language of the page content to be captured. - **sitecoreContextId** (string) - Optional - The Sitecore context ID to use for the screenshot. - **version** (number) - Required - The version of the page. #### headers - **x-sc-job-id** (unknown) - Optional - Job ID for auditing purposes. #### url - **url** (string) - The endpoint URL for retrieving the page screenshot: `/api/v1/pages/{pageId}/screenshot` ``` -------------------------------- ### xmc.xmapp.createHost Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/MutationMap.md Deprecated: Creates a host for a site. ```APIDOC ## ~~xmc.xmapp.createHost~~ ### Description Deprecated: Creates a host for a site. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body - **params** (Options) - Description not specified. ### Request Example (None specified) ### Response #### Success Response (200) - **data** (Host) - Description not specified. - **request** (Request) - Description not specified. - **response** (Response) - Description not specified. #### Response Example (None specified) #### Error Response - **data** (undefined) - Description not specified. - **error** (ProblemDetails) - Description not specified. ``` -------------------------------- ### DeleteContentTransferResponses Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/@sitecore-marketplace-sdk/namespaces/ContentTransfer/type-aliases/DeleteContentTransferResponses.md The DeleteContentTransferResponses type alias represents the possible responses when initiating a content transfer deletion. It primarily indicates that a 202 Accepted status code signifies the start of the transfer cleanup process. ```APIDOC ## Type Alias: DeleteContentTransferResponses > **DeleteContentTransferResponses** = `object` This type alias defines the structure for responses related to deleting content transfers. It primarily includes a status code indicating the outcome of the operation. ### Properties #### 202 > **202**: `unknown` This property signifies a `202 Accepted` response, indicating that the server has accepted the request to clean up the content transfer and the process has been initiated. ``` -------------------------------- ### xmc.sites.createHost Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/MutationMap.md Creates a host for a specific site. ```APIDOC ## xmc.sites.createHost ### Description Creates a host for a site. ### Method (Not explicitly defined, inferred as a method call) ### Endpoint (Not explicitly defined) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body - **params** (Options) - Options for creating the host, including necessary data. ### Request Example (Not specified) ### Response #### Success Response - **data** (Host) - The created host object. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Error Response - **data** (undefined) - **error** (ProblemDetails) - Details about the problem if an error occurred. #### Response Example (Not specified) ``` -------------------------------- ### Application Context Data Structure Source: https://github.com/sitecore/marketplace-sdk/blob/main/packages/client/README.md The application context provides essential information about your Marketplace app, including its ID, URL, name, type, icon URL, installation ID, and associated resource access. ```javascript { id: 'my-app-id', name: 'My App', type: 'portal', url: 'https://my-app.com/app', iconUrl: 'https://my-app.com/assets/icon.png', installationId: 'abc1234567890', resourceAccess: [ { resourceId: 'resource-1', tenantId: 'tenant-1', tenantName: 'Example Tenant', context: { live: '1234567890', preview: '0987654321' } } ] } ``` -------------------------------- ### xmc.xmapp.createSite Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/MutationMap.md Deprecated: Creates a new site. ```APIDOC ## ~~xmc.xmapp.createSite~~ ### Description Deprecated: Creates a new site. ### Method (Not specified in source) ### Endpoint (Not specified in source) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body - **params** (Options) - Description not specified. ### Request Example (None specified) ### Response #### Success Response (200) - **data** (Site) - Description not specified. - **request** (Request) - Description not specified. - **response** (Response) - Description not specified. #### Response Example (None specified) #### Error Response - **data** (undefined) - Description not specified. - **error** (ProblemDetails) - Description not specified. ``` -------------------------------- ### Initialize AI Module with Client SDK Source: https://github.com/sitecore/marketplace-sdk/blob/main/packages/ai/README.md Extend the Client SDK configuration to include the AI module. This is necessary before making AI-related queries or mutations. ```typescript import { AI } from '@sitecore-marketplace-sdk/ai'; // ... const config = { // ... modules: [AI] // Extend Client SDK with `AI` }; ``` -------------------------------- ### Generate Brand Review with Context ID Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/experimental-ai.md Make an API call to generate a brand review using the AI client. This example shows how to pass the `brandkitId` and input, along with the `sitecoreContextId` obtained from the client SDK. ```typescript // Use the context ID from your app installation const response = await ai.skills.generateBrandReview({ body: { brandkitId: 'your-brandkit-id', input: { headline: 'Your content to review', }, }, query: { sitecoreContextId: contextId }, }); ``` -------------------------------- ### PagesContextSiteInfo Properties Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/client/interfaces/PagesContextSiteInfo.md The PagesContextSiteInfo interface includes several optional properties for configuring site information, such as rendering engine URLs, settings, sort order, start item ID, supported languages, and thumbnail details. ```APIDOC ## PagesContextSiteInfo ### Description An interface that provides configuration details for a site within the Sitecore Marketplace SDK. ### Properties - **renderingEngineApplicationUrl** (string) - Optional - The URL for the rendering engine application. - **renderingEngineEndpointUrl** (string) - Optional - The URL for the rendering engine endpoint. - **settings** (object) - Optional - General settings for the site. This object can contain arbitrary key-value pairs. - **generateThumbnails** (string) - Optional - Specifies if thumbnails should be generated. - **thumbnailsRootPath** (string) - Optional - The root path for storing thumbnails. - **sortOrder** (number) - Optional - The sort order for the site. - **startItemId** (string) - Optional - The ID of the starting item for site navigation. - **supportedLanguages** (string[]) - Optional - An array of strings representing the supported languages for the site. - **thumbnail** (object) - Optional - Details about the site's thumbnail. - **autogenerated** (boolean) - Optional - Indicates if the thumbnail was autogenerated. - **rootPath** (string) - Optional - The root path for the thumbnail. - **url** (string) - Optional - The URL of the thumbnail. ``` -------------------------------- ### xmc.xmapp.createSite Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/MutationMap.md Creates a new site for the environment, optionally within an existing collection or by duplicating another site. Site creation utilizes site templates and associates sites with collections. ```APIDOC ## xmc.xmapp.createSite ### Description Creates a site for the environment. Sites are created using site templates and belong to a site collection. You can create a site inside an existing collection or create a new one. It is also possible to create a site by duplicating a site. ### Method (Not specified, assumed to be a function call in an SDK) ### Parameters #### Path Parameters (Not specified) #### Query Parameters (Not specified) #### Request Body - **params** (Options) - Required - Options for creating the site. ### Request Example (Not specified) ### Response #### Success Response - **data** (string) - Description of the data returned upon success. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Response Example (Not specified) ### Error Handling - **data** (undefined) - Indicates an error occurred. - **error** (ProblemDetails) - Details about the problem encountered. - **request** (Request) - The request object. - **response** (Response) - The response object. ``` -------------------------------- ### xmc.sites.createSite Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/MutationMap.md Creates a new site for the environment, optionally using site templates and belonging to a site collection. It can also duplicate an existing site. ```APIDOC ## xmc.sites.createSite ### Description Creates a new site for the environment. Sites are created using site templates. Every site belongs to a site collection. You can either create a site inside an existing collection or create a new one. It is also possible to create a site by duplicating a site. ### Method (Not specified, assumed to be a client-side SDK method) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body - **params** (Options) - Required - Options for creating the site. ### Request Example (Not specified) ### Response #### Success Response - **data** (JobResponse) - The job response for the site creation. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Error Response - **data** (undefined) - No data returned on error. - **error** (ProblemDetails) - Details about the problem. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Response Example (Not specified) ``` -------------------------------- ### PersonalizationGetPersonalizationVersionsByPageData Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/@sitecore-marketplace-sdk/namespaces/Agent/type-aliases/PersonalizationGetPersonalizationVersionsByPageData.md Defines the structure for the request to get personalization versions by page. It includes optional headers, a required path parameter for the page ID, optional query parameters for language and Sitecore context, and the URL endpoint. ```APIDOC ## PersonalizationGetPersonalizationVersionsByPageData ### Description This type alias defines the structure for a request to retrieve personalization versions associated with a specific page. It specifies the necessary path parameters, optional query parameters, and optional headers. ### Type Definition `PersonalizationGetPersonalizationVersionsByPageData` = `object` ### Properties #### path - **pageId** (string) - Required - The unique identifier of the page for which to retrieve personalization versions. #### query (optional) - **language** (string | null) - Optional - Specifies the language for the personalization versions. - **sitecoreContextId** (string) - Optional - The Sitecore context ID to use for the request. #### headers (optional) - **x-sc-job-id** (unknown) - Optional - Job ID for auditing purposes. #### url - **url**: "/api/v1/personalization/by-page/{pageId}" ``` -------------------------------- ### ComponentsGetComponentData Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/@sitecore-marketplace-sdk/namespaces/Agent/type-aliases/ComponentsGetComponentData.md Defines the structure for data related to getting component information. It includes optional headers, a required path object with componentId, and optional query parameters like sitecoreContextId. The url property specifies the endpoint. ```APIDOC ## ComponentsGetComponentData ### Description This type alias defines the structure for data used when retrieving component information. It specifies the required and optional fields for making such requests. ### Properties #### path - **componentId** (string) - Required - The unique identifier for the component. #### query (optional) - **sitecoreContextId** (string) - Optional - The Sitecore context ID to specify the context for the request. #### headers (optional) - **x-sc-job-id** (unknown) - Optional - Job ID for auditing purposes. #### url - **url**: "/api/v1/components/{componentId}" ``` -------------------------------- ### ClientOptions Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/@sitecore-marketplace-sdk/namespaces/EXPERIMENTAL_Content/type-aliases/ClientOptions.md Defines the configuration options for the experimental content client. It includes properties like `baseUrl` to specify the API endpoint. ```APIDOC ## Type Alias: ClientOptions > **ClientOptions** = `object` ### Description Defines the configuration options for the experimental content client. This type is used to specify settings when initializing the client, such as the base URL for API requests. ### Properties #### baseUrl > **baseUrl**: ` ``` -------------------------------- ### xmc.sites.createProfile Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/MutationMap.md Creates a new profile in the environment. This method takes options for creating the profile and returns the created profile model or an error. ```APIDOC ## xmc.sites.createProfile ### Description Creates a new profile in the environment. ### Method (Not specified, assumed to be a client-side SDK method) ### Parameters #### Path Parameters (None specified) #### Query Parameters (None specified) #### Request Body - **params** (Options) - Required - Options for creating the profile. ### Request Example (Not specified) ### Response #### Success Response - **data** (EditorProfileModel) - The created profile model. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Error Response - **data** (undefined) - No data returned on error. - **error** (ProblemDetails) - Details about the problem. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Response Example (Not specified) ``` -------------------------------- ### Environment Variables for Auth0 and XMC Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/experimental-xmc.md Configure environment variables in .env.local for Auth0 authentication and Sitecore experimental phase settings. Ensure APP_BASE_URL is HTTPS for iframe authentication. ```bash # Auth0 Configuration AUTH0_SECRET='LONG_RANDOM_VALUE' APP_BASE_URL='https://localhost:3000' # Must be HTTPS for iframe authentication0 AUTH0_DOMAIN='https://auth.sitecorecloud.io' AUTH0_CLIENT_ID='YOUR_AUTH0_CLIENT_ID' AUTH0_CLIENT_SECRET='YOUR_AUTH0_CLIENT_SECRET' AUTH0_AUDIENCE='https://api-webapp.sitecorecloud.io' AUTH0_SCOPE='openid profile email offline_access' # Experimental Phase Configuration SITECORE_ORGANIZATION_ID='app orgId' SITECORE_TENANT_ID='tenantId' // You can get the tenantId from stand-alone app url as you open from portal shell ``` -------------------------------- ### xmc.agent.sitesGetAllPagesBySite Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/QueryMap.md Returns a flat list of routes for the specified site and language, each with id and path. ```APIDOC ## xmc.agent.sitesGetAllPagesBySite ### Description Returns a flat list of routes for the specified site and language, each with id and path. ### Method Not specified (likely POST or GET based on typical SDK patterns) ### Endpoint Not specified ### Parameters #### Query Parameters - **params** (Options) - Required - Options for the request, including site and language data. ### Response #### Success Response - **data** (PageModel[]) - A list of page models, each containing id and path. - **request** (Request) - The request object. - **response** (Response) - The response object. #### Error Response - **data** (undefined) - **error** (HttpValidationError) - Details of the HTTP validation error. ### Subscribe `false` ``` -------------------------------- ### Create XMC Client Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/experimental-xmc.md Create an XMC client instance asynchronously by providing a function to retrieve an access token. This client can then be used to interact with Sitecore APIs. ```typescript import { experimental_createXMCClient } from '@sitecore-marketplace-sdk/xmc'; // Create client asynchronously const xmc = await experimental_createXMCClient({ getAccessToken: async () => { // Return your access token here return await getYourAccessToken(); }, }); // Use any API directly const languages = await xmc.sites.listLanguages({ query: { sitecoreContextId: 'your-context-id' }, }); ``` -------------------------------- ### xmc.live.graphql Source: https://github.com/sitecore/marketplace-sdk/blob/main/docs/modules/xmc/interfaces/MutationMap.md Send a GraphQL query request to the Sitecore GraphQL API. Mutations are not supported by the Preview API and Delivery API. ```APIDOC ## xmc.live.graphql ### Description Send a GraphQL query request to the Sitecore GraphQL API. Mutations are not supported by the Preview API and Delivery API. ### Method Not specified (likely a SDK method call) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **params** (Options) - Description not specified ### Request Example None specified ### Response #### Success Response - **data** (object) - Contains the GraphQL response data, including optional `data` and `errors` fields. - **request** (Request) - Description not specified - **response** (Response) - Description not specified #### Response Example None specified ```