@player-ui/storybook 0.3.0-next.3 → 0.3.0-next.4

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/dist/index.cjs.js CHANGED
@@ -404,9 +404,9 @@ class StorybookPlayerPlugin {
404
404
  apply(player) {
405
405
  player.registerPlugin(this.metricsPlugin);
406
406
  }
407
- applyWeb(wp) {
408
- wp.registerPlugin(this.metricsPlugin);
409
- wp.player.hooks.dataController.tap(this.name, (dc) => {
407
+ applyReact(rp) {
408
+ rp.registerPlugin(this.metricsPlugin);
409
+ rp.player.hooks.dataController.tap(this.name, (dc) => {
410
410
  this.actions.clearEvents();
411
411
  dc.hooks.onUpdate.tap(this.name, (dataUpdates) => {
412
412
  const events = dataUpdates.map((dataUpdate) => createEvent({
@@ -418,7 +418,7 @@ class StorybookPlayerPlugin {
418
418
  this.actions.addEvents(events);
419
419
  });
420
420
  });
421
- wp.player.logger.hooks.log.tap(this.name, (severity, data) => {
421
+ rp.player.logger.hooks.log.tap(this.name, (severity, data) => {
422
422
  this.actions.addEvents([
423
423
  createEvent({
424
424
  type: "log",
@@ -427,7 +427,7 @@ class StorybookPlayerPlugin {
427
427
  })
428
428
  ]);
429
429
  });
430
- wp.player.hooks.state.tap(this.name, (newState) => {
430
+ rp.player.hooks.state.tap(this.name, (newState) => {
431
431
  if ("error" in newState) {
432
432
  this.actions.addEvents([
433
433
  createEvent({
@@ -533,7 +533,7 @@ var __async = (__this, __arguments, generator) => {
533
533
  step((generator = generator.apply(__this, __arguments)).next());
534
534
  });
535
535
  };
536
- const WebPlayerPluginContext = React__default["default"].createContext({ plugins: [] });
536
+ const ReactPlayerPluginContext = React__default["default"].createContext({ plugins: [] });
537
537
  const PlayerRenderContext = React__default["default"].createContext({
538
538
  platform: "web"
539
539
  });
@@ -545,16 +545,16 @@ const LocalPlayerStory = (props) => {
545
545
  var _a, _b;
546
546
  let flow = useEditorFlow(props.flow);
547
547
  const renderContext = React__default["default"].useContext(PlayerRenderContext);
548
- const pluginContext = React__default["default"].useContext(WebPlayerPluginContext);
548
+ const pluginContext = React__default["default"].useContext(ReactPlayerPluginContext);
549
549
  const controlsContext = React__default["default"].useContext(StorybookControlsContext);
550
550
  const optionsContext = React__default["default"].useContext(PlayerOptionsContext);
551
551
  const options = __spreadValues({}, optionsContext == null ? void 0 : optionsContext.options);
552
552
  const stateActions = useStateActions(addons__default["default"].getChannel());
553
553
  const plugins = (_b = (_a = props.webPlugins) != null ? _a : pluginContext == null ? void 0 : pluginContext.plugins) != null ? _b : [];
554
554
  const [playerState, setPlayerState] = React__default["default"].useState("not-started");
555
- const wp = React__default["default"].useMemo(() => {
555
+ const rp = React__default["default"].useMemo(() => {
556
556
  var _a2;
557
- return new react$1.WebPlayer(__spreadProps(__spreadValues({}, options), {
557
+ return new react$1.ReactPlayer(__spreadProps(__spreadValues({}, options), {
558
558
  plugins: [
559
559
  new StorybookPlayerPlugin(stateActions),
560
560
  ...plugins,
@@ -564,7 +564,7 @@ const LocalPlayerStory = (props) => {
564
564
  }, [plugins]);
565
565
  const startFlow = () => {
566
566
  setPlayerState("in-progress");
567
- wp.start(flow).then(() => {
567
+ rp.start(flow).then(() => {
568
568
  setPlayerState("completed");
569
569
  }).catch((e) => {
570
570
  console.error("Error starting flow", e);
@@ -573,7 +573,7 @@ const LocalPlayerStory = (props) => {
573
573
  };
574
574
  React__default["default"].useEffect(() => {
575
575
  startFlow();
576
- }, [wp, flow]);
576
+ }, [rp, flow]);
577
577
  React__default["default"].useEffect(() => {
578
578
  var _a2;
579
579
  if (controlsContext) {
@@ -587,7 +587,7 @@ const LocalPlayerStory = (props) => {
587
587
  return subscribe(addons__default["default"].getChannel(), "@@player/flow/reset", () => {
588
588
  startFlow();
589
589
  });
590
- }, [wp, flow]);
590
+ }, [rp, flow]);
591
591
  if (renderContext.platform !== "web" && renderContext.token) {
592
592
  return /* @__PURE__ */ React__default["default"].createElement(Appetize, {
593
593
  flow,
@@ -597,7 +597,7 @@ const LocalPlayerStory = (props) => {
597
597
  osVersions: renderContext.appetizeVersions
598
598
  });
599
599
  }
600
- const currentState = wp.player.getState();
600
+ const currentState = rp.player.getState();
601
601
  if (playerState === "completed" && currentState.status === "completed") {
602
602
  return /* @__PURE__ */ React__default["default"].createElement(PlayerFlowSummary, {
603
603
  reset: startFlow,
@@ -610,7 +610,7 @@ const LocalPlayerStory = (props) => {
610
610
  error: currentState.error
611
611
  });
612
612
  }
613
- return /* @__PURE__ */ React__default["default"].createElement(wp.Component, null);
613
+ return /* @__PURE__ */ React__default["default"].createElement(rp.Component, null);
614
614
  };
615
615
  function wrapInLazy(Component, flowFactory, other) {
616
616
  const asPlayer = () => __async(this, null, function* () {
@@ -657,8 +657,8 @@ const PlayerDecorator = (story, ctx) => {
657
657
  baseUrl: playerParams.appetizeBaseUrl,
658
658
  appetizeVersions: playerParams.appetizeVersions
659
659
  }
660
- }, /* @__PURE__ */ React__default["default"].createElement(WebPlayerPluginContext.Provider, {
661
- value: { plugins: playerParams.webplayerPlugins }
660
+ }, /* @__PURE__ */ React__default["default"].createElement(ReactPlayerPluginContext.Provider, {
661
+ value: { plugins: playerParams.reactPlayerPlugins }
662
662
  }, story()));
663
663
  };
664
664
 
@@ -666,7 +666,7 @@ exports.PlayerDecorator = PlayerDecorator;
666
666
  exports.PlayerOptionsContext = PlayerOptionsContext;
667
667
  exports.PlayerRenderContext = PlayerRenderContext;
668
668
  exports.PlayerStory = PlayerStory;
669
+ exports.ReactPlayerPluginContext = ReactPlayerPluginContext;
669
670
  exports.StorybookControlsContext = StorybookControlsContext;
670
- exports.WebPlayerPluginContext = WebPlayerPluginContext;
671
671
  exports.register = register;
672
672
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DecoratorFn } from '@storybook/react';
2
2
  import React from 'react';
3
- import { WebPlayerPlugin, Flow, WebPlayerOptions } from '@player-ui/react';
3
+ import { ReactPlayerPlugin, Flow, ReactPlayerOptions } from '@player-ui/react';
4
4
 
5
5
  /** register all the storybook addons */
6
6
  declare function register(): void;
@@ -32,9 +32,9 @@ declare type RenderTarget = {
32
32
  appetizeVersions?: AppetizeVersions;
33
33
  };
34
34
 
35
- declare const WebPlayerPluginContext: React.Context<{
35
+ declare const ReactPlayerPluginContext: React.Context<{
36
36
  /** Web plugins to load into Player */
37
- plugins?: WebPlayerPlugin[] | undefined;
37
+ plugins?: ReactPlayerPlugin[] | undefined;
38
38
  }>;
39
39
  declare const PlayerRenderContext: React.Context<RenderTarget>;
40
40
  declare const StorybookControlsContext: React.Context<{
@@ -43,7 +43,7 @@ declare const StorybookControlsContext: React.Context<{
43
43
  }>;
44
44
  declare const PlayerOptionsContext: React.Context<{
45
45
  /** these are options such as suspend, or plugins */
46
- options?: WebPlayerOptions | undefined;
46
+ options?: ReactPlayerOptions | undefined;
47
47
  }>;
48
48
  declare type Mock = Record<string, unknown>;
49
49
  declare type MockFactory = () => Mock;
@@ -56,7 +56,7 @@ interface PlayerStoryProps {
56
56
  /** props from storybook controls */
57
57
  storybookControls?: Flow['data'];
58
58
  /** options, like suspend and plugins */
59
- options?: WebPlayerOptions;
59
+ options?: ReactPlayerOptions;
60
60
  }
61
61
  /**
62
62
  * Takes an initial flow and renders it as a story in storybook.
@@ -64,4 +64,4 @@ interface PlayerStoryProps {
64
64
  */
65
65
  declare const PlayerStory: (props: PlayerStoryProps) => JSX.Element;
66
66
 
67
- export { PlayerDecorator, PlayerOptionsContext, PlayerRenderContext, PlayerStory, PlayerStoryProps, StorybookControlsContext, WebPlayerPluginContext, register };
67
+ export { PlayerDecorator, PlayerOptionsContext, PlayerRenderContext, PlayerStory, PlayerStoryProps, ReactPlayerPluginContext, StorybookControlsContext, register };
package/dist/index.esm.js CHANGED
@@ -9,7 +9,7 @@ import makeClass from 'clsx';
9
9
  import { Separator, IconButton, Icons, WithTooltip, TooltipLinkList } from '@storybook/components';
10
10
  import { useParameter } from '@storybook/api';
11
11
  import { STORY_CHANGED } from '@storybook/core-events';
12
- import { WebPlayer } from '@player-ui/react';
12
+ import { ReactPlayer } from '@player-ui/react';
13
13
  import { VStack, Heading, Code, Text, Button, ChakraProvider, Spinner } from '@chakra-ui/react';
14
14
  import { makeFlow } from '@player-ui/make-flow';
15
15
  import { DocsContext } from '@storybook/addon-docs';
@@ -393,9 +393,9 @@ class StorybookPlayerPlugin {
393
393
  apply(player) {
394
394
  player.registerPlugin(this.metricsPlugin);
395
395
  }
396
- applyWeb(wp) {
397
- wp.registerPlugin(this.metricsPlugin);
398
- wp.player.hooks.dataController.tap(this.name, (dc) => {
396
+ applyReact(rp) {
397
+ rp.registerPlugin(this.metricsPlugin);
398
+ rp.player.hooks.dataController.tap(this.name, (dc) => {
399
399
  this.actions.clearEvents();
400
400
  dc.hooks.onUpdate.tap(this.name, (dataUpdates) => {
401
401
  const events = dataUpdates.map((dataUpdate) => createEvent({
@@ -407,7 +407,7 @@ class StorybookPlayerPlugin {
407
407
  this.actions.addEvents(events);
408
408
  });
409
409
  });
410
- wp.player.logger.hooks.log.tap(this.name, (severity, data) => {
410
+ rp.player.logger.hooks.log.tap(this.name, (severity, data) => {
411
411
  this.actions.addEvents([
412
412
  createEvent({
413
413
  type: "log",
@@ -416,7 +416,7 @@ class StorybookPlayerPlugin {
416
416
  })
417
417
  ]);
418
418
  });
419
- wp.player.hooks.state.tap(this.name, (newState) => {
419
+ rp.player.hooks.state.tap(this.name, (newState) => {
420
420
  if ("error" in newState) {
421
421
  this.actions.addEvents([
422
422
  createEvent({
@@ -522,7 +522,7 @@ var __async = (__this, __arguments, generator) => {
522
522
  step((generator = generator.apply(__this, __arguments)).next());
523
523
  });
524
524
  };
525
- const WebPlayerPluginContext = React.createContext({ plugins: [] });
525
+ const ReactPlayerPluginContext = React.createContext({ plugins: [] });
526
526
  const PlayerRenderContext = React.createContext({
527
527
  platform: "web"
528
528
  });
@@ -534,16 +534,16 @@ const LocalPlayerStory = (props) => {
534
534
  var _a, _b;
535
535
  let flow = useEditorFlow(props.flow);
536
536
  const renderContext = React.useContext(PlayerRenderContext);
537
- const pluginContext = React.useContext(WebPlayerPluginContext);
537
+ const pluginContext = React.useContext(ReactPlayerPluginContext);
538
538
  const controlsContext = React.useContext(StorybookControlsContext);
539
539
  const optionsContext = React.useContext(PlayerOptionsContext);
540
540
  const options = __spreadValues({}, optionsContext == null ? void 0 : optionsContext.options);
541
541
  const stateActions = useStateActions(addons.getChannel());
542
542
  const plugins = (_b = (_a = props.webPlugins) != null ? _a : pluginContext == null ? void 0 : pluginContext.plugins) != null ? _b : [];
543
543
  const [playerState, setPlayerState] = React.useState("not-started");
544
- const wp = React.useMemo(() => {
544
+ const rp = React.useMemo(() => {
545
545
  var _a2;
546
- return new WebPlayer(__spreadProps(__spreadValues({}, options), {
546
+ return new ReactPlayer(__spreadProps(__spreadValues({}, options), {
547
547
  plugins: [
548
548
  new StorybookPlayerPlugin(stateActions),
549
549
  ...plugins,
@@ -553,7 +553,7 @@ const LocalPlayerStory = (props) => {
553
553
  }, [plugins]);
554
554
  const startFlow = () => {
555
555
  setPlayerState("in-progress");
556
- wp.start(flow).then(() => {
556
+ rp.start(flow).then(() => {
557
557
  setPlayerState("completed");
558
558
  }).catch((e) => {
559
559
  console.error("Error starting flow", e);
@@ -562,7 +562,7 @@ const LocalPlayerStory = (props) => {
562
562
  };
563
563
  React.useEffect(() => {
564
564
  startFlow();
565
- }, [wp, flow]);
565
+ }, [rp, flow]);
566
566
  React.useEffect(() => {
567
567
  var _a2;
568
568
  if (controlsContext) {
@@ -576,7 +576,7 @@ const LocalPlayerStory = (props) => {
576
576
  return subscribe(addons.getChannel(), "@@player/flow/reset", () => {
577
577
  startFlow();
578
578
  });
579
- }, [wp, flow]);
579
+ }, [rp, flow]);
580
580
  if (renderContext.platform !== "web" && renderContext.token) {
581
581
  return /* @__PURE__ */ React.createElement(Appetize, {
582
582
  flow,
@@ -586,7 +586,7 @@ const LocalPlayerStory = (props) => {
586
586
  osVersions: renderContext.appetizeVersions
587
587
  });
588
588
  }
589
- const currentState = wp.player.getState();
589
+ const currentState = rp.player.getState();
590
590
  if (playerState === "completed" && currentState.status === "completed") {
591
591
  return /* @__PURE__ */ React.createElement(PlayerFlowSummary, {
592
592
  reset: startFlow,
@@ -599,7 +599,7 @@ const LocalPlayerStory = (props) => {
599
599
  error: currentState.error
600
600
  });
601
601
  }
602
- return /* @__PURE__ */ React.createElement(wp.Component, null);
602
+ return /* @__PURE__ */ React.createElement(rp.Component, null);
603
603
  };
604
604
  function wrapInLazy(Component, flowFactory, other) {
605
605
  const asPlayer = () => __async(this, null, function* () {
@@ -646,10 +646,10 @@ const PlayerDecorator = (story, ctx) => {
646
646
  baseUrl: playerParams.appetizeBaseUrl,
647
647
  appetizeVersions: playerParams.appetizeVersions
648
648
  }
649
- }, /* @__PURE__ */ React.createElement(WebPlayerPluginContext.Provider, {
650
- value: { plugins: playerParams.webplayerPlugins }
649
+ }, /* @__PURE__ */ React.createElement(ReactPlayerPluginContext.Provider, {
650
+ value: { plugins: playerParams.reactPlayerPlugins }
651
651
  }, story()));
652
652
  };
653
653
 
654
- export { PlayerDecorator, PlayerOptionsContext, PlayerRenderContext, PlayerStory, StorybookControlsContext, WebPlayerPluginContext, register };
654
+ export { PlayerDecorator, PlayerOptionsContext, PlayerRenderContext, PlayerStory, ReactPlayerPluginContext, StorybookControlsContext, register };
655
655
  //# sourceMappingURL=index.esm.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@player-ui/storybook",
3
- "version": "0.3.0-next.3",
3
+ "version": "0.3.0-next.4",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
@@ -11,8 +11,8 @@
11
11
  "@storybook/addon-docs": "^6.4.15",
12
12
  "react": "^17.0.2",
13
13
  "@types/react": "^17.0.25",
14
- "@player-ui/react": "0.3.0-next.3",
15
- "@player-ui/make-flow": "0.3.0-next.3"
14
+ "@player-ui/react": "0.3.0-next.4",
15
+ "@player-ui/make-flow": "0.3.0-next.4"
16
16
  },
17
17
  "dependencies": {
18
18
  "@monaco-editor/react": "^4.3.1",
@@ -28,7 +28,7 @@
28
28
  "dequal": "^2.0.2",
29
29
  "ts-debounce": "^4.0.0",
30
30
  "uuid": "^8.3.2",
31
- "@player-ui/metrics-plugin-react": "0.3.0-next.3",
31
+ "@player-ui/metrics-plugin-react": "0.3.0-next.4",
32
32
  "@babel/runtime": "7.15.4"
33
33
  },
34
34
  "main": "dist/index.cjs.js",
@@ -3,7 +3,7 @@ import type { DecoratorFn } from '@storybook/react';
3
3
  import addons from '@storybook/addons';
4
4
  import type { PlatformSetType } from '../state/hooks';
5
5
  import { subscribe } from '../state/hooks';
6
- import { WebPlayerPluginContext, PlayerRenderContext } from '../player';
6
+ import { ReactPlayerPluginContext, PlayerRenderContext } from '../player';
7
7
  import type { PlayerParametersType, RenderTarget } from '../types';
8
8
 
9
9
  /**
@@ -36,11 +36,11 @@ export const PlayerDecorator: DecoratorFn = (story, ctx) => {
36
36
  appetizeVersions: playerParams.appetizeVersions,
37
37
  }}
38
38
  >
39
- <WebPlayerPluginContext.Provider
40
- value={{ plugins: playerParams.webplayerPlugins }}
39
+ <ReactPlayerPluginContext.Provider
40
+ value={{ plugins: playerParams.reactPlayerPlugins }}
41
41
  >
42
42
  {story()}
43
- </WebPlayerPluginContext.Provider>
43
+ </ReactPlayerPluginContext.Provider>
44
44
  </PlayerRenderContext.Provider>
45
45
  );
46
46
  };
@@ -1,18 +1,18 @@
1
1
  import React from 'react';
2
2
  import type {
3
- WebPlayerPlugin,
3
+ ReactPlayerPlugin,
4
4
  PlayerFlowStatus,
5
5
  Flow,
6
- WebPlayerOptions,
6
+ ReactPlayerOptions,
7
7
  } from '@player-ui/react';
8
- import { WebPlayer } from '@player-ui/react';
8
+ import { ReactPlayer } from '@player-ui/react';
9
9
  import { ChakraProvider, Spinner } from '@chakra-ui/react';
10
10
  import { makeFlow } from '@player-ui/make-flow';
11
11
  import addons from '@storybook/addons';
12
12
  import type { AsyncImportFactory, RenderTarget } from '../types';
13
13
  import { useEditorFlow } from './hooks';
14
14
  import { Appetize } from './Appetize';
15
- import { StorybookPlayerPlugin } from './storybookWebPlayerPlugin';
15
+ import { StorybookPlayerPlugin } from './storybookReactPlayerPlugin';
16
16
  import { useStateActions, subscribe } from '../state/hooks';
17
17
  import { PlayerFlowSummary } from './PlayerFlowSummary';
18
18
 
@@ -21,12 +21,12 @@ interface LocalPlayerStory {
21
21
  flow: Flow;
22
22
 
23
23
  /** Web plugins to load into Player */
24
- webPlugins?: Array<WebPlayerPlugin>;
24
+ webPlugins?: Array<ReactPlayerPlugin>;
25
25
  }
26
26
 
27
- export const WebPlayerPluginContext = React.createContext<{
27
+ export const ReactPlayerPluginContext = React.createContext<{
28
28
  /** Web plugins to load into Player */
29
- plugins?: Array<WebPlayerPlugin>;
29
+ plugins?: Array<ReactPlayerPlugin>;
30
30
  }>({ plugins: [] });
31
31
 
32
32
  export const PlayerRenderContext = React.createContext<RenderTarget>({
@@ -42,7 +42,7 @@ export const StorybookControlsContext = React.createContext<{
42
42
 
43
43
  export const PlayerOptionsContext = React.createContext<{
44
44
  /** these are options such as suspend, or plugins */
45
- options?: WebPlayerOptions;
45
+ options?: ReactPlayerOptions;
46
46
  }>({ options: {} });
47
47
 
48
48
  /** A component to render a player + flow */
@@ -50,7 +50,7 @@ const LocalPlayerStory = (props: LocalPlayerStory) => {
50
50
  let flow = useEditorFlow(props.flow);
51
51
 
52
52
  const renderContext = React.useContext(PlayerRenderContext);
53
- const pluginContext = React.useContext(WebPlayerPluginContext);
53
+ const pluginContext = React.useContext(ReactPlayerPluginContext);
54
54
  const controlsContext = React.useContext(StorybookControlsContext);
55
55
  const optionsContext = React.useContext(PlayerOptionsContext);
56
56
  const options = { ...optionsContext?.options };
@@ -59,8 +59,8 @@ const LocalPlayerStory = (props: LocalPlayerStory) => {
59
59
  const [playerState, setPlayerState] =
60
60
  React.useState<PlayerFlowStatus>('not-started');
61
61
 
62
- const wp = React.useMemo(() => {
63
- return new WebPlayer({
62
+ const rp = React.useMemo(() => {
63
+ return new ReactPlayer({
64
64
  ...options,
65
65
  plugins: [
66
66
  new StorybookPlayerPlugin(stateActions),
@@ -73,7 +73,7 @@ const LocalPlayerStory = (props: LocalPlayerStory) => {
73
73
  /** A callback to start the flow */
74
74
  const startFlow = () => {
75
75
  setPlayerState('in-progress');
76
- wp.start(flow)
76
+ rp.start(flow)
77
77
  .then(() => {
78
78
  setPlayerState('completed');
79
79
  })
@@ -85,7 +85,7 @@ const LocalPlayerStory = (props: LocalPlayerStory) => {
85
85
 
86
86
  React.useEffect(() => {
87
87
  startFlow();
88
- }, [wp, flow]);
88
+ }, [rp, flow]);
89
89
 
90
90
  React.useEffect(() => {
91
91
  // merge new data from storybook controls
@@ -105,7 +105,7 @@ const LocalPlayerStory = (props: LocalPlayerStory) => {
105
105
  return subscribe(addons.getChannel(), '@@player/flow/reset', () => {
106
106
  startFlow();
107
107
  });
108
- }, [wp, flow]);
108
+ }, [rp, flow]);
109
109
 
110
110
  if (renderContext.platform !== 'web' && renderContext.token) {
111
111
  return (
@@ -119,7 +119,7 @@ const LocalPlayerStory = (props: LocalPlayerStory) => {
119
119
  );
120
120
  }
121
121
 
122
- const currentState = wp.player.getState();
122
+ const currentState = rp.player.getState();
123
123
 
124
124
  if (playerState === 'completed' && currentState.status === 'completed') {
125
125
  return (
@@ -134,7 +134,7 @@ const LocalPlayerStory = (props: LocalPlayerStory) => {
134
134
  return <PlayerFlowSummary reset={startFlow} error={currentState.error} />;
135
135
  }
136
136
 
137
- return <wp.Component />;
137
+ return <rp.Component />;
138
138
  };
139
139
 
140
140
  type Mock = Record<string, unknown>;
@@ -185,7 +185,7 @@ export interface PlayerStoryProps {
185
185
  /** props from storybook controls */
186
186
  storybookControls?: Flow['data'];
187
187
  /** options, like suspend and plugins */
188
- options?: WebPlayerOptions;
188
+ options?: ReactPlayerOptions;
189
189
  }
190
190
 
191
191
  /**
@@ -1,4 +1,4 @@
1
- import type { WebPlayer, Player, WebPlayerPlugin } from '@player-ui/react';
1
+ import type { ReactPlayer, Player, ReactPlayerPlugin } from '@player-ui/react';
2
2
  import type { Timing } from '@player-ui/metrics-plugin-react';
3
3
  import { MetricsPlugin } from '@player-ui/metrics-plugin-react';
4
4
  import type {
@@ -14,7 +14,7 @@ import { createEvent } from '../state';
14
14
  *
15
15
  * A web plugin for interacting with storybook
16
16
  */
17
- export class StorybookPlayerPlugin implements WebPlayerPlugin {
17
+ export class StorybookPlayerPlugin implements ReactPlayerPlugin {
18
18
  public readonly name = 'Storybook';
19
19
 
20
20
  private actions: StateActions;
@@ -39,10 +39,10 @@ export class StorybookPlayerPlugin implements WebPlayerPlugin {
39
39
  player.registerPlugin(this.metricsPlugin);
40
40
  }
41
41
 
42
- applyWeb(wp: WebPlayer) {
43
- wp.registerPlugin(this.metricsPlugin);
42
+ applyReact(rp: ReactPlayer) {
43
+ rp.registerPlugin(this.metricsPlugin);
44
44
 
45
- wp.player.hooks.dataController.tap(this.name, (dc) => {
45
+ rp.player.hooks.dataController.tap(this.name, (dc) => {
46
46
  this.actions.clearEvents();
47
47
 
48
48
  dc.hooks.onUpdate.tap(this.name, (dataUpdates) => {
@@ -59,7 +59,7 @@ export class StorybookPlayerPlugin implements WebPlayerPlugin {
59
59
  });
60
60
  });
61
61
 
62
- wp.player.logger.hooks.log.tap(this.name, (severity, data) => {
62
+ rp.player.logger.hooks.log.tap(this.name, (severity, data) => {
63
63
  this.actions.addEvents([
64
64
  createEvent<LogEventType>({
65
65
  type: 'log',
@@ -69,7 +69,7 @@ export class StorybookPlayerPlugin implements WebPlayerPlugin {
69
69
  ]);
70
70
  });
71
71
 
72
- wp.player.hooks.state.tap(this.name, (newState) => {
72
+ rp.player.hooks.state.tap(this.name, (newState) => {
73
73
  if ('error' in newState) {
74
74
  this.actions.addEvents([
75
75
  createEvent<StateChangeEventType>({
package/src/types.ts CHANGED
@@ -1,9 +1,9 @@
1
- import type { WebPlayerPlugin } from '@player-ui/react';
1
+ import type { ReactPlayerPlugin } from '@player-ui/react';
2
2
  import type { AppetizeVersions } from './player/Appetize';
3
3
 
4
4
  export interface PlayerParametersType {
5
5
  /** plugins to use for any loaded player */
6
- webplayerPlugins?: Array<WebPlayerPlugin>;
6
+ reactPlayerPlugins?: Array<ReactPlayerPlugin>;
7
7
 
8
8
  /** Appetize tokens to use */
9
9
  appetizeTokens?: {