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 71de0ff
Show file tree
Hide file tree
Showing 4 changed files with 11 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
8 changes: 5 additions & 3 deletions packages/react-uploader/src/utils/getUserAgentIntegration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { version, name } from "../../package.json";
import { version } from "../../package.json";

export const getUserAgentIntegration = (pubkey: string) => {
return `${name}/${version}/${pubkey} (JavaScript; React;)`;
const NAME_EXTENTION = "React-Uploader";

export const getUserAgentIntegration = () => {
return `${NAME_EXTENTION}/${version}`;
};

0 comments on commit 71de0ff

Please sign in to comment.