Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@walkme/sdk

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walkme/sdk

Player SDK

  • 1.0.66
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-47.06%
Maintainers
1
Weekly downloads
 
Created
Source

WalkMe Player SDK

Abstract

A WalkMe Application runs in its own iframe but consumes the services exposed in its container by the Player.

A WalkMe Application developer may use this @walkme/sdk module to establish transparently the link with the Player, and to invoke its services.

SDK Wiring

Installation

Add this dependency to your WalkMe Application:

npm i @walkme/sdk

Production Code

import walkme from '@walkme/sdk';

You must first initialize the SDK library:

await walkme.init();

and then you can use the services.

Testing

Because the WalkMe Application acts as a client for the Player SDK services, the SDK client library requires many external parts to run, among others the actual Runtime of the SDK, owned and operated by the Player context.

For testing purposes, you may instead use the Testkit provided by the library:

import { testkitFactory } from '@walkme/sdk/dist/testkit';

const testkit = testkitFactory();
SDK Testkit

The Testkit offers a builder pattern for you to prepare various initial conditions for your test:

const {sdk} = testkit.withStorageItem( ... )
                     .withArticle( ... )
                     .with...
                     .build();

and then you can use the sdk object normally:

await sdk.init();

// example:
const myContent = await sdk.content.getContent();

please note that this capabilities are still WIP, we'll keep on improving them over time

Example

you may find a demo project with runnable test(s) at https://gitlab.walkmernd.com/David.Susskind/player-sdk-testkit-demo

code.js

import walkme from '@walkme/sdk'
export const init = walkme.init
export const getContent = (options = {}) => walkme.content.getContent(options)

code.test.js

import {init, getContent} from './code'
import {testkitFactory} from '@walkme/sdk/dist/testkit'
describe('demo test', () => {
  it('should get content from sdk', async () => {
    const {sdk} = testkitFactory().build()
    await init()

    jest.spyOn(sdk.content, 'getContent')
    await getContent({segmentation: true})

    expect(sdk.content.getContent).toHaveBeenCalledWith({segmentation: true})
  })
})

FAQs

Package last updated on 15 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc