Skip to content

Commit

Permalink
SS-4150 Segment and hubspot changes (#2395)
Browse files Browse the repository at this point in the history
* 1.16.2 iOS Release (#2393)

* fix

* fix

---------

Co-authored-by: Dmitry Fedoseyev <dfedoseyev@gmail.com>
  • Loading branch information
hdz-666 and gzerad authored Sep 20, 2024
1 parent ea1c550 commit dcc1aaf
Show file tree
Hide file tree
Showing 17 changed files with 471 additions and 217 deletions.
3 changes: 2 additions & 1 deletion components/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ArrowRightIcon } from '@100mslive/react-icons';
import { Flex, Box, Text } from '@100mslive/react-ui';
import { AppAnalytics } from '../lib/publishEvents';

interface CardProps {
icon: any;
Expand All @@ -17,7 +18,7 @@ const Card: React.FC<CardProps> = ({ icon, title, link, subText, id, cta = 'Read
justify="between"
onClick={() => {
if (link) {
window.analytics.track('card.clicked', {
AppAnalytics.track('card.clicked', {
title,
link,
currentPage: window.location.href
Expand Down
3 changes: 2 additions & 1 deletion components/ChipDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import useClickOutside from '@/lib/useClickOutside';
import { getUpdatedPlatformName } from '@/lib/utils';
import Chip from './Chip';
import { menuItem } from './Sidebar';
import { AppAnalytics } from '../lib/publishEvents';

const ChipDropDown = ({
openFilter,
Expand Down Expand Up @@ -35,7 +36,7 @@ const ChipDropDown = ({
<Listbox
value={platformFilter}
onChange={(selection) => {
window.analytics.track('platform.changed', {
AppAnalytics.track('platform.changed', {
title: document.title,
referrer: document.referrer,
path: window.location.hostname,
Expand Down
182 changes: 92 additions & 90 deletions components/Code.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { PropsWithChildren } from 'react';
import { Box } from '@100mslive/react-ui';
import { AppAnalytics } from '../lib/publishEvents';

export const CopyIcon = () => (
<svg
Expand Down Expand Up @@ -30,99 +31,100 @@ export const CheckIcon = () => (
<polyline points="20 6 9 17 4 12" />
</svg>
);
const Code: React.FC<PropsWithChildren<{ section?: string; sectionIndex?: number; tab?: string }>> =
({ children, section, sectionIndex, tab }) => {
const textRef = React.useRef(null);
const Code: React.FC<
PropsWithChildren<{ section?: string; sectionIndex?: number; tab?: string }>
> = ({ children, section, sectionIndex, tab }) => {
const textRef = React.useRef(null);

const copyFunction = () => {
setCopy(true);
// @ts-ignore
navigator.clipboard.writeText(textRef.current.textContent);
setTimeout(() => {
setCopy(false);
}, 2000);
const copyFunction = () => {
setCopy(true);
// @ts-ignore
navigator.clipboard.writeText(textRef.current.textContent);
setTimeout(() => {
setCopy(false);
}, 2000);

window.analytics.track('copy.to.clipboard', {
title: document.title,
referrer: document.referrer,
path: window.location.hostname,
pathname: window.location.pathname,
href: window.location.href,
section,
sectionIndex,
tab
});
};
const [copy, setCopy] = React.useState(false);
AppAnalytics.track('copy.to.clipboard', {
title: document.title,
referrer: document.referrer,
path: window.location.hostname,
pathname: window.location.pathname,
href: window.location.href,
section,
sectionIndex,
tab
});
};
const [copy, setCopy] = React.useState(false);

return (
<pre>
<Box css={{ position: 'relative', minWidth: 'min-content' }}>
<Box
css={{
position: 'absolute',
width: '100%',
top: '6px',
pointerEvents: 'none'
}}
className="code-block">
{!copy ? (
<button
aria-label="Copy to Clipboard"
onClick={() => copyFunction()}
type="button"
style={{
zIndex: '45',
background: 'var(--docs_bg_card)',
outline: 'none',
height: '40px',
width: '40px',
padding: '9px',
float: 'right',
position: 'sticky',
cursor: 'pointer',
right: '12px',
pointerEvents: 'auto',
borderRadius: '20px',
border: '1px solid var(--docs_border_strong)'
}}>
<CopyIcon />
</button>
) : (
<button
aria-label="Copy to Clipboard"
onClick={() => copyFunction()}
type="button"
style={{
zIndex: '45',
background: 'var(--docs_bg_card)',
outline: 'none',
height: '40px',
width: '40px',
padding: '9px',
float: 'right',
position: 'sticky',
cursor: 'pointer',
right: '12px',
pointerEvents: 'auto',
borderRadius: '20px',
border: '1px solid var(--docs_border_strong)'
}}>
<CheckIcon />
</button>
)}
</Box>
<Box ref={textRef} css={{ padding: '1rem 0', paddingRight: '1rem' }}>
{children}
</Box>
<style jsx>{`
button:hover {
opacity: 0.8;
}
`}</style>
return (
<pre>
<Box css={{ position: 'relative', minWidth: 'min-content' }}>
<Box
css={{
position: 'absolute',
width: '100%',
top: '6px',
pointerEvents: 'none'
}}
className="code-block">
{!copy ? (
<button
aria-label="Copy to Clipboard"
onClick={() => copyFunction()}
type="button"
style={{
zIndex: '45',
background: 'var(--docs_bg_card)',
outline: 'none',
height: '40px',
width: '40px',
padding: '9px',
float: 'right',
position: 'sticky',
cursor: 'pointer',
right: '12px',
pointerEvents: 'auto',
borderRadius: '20px',
border: '1px solid var(--docs_border_strong)'
}}>
<CopyIcon />
</button>
) : (
<button
aria-label="Copy to Clipboard"
onClick={() => copyFunction()}
type="button"
style={{
zIndex: '45',
background: 'var(--docs_bg_card)',
outline: 'none',
height: '40px',
width: '40px',
padding: '9px',
float: 'right',
position: 'sticky',
cursor: 'pointer',
right: '12px',
pointerEvents: 'auto',
borderRadius: '20px',
border: '1px solid var(--docs_border_strong)'
}}>
<CheckIcon />
</button>
)}
</Box>
</pre>
);
};
<Box ref={textRef} css={{ padding: '1rem 0', paddingRight: '1rem' }}>
{children}
</Box>
<style jsx>{`
button:hover {
opacity: 0.8;
}
`}</style>
</Box>
</pre>
);
};

export default Code;
57 changes: 29 additions & 28 deletions components/ExampleCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import * as reactIcons from '@100mslive/react-icons';
import { Box, Flex, HorizontalDivider, Text } from '@100mslive/react-ui';
import { Technologies, technologyIconMap } from './TechnologySelect';
import { AppAnalytics } from '../lib/publishEvents';

interface Props extends React.ComponentPropsWithoutRef<typeof Box> {
title: string;
Expand Down Expand Up @@ -115,34 +117,33 @@ function IconList({ technologies, showIcon }: IconListProps) {
<Text>{technology}</Text>
</Flex>
);
} else {
return (
<Flex as="ul" gap="2" css={{ listStyle: 'none', padding: 0, margin: 0 }}>
{technologies.map((technology) => {
let Icon;
const iconNameOrPath = technologyIconMap[technology].icon;
if (
typeof iconNameOrPath === 'string' &&
reactIcons[iconNameOrPath] !== undefined
) {
Icon = reactIcons[iconNameOrPath];
} else {
Icon = iconNameOrPath;
}
return (
<Flex
as="li"
key={technology}
css={{
marginBottom: 0
}}>
<Icon />
</Flex>
);
})}
</Flex>
);
}
return (
<Flex as="ul" gap="2" css={{ listStyle: 'none', padding: 0, margin: 0 }}>
{technologies.map((technology) => {
let Icon;
const iconNameOrPath = technologyIconMap[technology].icon;
if (
typeof iconNameOrPath === 'string' &&
reactIcons[iconNameOrPath] !== undefined
) {
Icon = reactIcons[iconNameOrPath];
} else {
Icon = iconNameOrPath;
}
return (
<Flex
as="li"
key={technology}
css={{
marginBottom: 0
}}>
<Icon />
</Flex>
);
})}
</Flex>
);
}

type TagListProps = {
Expand All @@ -156,7 +157,7 @@ function TagList({ tags, title }: TagListProps) {
{tags.map((tag) => (
<Box
onClick={() => {
window.analytics.track('examples.tag.clicked', {
AppAnalytics.track('examples.tag.clicked', {
tag,
title
});
Expand Down
9 changes: 5 additions & 4 deletions components/Feedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { Flex, Box, Button, Text } from '@100mslive/react-ui';
import useClickOutside from '@/lib/useClickOutside';
import { currentUser } from '../lib/currentUser';
import { AppAnalytics } from '../lib/publishEvents';

const emojis = [{ score: 1 }, { score: 2 }, { score: 3 }, { score: 4 }];

Expand Down Expand Up @@ -47,19 +48,19 @@ const Feedback = () => {
title={getPlaceholder[`title-${id + 1}`]}
style={{ position: 'relative', width: '24px', height: '24px' }}
key={emoji.score}
role='button'
role="button"
onClick={() => {
const userDetails = currentUser();
if (showTextBox === false) {
window.analytics.track('docs.feedback.rating', {
AppAnalytics.track('docs.feedback.rating', {
title: document.title,
referrer: document.referrer,
path: window.location.pathname,
rating: emoji.score,
timeStamp: new Date().toLocaleString(),
customer_id: userDetails?.customer_id,
user_id: userDetails?.user_id,
email: userDetails?.email,
email: userDetails?.email
});
setFirstSelection(emoji.score);
}
Expand Down Expand Up @@ -121,7 +122,7 @@ const Feedback = () => {
}}
onClick={() => {
const userDetails = currentUser();
window.analytics.track('docs.feedback.message', {
AppAnalytics.track('docs.feedback.message', {
title: document.title,
message: message || '',
rating: firstSelection,
Expand Down
Loading

0 comments on commit dcc1aaf

Please sign in to comment.