Link | Matterport SDK
Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.

Index

Types

CreateLinkOptions

CreateLinkOptions: object

Type declaration

  • includeParams: string[]

    The list of URL parameters to include in the share link

OpenPolicyOptions

OpenPolicyOptions: object

Type declaration

  • templateHref: string

    An optional template for the link to use when the policy is not set to SAME_FRAME, that will have any ${[param]} substrings interpolated using the current set of URL parameters.

    If ${[param]} is included in the path of the URL, it will be replaced by the current URL parameter's value or undefined (${m}/show: abc123/show).

    If ${[param]} is included in the search parameters of the URL, it and it's value wil be appended ot the URL (${m}: m=abc123).

    URL parameters that are unset will be appended without a value. (${unset}: unset)

    Note: ${m} or `${model} are special cases in model links. Instead of the current window's "model" param, the model ID from the link will be used instead.

    As an example, the string "https://my.domain.com/${m}/show.html?${play}&${unset}" interpolated at the URL https://my.domain.com/show/?m=abc123&play=1 will result in a URL like "https://my.domain.com/abc123/show.html?play=1&unset&m=abc123".

Methods

createDeepLink

  • createDeepLink(): Promise<string>
  • embed
    bundle

    Create a deep link to the current location of the current Showcase player.

    const deepLink = await sdk.Link.createDeepLink();
    

    Returns Promise<string>

createLink

  • createLink(): Promise<string>
  • embed
    bundle

    Create a shareable link to the current Showcase player.

    const link = await sdk.Link.createLink();
    

    Returns Promise<string>

setExternalLinkPolicy

  • setExternalLinkPolicy(openInNewWindow: boolean): Promise<void>
  • embed
    bundle

    Change the behavior of clicking a link to a different origin.

    sdk.Link.setExternalLinkPolicy(false);
    // clicking an external link will now navigate the current page (not the Showcase iframe) to the link
    

    Parameters

    • openInNewWindow: boolean

      Open the link in a new tab or window; otherwise, replace the embedder's window. true is the default behavior.

    Returns Promise<void>

setModelLinkPolicy

  • embed
    bundle

    Change the behavior of clicking a link to another model.

    sdk.Link.setModelLinkPolicy(sdk.Link.OpenPolicy.NEW_WINDOW);
    // clicking a link to another model will now open a new window
    

    Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

setNavigationLinkPolicy

  • embed
    bundle

    Change the behavior of clicking a link to a location within the current model.

    // when clicking a link with a location within the current model, open a new window with the model at the location
    // instead of navigating the current model to the new location
    sdk.Link.setNavigationLinkPolicy(sdk.Link.OpenPolicy.NEW_WINDOW, {
      templateHref: 'https://example.com/${m}/show.html?',
    });
    
    // revert the navigation link behavior to the default
    sdk.Link.setNavigationLinkPolicy(sdk.Link.OpenPolicy.DEFAULT);
    

    Parameters

    Returns Promise<void>

setSameOriginLinkPolicy

  • embed
    bundle

    Change the behavior of clicking a link to a page from the same origin as the one hosting Showcase.

    sdk.Link.setSameOriginLinkPolicy(sdk.Link.OpenPolicy.CURRENT_WINDOW);
    // clicking a link with the same origin as Showcase's embedder will now navigate the embedding page
    
    sdk.Link.setSameOriginLinkPolicy(sdk.Link.OpenPolicy.SAME_FRAME);
    // clicking a link with the same origin as Showcase's embedder will now navigate Showcase's iframe to that page
    

    Parameters

    Returns Promise<void>

setShareLinkPolicy

  • embed
    bundle

    Change how the link the share dialog and the createLink and createDeepLink links are created.

    await sdk.Link.setShareLinkPolicy(sdk.Link.CreationPolicy.REFERRER);
    const link = await sdk.Link.createLink();
    console.log(link); // should log a link to your page that embeds Showcase
    

    Parameters

    Returns Promise<void>