@clockworkdog/cogs-client-react 2.0.2 → 2.1.1

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.
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const cogs_client_1 = require("@clockworkdog/cogs-client");
7
6
  const react_1 = __importDefault(require("react"));
8
7
  const useImages_1 = __importDefault(require("../hooks/useImages"));
9
8
  const CogsConnectionProvider_1 = require("../providers/CogsConnectionProvider");
@@ -12,11 +11,14 @@ function Images({ className, style, connection: customConnection, fullscreen, })
12
11
  const connection = customConnection !== null && customConnection !== void 0 ? customConnection : providerConnection;
13
12
  const images = (0, useImages_1.default)(connection);
14
13
  const fullscreenCustomStyle = typeof fullscreen === 'object' ? fullscreen.style : undefined;
15
- const imageElements = images.map((image, index) => (react_1.default.createElement("img", { className: className, key: index, src: (0, cogs_client_1.assetUrl)(image.file), alt: image.file, style: {
16
- objectFit: image.fit,
17
- ...(fullscreen ? { width: '100%', height: '100%', position: 'absolute', top: 0, left: 0 } : {}),
18
- ...style,
19
- } })));
14
+ const imageElements = images.map((image, index) => {
15
+ var _a;
16
+ return (react_1.default.createElement("img", { className: className, key: index, src: (_a = connection.getAssetUrl) === null || _a === void 0 ? void 0 : _a.call(connection, image.file), alt: image.file, style: {
17
+ objectFit: image.fit,
18
+ ...(fullscreen ? { width: '100%', height: '100%', position: 'absolute', top: 0, left: 0 } : {}),
19
+ ...style,
20
+ } }));
21
+ });
20
22
  return (react_1.default.createElement(react_1.default.Fragment, null, fullscreen ? (react_1.default.createElement("div", { style: { position: 'absolute', zIndex: 2, top: 0, left: 0, width: '100vw', height: '100vh', ...fullscreenCustomStyle } }, imageElements)) : (imageElements)));
21
23
  }
22
24
  exports.default = Images;
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  export default function VideoContainer({ className, style, videoPlayer: customVideoPlayer, fullscreen, }: {
4
4
  className?: string;
5
5
  style?: React.CSSProperties;
6
- videoPlayer?: CogsVideoPlayer;
6
+ videoPlayer: CogsVideoPlayer | null;
7
7
  fullscreen?: boolean | {
8
8
  style: React.CSSProperties;
9
9
  };
@@ -1,4 +1,4 @@
1
1
  import { AudioClip, CogsAudioPlayer } from '@clockworkdog/cogs-client';
2
- export default function useAudioClips(audioPlayer: CogsAudioPlayer): {
2
+ export default function useAudioClips(audioPlayer: CogsAudioPlayer | null): {
3
3
  [path: string]: AudioClip;
4
4
  };
@@ -5,8 +5,8 @@ function useAudioClips(audioPlayer) {
5
5
  const [audioClips, setAudioClips] = (0, react_1.useState)({});
6
6
  (0, react_1.useEffect)(() => {
7
7
  const listener = (event) => setAudioClips(event.detail.clips);
8
- audioPlayer.addEventListener('state', listener);
9
- return () => audioPlayer.removeEventListener('state', listener);
8
+ audioPlayer === null || audioPlayer === void 0 ? void 0 : audioPlayer.addEventListener('state', listener);
9
+ return () => audioPlayer === null || audioPlayer === void 0 ? void 0 : audioPlayer.removeEventListener('state', listener);
10
10
  }, [audioPlayer]);
11
11
  return audioClips;
12
12
  }
@@ -1,2 +1,2 @@
1
1
  import { CogsAudioPlayer } from '@clockworkdog/cogs-client';
2
- export default function useIsAudioPlaying(audioPlayer: CogsAudioPlayer): boolean;
2
+ export default function useIsAudioPlaying(audioPlayer: CogsAudioPlayer | null): boolean;
@@ -5,8 +5,8 @@ function useIsAudioPlaying(audioPlayer) {
5
5
  const [isAudioPlaying, setAudioPlaying] = (0, react_1.useState)(false);
6
6
  (0, react_1.useEffect)(() => {
7
7
  const listener = (event) => setAudioPlaying(event.detail.isPlaying);
8
- audioPlayer.addEventListener('state', listener);
9
- return () => audioPlayer.removeEventListener('state', listener);
8
+ audioPlayer === null || audioPlayer === void 0 ? void 0 : audioPlayer.addEventListener('state', listener);
9
+ return () => audioPlayer === null || audioPlayer === void 0 ? void 0 : audioPlayer.removeEventListener('state', listener);
10
10
  }, [audioPlayer]);
11
11
  return isAudioPlaying;
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clockworkdog/cogs-client-react",
3
- "version": "v2.0.2",
3
+ "version": "v2.1.1",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -31,7 +31,7 @@
31
31
  "typescript": "^5.1.6"
32
32
  },
33
33
  "dependencies": {
34
- "@clockworkdog/cogs-client": "^2.0.0"
34
+ "@clockworkdog/cogs-client": "~2.1"
35
35
  },
36
36
  "description": "React components and hooks to connect to COGS to build a custom Media Master",
37
37
  "repository": {