1.12.0 • Published 8 months ago

@useorbital/client-sdk v1.12.0

Weekly downloads
-
License
BSD-3-Clause
Repository
-
Last release
8 months ago

Orbital SDK

This package enables in-app recruitment for your discoveries via Orbital

Documentation

You can find the SDK documentation in the Orbital Docs

Usage Examples

In order to initialize the Orbital SDK you'll need to provide your Space ID. You can find your specific Space ID within Orbital under Settings > Installation

Javascript / Typescript

import orbital from '@useorbital/client-sdk'

const orbitalSdk = await orbital('your-space-id')

React

import orbital, { OrbitalSdk } from '@useorbtial/client-sdk'
import { createContext, useContext, useState, useEffect, PropsWithChildren } from 'react'

const OrbitalContext = createContext<OrbitalSdk | undefined>(undefined)

function OrbitalProvider({ children, spaceId }: PropsWithChildren<{ spaceId: string }>) {
    const [sdk, setSdk] = useState<OrbitalSdk | undefined>(undefined)

    useEffect(() => {
        orbital(spaceId).then(setSdk)
    }, [spaceId])

    return (
      <OrbitalContext.Provider value={sdk} >
          {children}
      </OrbitalContext.Provider>
    )
}

function useOrbital(): OrbitalSdk | undefined {
    return useContext(OrbitalContext)
}

React with SSR

The Orbital SDK requires access to the window object on import. If server side rendering (SSR) is used this is usually only possible on the client. If you are using, you'll need to make sure to only import the Orbital SDK in client code.

import { OrbitalSdk } from '@useorbtial/client-sdk'
import { createContext, useContext, useState, useEffect, PropsWithChildren } from 'react'

const OrbitalContext = createContext<OrbitalSdk | undefined>(undefined)

function OrbitalProvider({ children, spaceId }: PropsWithChildren<{ spaceId: string }>) {
    const [sdk, setSdk] = useState<OrbitalSdk | undefined>(undefined)

    useEffect(() => {
        import('@useorbtial/client-sdk')
          .then(({ default: orbital }) => orbital(spaceId))
          .then(setSdk)
    }, [spaceId])

    return (
      <OrbitalContext.Provider value={sdk} >
          {children}
      </OrbitalContext.Provider>
    )
}

function useOrbital(): OrbitalSdk | undefined {
    return useContext(OrbitalContext)
}

Changelog

1.12.0 (2024-11-04)

Features

  • sdk: add support for dom content conditions (#503) 5f06e67

1.11.0 (2024-11-04)

Features

  • api: add dom content location trigger (#501) 0b6631d
  • ui: redux rewrite (#435) d52c2d7

Bug Fixes

  • sdk: read correct env variables for version increments (#479) deaac58

1.9.0 (2024-10-17)

Features

  • sdk: support research panel trigger (#415) 60a2e82

1.8.0 (2024-09-10)

Features

  • client-ui: apply session cooldown locally on scheduling (#417) 2176674

1.7.0 (2024-08-19)

Features

  • multiple: remove references to external_id from ui and sdk types (#391) 9ccd1f3

1.6.2 (2024-08-14)

1.6.1 (2024-08-12)

1.6.0 (2024-08-09)

Features

  • sdk: add support for discovery triggers v2 (#354) 8851d09

1.5.0 (2024-06-26)

Features

  • demo: replace demo ui with solid background (#278) c6efb82

1.4.1 (2024-06-20)

Bug Fixes

  • sdk: simplify trigger detection for interaction triggers (#267) df8f815

1.4.0 (2024-05-23)

Features

  • ui: intercept v2 (#221) aa4a649

1.3.0 (2024-05-03)

Features

  • client: support arbitrary identity types (#186) 3eacb4f, closes useorbital/orbital-api#230

1.2.1 (2024-04-26)

1.2.0 (2024-04-11)

Features

  • sdk: support extended path matching for discoveries (#190) 79df588

1.1.1 (2024-04-04)

1.1.0 (2024-03-12)

Features

  • client-sdk: use the correct default client origin url and provide sdk version to client (#157) 8492219

1.0.0 (2024-02-01)

⚠ BREAKING CHANGES

  • sdk: initial release (#130)

Features

  • sdk: initial release (#130) 1130f6a
1.12.0

8 months ago

1.11.0

8 months ago

1.9.0

9 months ago

1.10.0

9 months ago

1.8.0

10 months ago

1.7.0

11 months ago

1.6.2

11 months ago

1.6.1

11 months ago

1.6.0

11 months ago

1.5.0

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago

0.3.1

1 year ago