@jam-comments/astro 1.1.5 → 1.2.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/index.d.ts CHANGED
@@ -8,6 +8,11 @@ declare global {
8
8
 
9
9
  export interface JamCommentsProps {
10
10
  path: string;
11
+ domain?: string;
12
+ apiKey?: string;
13
+ baseUrl?: string;
14
+ environment?: string;
15
+ tz?: string;
11
16
  }
12
17
 
13
18
  export default function JamComments({ path }: JamCommentsProps): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jam-comments/astro",
3
- "version": "1.1.5",
3
+ "version": "1.2.0",
4
4
  "author": "Alex MacArthur <alex@macarthur.me> (https://macarthur.me)",
5
5
  "license": "GPL-2.0",
6
6
  "description": "Easily add performant, SEO-friendly comments to your Astro blog with JamComments.",
@@ -28,12 +28,12 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@jam-comments/server-utilities": "^3.0.1",
32
- "astro": "^2.1.7",
31
+ "@jam-comments/server-utilities": "^3.2.1",
32
+ "astro": "^2.5.5",
33
33
  "node-fetch": "^3.3.1"
34
34
  },
35
35
  "gitHead": "2b1cefb90c89a2f70099213881b09216f20e3dc2",
36
36
  "devDependencies": {
37
- "prettier": "^2.8.7"
37
+ "prettier": "^2.8.8"
38
38
  }
39
39
  }
package/src/index.astro CHANGED
@@ -7,16 +7,25 @@ const { markupFetcher, logError } = pkg;
7
7
  type Props = JamCommentsProps;
8
8
 
9
9
  const CLIENT_SCRIPT_URL =
10
- "https://unpkg.com/@jam-comments/client@2.1.5/dist/index.umd.js";
10
+ "https://unpkg.com/@jam-comments/client@2.3.2/dist/index.umd.js";
11
11
  const fetchMarkup = markupFetcher("astro", nodeFetch as any);
12
- const fetchCommentData = async (pagePath: string) => {
12
+
13
+ const fetchCommentData = async ({
14
+ tz = undefined,
15
+ path = undefined,
16
+ domain = import.meta.env.JAM_COMMENTS_DOMAIN as string,
17
+ apiKey = import.meta.env.JAM_COMMENTS_API_KEY as string,
18
+ baseUrl = import.meta.env.JAM_COMMENTS_BASE_URL as string,
19
+ environment = import.meta.env.JAM_COMMENTS_ENVIRONMENT as string,
20
+ }: JamCommentsProps) => {
13
21
  try {
14
22
  return await fetchMarkup({
15
- path: pagePath,
16
- domain: import.meta.env.JAM_COMMENTS_DOMAIN,
17
- apiKey: import.meta.env.JAM_COMMENTS_API_KEY,
18
- baseUrl: import.meta.env.JAM_COMMENTS_BASE_URL,
19
- environment: import.meta.env.JAM_COMMENTS_ENVIRONMENT,
23
+ path,
24
+ domain,
25
+ apiKey,
26
+ baseUrl,
27
+ environment,
28
+ tz,
20
29
  });
21
30
  } catch (e) {
22
31
  logError(e as string);
@@ -24,8 +33,8 @@ const fetchCommentData = async (pagePath: string) => {
24
33
  }
25
34
  };
26
35
 
27
- const { path } = Astro.props;
28
- const markup = await fetchCommentData(path);
36
+ const { path, domain, baseUrl, environment, tz } = Astro.props;
37
+ const markup = await fetchCommentData({ path, domain, baseUrl, environment, tz });
29
38
  ---
30
39
 
31
40
  <div set:html={markup} />