@axceera/playstep-react 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,7 +24,8 @@ function Invoices() {
24
24
  }
25
25
  ```
26
26
 
27
- `usePlayStep()` returns the SDK (`start`, `complete`, `track`, `openLauncher`, `resetProgress`, `reset`). The provider initialises once
28
- and re-identifies when `user` changes.
27
+ `usePlayStep()` returns the SDK (`start`, `complete`, `track`, `openLauncher`, `resetProgress`, `reset`, `pause`, `resume`). The
28
+ provider initialises once and re-identifies when `user` changes; `<PlayStepProvider paused>` pauses guides for a user who should
29
+ not see them right now.
29
30
 
30
31
  Docs: https://playstep.app/docs/sdk/react
package/dist/index.d.ts CHANGED
@@ -12,13 +12,18 @@ export interface PlayStepProviderProps extends Omit<InitOptions$1, 'appKey' | 's
12
12
  appKey: string;
13
13
  /** The signed-in user. Pass null after sign-out to forget them and their guide progress. */
14
14
  user?: PlayStepUser | null;
15
+ /**
16
+ * True while this user should not see guides (a guest in this workspace, say): calls `pause()`, and `resume()` once
17
+ * it is false again. Leave it out to pause and resume yourself through usePlayStep().
18
+ */
19
+ paused?: boolean;
15
20
  children?: ReactNode;
16
21
  }
17
22
  /** Starts PlayStep once for your app and keeps the signed-in user in sync. Renders only its children. */
18
- export declare function PlayStepProvider({ appKey, user, children, ...options }: PlayStepProviderProps): import("react").JSX.Element;
23
+ export declare function PlayStepProvider({ appKey, user, paused, children, ...options }: PlayStepProviderProps): import("react").JSX.Element;
19
24
  /**
20
25
  * The PlayStep SDK: `track`, `start`, `complete`, `page`, `openLauncher` (the guide list, for your own help menu),
21
- * `resetProgress` (let users replay guides), `identify`, `reset`.
26
+ * `resetProgress` (let users replay guides), `identify`, `reset`, `pause`, `resume`, `isPaused`.
22
27
  */
23
28
  export declare function usePlayStep(): PlayStep$1;
24
29
  /** Reports one of your events when the component mounts (and again whenever `event` changes). */
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { jsx } from "react/jsx-runtime";
5
5
  //#region src/index.tsx
6
6
  const Context = createContext(playstep);
7
7
  /** Starts PlayStep once for your app and keeps the signed-in user in sync. Renders only its children. */
8
- function PlayStepProvider({ appKey, user, children, ...options }) {
8
+ function PlayStepProvider({ appKey, user, paused, children, ...options }) {
9
9
  const optionsRef = useRef(options);
10
10
  const lastUser = useRef(null);
11
11
  useEffect(() => {
@@ -25,6 +25,9 @@ function PlayStepProvider({ appKey, user, children, ...options }) {
25
25
  lastUser.current = null;
26
26
  }
27
27
  }, [user?.id, traits]);
28
+ useEffect(() => {
29
+ if (paused !== void 0) playstep[paused ? "pause" : "resume"]();
30
+ }, [paused]);
28
31
  return /* @__PURE__ */ jsx(Context.Provider, {
29
32
  value: playstep,
30
33
  children
@@ -32,7 +35,7 @@ function PlayStepProvider({ appKey, user, children, ...options }) {
32
35
  }
33
36
  /**
34
37
  * The PlayStep SDK: `track`, `start`, `complete`, `page`, `openLauncher` (the guide list, for your own help menu),
35
- * `resetProgress` (let users replay guides), `identify`, `reset`.
38
+ * `resetProgress` (let users replay guides), `identify`, `reset`, `pause`, `resume`, `isPaused`.
36
39
  */
37
40
  function usePlayStep() {
38
41
  return useContext(Context);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axceera/playstep-react",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "PlayStep for React: a provider and hooks around @axceera/playstep. Guides render in their own Shadow DOM, outside your React tree.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "react": ">=18"
23
23
  },
24
24
  "dependencies": {
25
- "@axceera/playstep": "^0.5.1"
25
+ "@axceera/playstep": "^0.6.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@testing-library/react": "^16.3.3",