Skip to content

Commit

Permalink
fix: GROW-272 - small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
hba-fingerprint committed Nov 8, 2024
1 parent 399b43f commit 4fce5b1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 20 deletions.
4 changes: 3 additions & 1 deletion src/client/analytics/Analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { env } from '../../env';

import { GoogleTagManager } from './Gtm';
import { Amplitude } from './Amplitude';
import { useEffect } from 'react';
import React, { useEffect } from 'react';
import InkeepChatButton from '../inkeep/chat-button/inkeep-chat-button';

// GTM API requires dataLayer access through global window variable
declare global {
Expand Down Expand Up @@ -38,6 +39,7 @@ export const Analytics = () => {
<>
{GTM_ID ? <GoogleTagManager gtmId={GTM_ID} /> : null}
{AMPLITUDE_API_KEY ? <Amplitude apiKey={AMPLITUDE_API_KEY} /> : null}
<InkeepChatButton />
</>
);
};
28 changes: 12 additions & 16 deletions src/client/components/Container/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import styles from './Container.module.scss';
import classNames from 'classnames';
import InkeepChatButton from '../../inkeep/chat-button/inkeep-chat-button';

export default function Container({
children,
Expand All @@ -17,20 +16,17 @@ export default function Container({
containerId?: string;
}) {
return (
<>
<div
className={classNames(
styles.container,
{ [styles.small]: size === 'small' },
{ [styles.large]: size === 'large' },
className,
)}
style={style}
id={containerId}
>
{children}
</div>
<InkeepChatButton />
</>
<div
className={classNames(
styles.container,
{ [styles.small]: size === 'small' },
{ [styles.large]: size === 'large' },
className,
)}
style={style}
id={containerId}
>
{children}
</div>
);
}
12 changes: 9 additions & 3 deletions src/client/inkeep/useInkeepSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import type {
InkeepModalSettings,
} from '@inkeep/uikit';
import { AIChatDisclaimerSettings } from '@inkeep/uikit';
import { env } from '../../env';


type InkeepSharedSettings = {
baseSettings: InkeepBaseSettings;
Expand All @@ -14,10 +16,14 @@ type InkeepSharedSettings = {
};

const useInkeepSettings = (): InkeepSharedSettings => {
const apiKey = env.NEXT_PUBLIC_INKEEP_API_KEY;
const integrationId = env.NEXT_PUBLIC_INKEEP_INTEGRATION_ID;
const organizationId = env.NEXT_PUBLIC_INKEEP_ORG_ID;

const baseSettings: InkeepBaseSettings = {
apiKey: 'b0537306817fb8a0daea377df2b273d1b00ac709182d1dc7',
integrationId: 'cm366b5qy000412p946i586tu',
organizationId: 'org_d0VDri411QUR4Xi7',
apiKey,
integrationId,
organizationId,
primaryBrandColor: '#F04405',
//logEventCallback: customAnalyticsCallback,
};
Expand Down
4 changes: 4 additions & 0 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export const env = createEnv({
// Analytics
NEXT_PUBLIC_GTM_ID: z.string().min(1).optional(),
NEXT_PUBLIC_AMPLITUDE_API_KEY: z.string().min(1).optional(),
//Inkeep
NEXT_PUBLIC_INKEEP_API_KEY: z.string().min(1).default('b0537306817fb8a0daea377df2b273d1b00ac709182d1dc7'),
NEXT_PUBLIC_INKEEP_INTEGRATION_ID: z.string().min(1).default('cm366b5qy000412p946i586tu'),
NEXT_PUBLIC_INKEEP_ORG_ID: z.string().min(1).default('org_d0VDri411QUR4Xi7'),
},
/*
* Due to how Next.js bundles environment variables on Edge and Client,
Expand Down

0 comments on commit 4fce5b1

Please sign in to comment.