Socket
Socket
Sign inDemoInstall

@walkme/sdk

Package Overview
Dependencies
0
Maintainers
1
Versions
132
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @walkme/sdk

Player SDK


Version published
Weekly downloads
83
increased by107.5%
Maintainers
1
Created
Weekly downloads
 

Readme

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

Last updated on 15 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc