Skip to content

Commit

Permalink
feat: updated getUserAgentIntegration
Browse files Browse the repository at this point in the history
  • Loading branch information
egordidenko committed Apr 29, 2024
1 parent a840e90 commit 38b8cc5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AdapterUploadCtxProvider } from "../core/AdapterUploadCtxProvider";
import type { TProps } from "../types";
import { getStyleSource } from "../default";
import { getCalcPropertyOfProps } from "../../utils/getCalcPropertyOfProps";
import { getUserAgentIntegration } from "../../utils/getUserAgentIntegration";
import { getUserAgentIntegration } from "../../utils/getUserAgentIntegration.ts";

LR.registerBlocks(LR);

Expand All @@ -33,7 +33,7 @@ export const FileUploaderInline: FC<TProps> = ({
return (
<div className={className}>
{/* @ts-ignore */}
<AdapterConfig userAgentIntegration={getUserAgentIntegration(config.pubkey)} ctx-name={CTX_NAME} {...config} />
<AdapterConfig userAgentIntegration={getUserAgentIntegration()} ctx-name={CTX_NAME} {...config} />
{/* @ts-ignore */}
<AdapterUploadCtxProvider
ref={refUploadCtxProvider}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AdapterUploadCtxProvider } from "../core/AdapterUploadCtxProvider";
import type { TProps } from "../types";
import { getStyleSource } from "../default";
import { getCalcPropertyOfProps } from "../../utils/getCalcPropertyOfProps";
import { getUserAgentIntegration } from "../../utils/getUserAgentIntegration";
import { getUserAgentIntegration } from "../../utils/getUserAgentIntegration.ts";

LR.registerBlocks(LR);

Expand Down Expand Up @@ -34,7 +34,7 @@ export const FileUploaderMinimal: FC<TProps> = ({
return (
<div className={className}>
{/* @ts-ignore */}
<AdapterConfig userAgentIntegration={getUserAgentIntegration(config.pubkey)} ctx-name={CTX_NAME} {...config} />
<AdapterConfig userAgentIntegration={getUserAgentIntegration()} ctx-name={CTX_NAME} {...config} />
{/* @ts-ignore */}
<AdapterUploadCtxProvider
ref={refUploadCtxProvider}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getStyleSource } from "../default";
import type { TProps } from "../types";

import { getCalcPropertyOfProps } from "../../utils/getCalcPropertyOfProps";
import { getUserAgentIntegration } from "../../utils/getUserAgentIntegration";
import { getUserAgentIntegration } from "../../utils/getUserAgentIntegration.ts";

LR.registerBlocks(LR);

Expand Down Expand Up @@ -35,7 +35,7 @@ export const FileUploaderRegular: FC<TProps> = ({
return (
<div className={className}>
{/* @ts-ignore */}
<AdapterConfig userAgentIntegration={getUserAgentIntegration(config.pubkey)} ctx-name={CTX_NAME} {...config}/>
<AdapterConfig userAgentIntegration={getUserAgentIntegration()} ctx-name={CTX_NAME} {...config} />
{/* @ts-ignore */}
<AdapterUploadCtxProvider
ref={refUploadCtxProvider}
Expand Down
10 changes: 7 additions & 3 deletions packages/react-uploader/src/utils/getUserAgentIntegration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { version, name } from "../../package.json";
import {
version as reactUploaderVersion,
name as reactUploaderName,
} from "../../package.json";
import { version } from "react";

export const getUserAgentIntegration = (pubkey: string) => {
return `${name}/${version}/${pubkey} (JavaScript; React;)`;
export const getUserAgentIntegration = () => {
return `React/${version}; ${reactUploaderName}/${reactUploaderVersion}`;
};

0 comments on commit 38b8cc5

Please sign in to comment.