@rxdrag/website-lib 0.0.67 → 0.0.68

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxdrag/website-lib",
3
- "version": "0.0.67",
3
+ "version": "0.0.68",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.ts"
@@ -24,8 +24,8 @@
24
24
  "eslint": "^7.32.0",
25
25
  "gsap": "^3.12.7",
26
26
  "typescript": "^5",
27
- "@rxdrag/entify-hooks": "0.2.70",
28
27
  "@rxdrag/rxcms-models": "0.3.89",
28
+ "@rxdrag/entify-hooks": "0.2.70",
29
29
  "@rxdrag/eslint-config-custom": "0.2.12",
30
30
  "@rxdrag/slate-preview": "1.2.58",
31
31
  "@rxdrag/tsconfig": "0.2.0"
@@ -35,7 +35,7 @@
35
35
  "react": "^19.1.0",
36
36
  "react-dom": "^19.1.0",
37
37
  "@rxdrag/rxcms-models": "0.3.89",
38
- "@rxdrag/website-lib-core": "0.0.66"
38
+ "@rxdrag/website-lib-core": "0.0.67"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "astro": "^4.0.0 || ^5.0.0"
@@ -1,11 +1,13 @@
1
1
  ---
2
2
  import type {
3
3
  BackgroundConfig,
4
+ Locals,
4
5
  VideoBackgroundConfig,
5
6
  } from "@rxdrag/website-lib-core";
6
7
  import {
7
8
  BackgroundVideoPlayer,
8
9
  BackgroundHlsVideoPlayer,
10
+ Entify,
9
11
  } from "@rxdrag/website-lib-core";
10
12
 
11
13
  export interface Props {
@@ -14,6 +16,8 @@ export interface Props {
14
16
  defaultClass?: string;
15
17
  }
16
18
 
19
+ const { env } = Astro.locals as Locals;
20
+
17
21
  const { background, defaultClass = "absolute w-full h-full object-cover" } =
18
22
  Astro.props;
19
23
 
@@ -28,7 +32,7 @@ const mediaRef =
28
32
  const posterRef =
29
33
  background.type === "video" ? background.posterRef : undefined;
30
34
 
31
- const rx = (background as VideoBackgroundConfig | undefined)?.rx;
35
+ const rx = Entify.getInstance(env);
32
36
 
33
37
  // 获取媒体数据
34
38
  const media = rx ? await rx.getMedia(mediaRef) : undefined;
@@ -1,5 +1,10 @@
1
1
  ---
2
- import { ReactVideoPlayer, type IEntify } from "@rxdrag/website-lib-core";
2
+ import {
3
+ Entify,
4
+ ReactVideoPlayer,
5
+ type Locals,
6
+ } from "@rxdrag/website-lib-core";
7
+ const { env } = Astro.locals as Locals;
3
8
 
4
9
  interface Props {
5
10
  videoRef?: string;
@@ -17,17 +22,17 @@ interface Props {
17
22
  ctaButton?: string;
18
23
  overlayReplayButton?: string;
19
24
  };
20
- rx: IEntify;
21
25
  }
22
26
 
23
27
  const {
24
- rx,
25
28
  videoRef,
26
29
  posterRef,
27
30
  endTitle = "Contact Us Now",
28
31
  classNames = {},
29
32
  } = Astro.props;
30
33
 
34
+ const rx = Entify.getInstance(env);
35
+
31
36
  // 获取媒体数据(增加 rx 为空时的保护)
32
37
  const media = rx ? await rx.getMedia(videoRef) : undefined;
33
38
  const poster = rx ? await rx.getMedia(posterRef) : undefined;