Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Intercom #26

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions apps/client/components/APM.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
import { useAuth0 } from '@auth0/auth0-react'
import { useIntercom } from '@maybe-finance/client/shared'
import { useRouter } from 'next/router'
import { useEffect } from 'react'
import * as Sentry from '@sentry/react'

export default function APM() {
const { user } = useAuth0()
const router = useRouter()
const intercom = useIntercom()

// Boot intercom
useEffect(() => {
const isBooted = intercom.boot()

const handleRouteChange = () => {
if (isBooted) {
intercom.update()
}
}

router.events.on('routeChangeComplete', handleRouteChange)

return () => router.events.off('routeChangeComplete', handleRouteChange)
}, [intercom, router.events])

// Identify Sentry user
useEffect(() => {
Expand Down
9 changes: 0 additions & 9 deletions apps/client/components/Meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ export default function Meta() {
href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css"
rel="stylesheet"
/>

{/* Intercom */}
<script
type="text/javascript"
dangerouslySetInnerHTML={{
__html: `window.INTERCOM_APP_ID='${env.NEXT_PUBLIC_INTERCOM_APP_ID}';(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/' + window.INTERCOM_APP_ID;var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();`,
}}
/>
{/* End Intercom */}
</Head>
)
}
10 changes: 3 additions & 7 deletions apps/client/env.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
const env = {
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3333',
NEXT_PUBLIC_AUTH0_DOMAIN:
process.env.NEXT_PUBLIC_AUTH0_DOMAIN || 'REPLACE_THIS',
NEXT_PUBLIC_AUTH0_CLIENT_ID:
process.env.NEXT_PUBLIC_AUTH0_CLIENT_ID || 'REPLACE_THIS',
NEXT_PUBLIC_AUTH0_DOMAIN: process.env.NEXT_PUBLIC_AUTH0_DOMAIN || 'REPLACE_THIS',
NEXT_PUBLIC_AUTH0_CLIENT_ID: process.env.NEXT_PUBLIC_AUTH0_CLIENT_ID || 'REPLACE_THIS',
NEXT_PUBLIC_AUTH0_AUDIENCE:
process.env.NEXT_PUBLIC_AUTH0_AUDIENCE || 'https://maybe-finance-api/v1',
NEXT_PUBLIC_LD_CLIENT_SIDE_ID:
process.env.NEXT_PUBLIC_LD_CLIENT_SIDE_ID || 'REPLACE_THIS',
NEXT_PUBLIC_LD_CLIENT_SIDE_ID: process.env.NEXT_PUBLIC_LD_CLIENT_SIDE_ID || 'REPLACE_THIS',
NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
NEXT_PUBLIC_SENTRY_ENV: process.env.NEXT_PUBLIC_SENTRY_ENV,
NEXT_PUBLIC_INTERCOM_APP_ID: process.env.NEXT_PUBLIC_INTERCOM_APP_ID || 'REPLACE_THIS',
}

export default env
20 changes: 5 additions & 15 deletions apps/client/pages/oauth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ export default function OAuth() {
// If our backend doesn't return a token to re-initialize with, show user troubleshooting message
if (fetchTokenError) {
return (
<div className="fixed h-full w-full flex flex-col items-center gap-4 mt-48">
<div className="fixed flex flex-col items-center w-full h-full gap-4 mt-48">
<LoadingSpinner />
{fetchTokenError && (
<>
<h4>Stuck on this page?</h4>
<div className="mx-auto w-full max-w-md rounded-2xl bg-gray-800 p-2">
<div className="w-full max-w-md p-2 mx-auto bg-gray-800 rounded-2xl">
<Disclosure defaultOpen>
{({ open }) => (
<>
<Disclosure.Button className="flex w-full items-center justify-between rounded-lg bg-gray-700 px-4 py-2 text-left text-sm font-medium text-purple-900 hover:bg-purple-200 focus:outline-none focus-visible:ring focus-visible:ring-purple-500 focus-visible:ring-opacity-75">
<Disclosure.Button className="flex items-center justify-between w-full px-4 py-2 text-sm font-medium text-left text-purple-900 bg-gray-700 rounded-lg hover:bg-purple-200 focus:outline-none focus-visible:ring focus-visible:ring-purple-500 focus-visible:ring-opacity-75">
<span>Why did this happen?</span>
<RiArrowUpSFill
className={`${
Expand All @@ -47,24 +47,14 @@ export default function OAuth() {
stuck.
</p>

<ul className="mt-4 list-disc ml-4">
<ul className="mt-4 ml-4 list-disc">
<li>
Try connecting this account on a desktop
device. We have a mobile app on our roadmap,
but for the time being, desktop browsers
will be your most reliable experience.
</li>
<li>
Still not working?{' '}
<button
onClick={() =>
BrowserUtil.showIntercom()
}
className="underline text-cyan"
>
Let us know!
</button>
</li>
<li>Still not working? Let us know!</li>
</ul>
</Disclosure.Panel>
</Transition>
Expand Down
13 changes: 0 additions & 13 deletions apps/server/src/app/routes/users.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,6 @@ router.get(
})
)

router.get(
'/intercom',
endpoint.create({
resolve: async ({ ctx }) => {
if (!ctx.user || !ctx.user.id) {
throw new Error('User not found')
}

return ctx.userService.getIntercomMetadata(ctx.user.id, env.NX_INTERCOM_SECRET)
},
})
)

router.put(
'/',
endpoint.create({
Expand Down
20 changes: 4 additions & 16 deletions apps/server/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,13 @@ const envSchema = z.object({
.string()
.default(process.env.NODE_ENV === 'development' ? 'dev' : 'combined'),

NX_INTERCOM_SECRET: z.string().optional(),

NX_STRIPE_SECRET_KEY: z
.string()
.default(
'REPLACE_THIS'
),
NX_STRIPE_WEBHOOK_SECRET: z
.string()
.default('whsec_REPLACE_THIS'),
NX_STRIPE_SECRET_KEY: z.string().default('REPLACE_THIS'),
NX_STRIPE_WEBHOOK_SECRET: z.string().default('whsec_REPLACE_THIS'),
NX_STRIPE_PREMIUM_MONTHLY_PRICE_ID: z.string().default('price_REPLACE_THIS'),
NX_STRIPE_PREMIUM_YEARLY_PRICE_ID: z.string().default('price_REPLACE_THIS'),

NX_CDN_PRIVATE_BUCKET: z
.string()
.default('REPLACE_THIS'),
NX_CDN_PUBLIC_BUCKET: z
.string()
.default('REPLACE_THIS'),
NX_CDN_PRIVATE_BUCKET: z.string().default('REPLACE_THIS'),
NX_CDN_PUBLIC_BUCKET: z.string().default('REPLACE_THIS'),

// Key to secrets manager value
NX_CDN_SIGNER_SECRET_ID: z.string().default('/apps/maybe-app/CLOUDFRONT_SIGNER1_PRIV'),
Expand Down
9 changes: 0 additions & 9 deletions aws/maybe-app/lib/stacks/server-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,6 @@ export class ServerStack extends Stack {
}
)
),
NX_INTERCOM_SECRET: ECSSecret.fromSsmParameter(
StringParameter.fromSecureStringParameterAttributes(
this,
'IntercomSecretParam',
{
parameterName: '/providers/NX_INTERCOM_SECRET',
}
)
),
NX_STRIPE_SECRET_KEY: ECSSecret.fromSsmParameter(
StringParameter.fromSecureStringParameterAttributes(
this,
Expand Down
32 changes: 15 additions & 17 deletions libs/client/features/src/onboarding/sidebar/SidebarOnboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ type DescriptionProps = {

function Description({ summary, examples }: DescriptionProps) {
return (
<div className="text-gray-50 text-base mt-2">
<div className="mt-2 text-base text-gray-50">
<p className="mb-4">{summary}</p>
<ul>
{examples.map((example) => (
<li key={example} className="list-disc ml-6">
<li key={example} className="ml-6 list-disc">
{example}
</li>
))}
Expand Down Expand Up @@ -123,7 +123,7 @@ export function SidebarOnboarding({ onClose, onHide }: Props) {

if (onboarding.isLoading) {
return (
<div className="w-full flex justify-center items-center h-full">
<div className="flex items-center justify-center w-full h-full">
<LoadingSpinner />
</div>
)
Expand Down Expand Up @@ -196,7 +196,7 @@ export function SidebarOnboarding({ onClose, onHide }: Props) {
initial={{ width: 0 }}
animate={{ width: `${syncProgress.progress * 100}%` }}
transition={{ ease: 'easeOut', duration: 0.5 }}
className="h-full rounded-full bg-gray-100"
className="h-full bg-gray-100 rounded-full"
></motion.div>
) : (
<motion.div
Expand Down Expand Up @@ -225,15 +225,15 @@ export function SidebarOnboarding({ onClose, onHide }: Props) {
</div>
<div className="relative h-2 bg-gray-600 rounded-sm">
<div
className="absolute inset-0 bg-cyan h-2 rounded-sm"
className="absolute inset-0 h-2 rounded-sm bg-cyan"
style={{
width: `${percent * 100}%`,
}}
></div>
</div>
</div>

<div className="flex flex-col items-start gap-2 text-base pr-4 -mr-4 custom-gray-scroll">
<div className="flex flex-col items-start gap-2 pr-4 -mr-4 text-base custom-gray-scroll">
{accountSteps.map((step, idx) => {
const description = getDescriptionComponent(step.key)

Expand All @@ -252,7 +252,7 @@ export function SidebarOnboarding({ onClose, onHide }: Props) {
open ? 'text-white' : 'text-gray-100'
)}
>
<div className="flex items-center text-left leading-5 gap-3 mr-auto">
<div className="flex items-center gap-3 mr-auto leading-5 text-left">
<div
className={classNames(
'rounded-full w-[28px] h-[28px] flex items-center justify-center shrink-0',
Expand All @@ -264,7 +264,7 @@ export function SidebarOnboarding({ onClose, onHide }: Props) {
{step.isComplete || step.isMarkedComplete ? (
<RiCheckFill size={20} className="text-cyan" />
) : (
<span className="font-medium text-sm">
<span className="text-sm font-medium">
{idx + 1}
</span>
)}
Expand Down Expand Up @@ -306,7 +306,7 @@ export function SidebarOnboarding({ onClose, onHide }: Props) {
<div className="bg-gray-600 my-4 h-[1px]"></div>

{step.isComplete ? (
<p className="text-gray-50 text-sm">
<p className="text-sm text-gray-50">
This step has been automatically marked complete
since you've added at least 1 of these account
types.
Expand Down Expand Up @@ -354,7 +354,7 @@ export function SidebarOnboarding({ onClose, onHide }: Props) {
<Disclosure defaultOpen>
{({ open }) => (
<div className={classNames('p-3 rounded-lg bg-grape bg-opacity-10 text-base')}>
<Disclosure.Button className="flex items-center gap-2 text-grape w-full font-medium">
<Disclosure.Button className="flex items-center w-full gap-2 font-medium text-grape">
<HiOutlineSparkles size={24} />
<span className="mr-auto">Bonus</span>
{open ? <RiArrowUpSFill size={18} /> : <RiArrowDownSFill size={18} />}
Expand Down Expand Up @@ -399,13 +399,11 @@ export function SidebarOnboarding({ onClose, onHide }: Props) {
</Disclosure>

<p className="text-sm text-gray-100">
If you have any issues with connecting accounts, please let us know{' '}
<button
onClick={() => BrowserUtil.showIntercom()}
className="text-cyan cursor-pointer hover:underline"
>
via live chat
</button>
If you have any issues with connecting accounts,{' '}
<a href="mailto:[email protected]" className="underline text-cyan">
please let us know
</a>
.
</p>
</>
)
Expand Down
27 changes: 11 additions & 16 deletions libs/client/features/src/user-details/LinkAccountFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ function PromptStep({
<>
<BoxIcon icon={RiLink} />

<h4 className="text-white mt-6 mb-2">Link accounts?</h4>
<h4 className="mt-6 mb-2 text-white">Link accounts?</h4>

<p className="mb-6 text-gray-50 text-base">
<p className="mb-6 text-base text-gray-50">
We found an {secondaryProvider === 'apple' ? 'Apple ' : ' '} account using the same
email address as this one in our system. Do you want to link it?
</p>
Expand All @@ -140,7 +140,7 @@ function PromptStep({
{secondaryProvider === 'apple' ? (
<button
onClick={onNext}
className="w-2/4 flex items-center px-4 py-2 rounded text-base bg-white text-black shadow hover:bg-gray-25 focus:bg-gray-25 focus:ring-gray-600 font-medium"
className="flex items-center w-2/4 px-4 py-2 text-base font-medium text-black bg-white rounded shadow hover:bg-gray-25 focus:bg-gray-25 focus:ring-gray-600"
>
<RiAppleFill className="w-4 h-4 mx-2" /> Link with Apple
</button>
Expand All @@ -165,7 +165,7 @@ function ConfirmStep({
<>
<BoxIcon icon={RiLink} />

<h4 className="text-white my-6 animate-pulse">Authentication in progress...</h4>
<h4 className="my-6 text-white animate-pulse">Authentication in progress...</h4>

<Button fullWidth variant="secondary" onClick={onCancel}>
Cancel
Expand All @@ -178,7 +178,7 @@ function ConfirmStep({
<>
<BoxIcon icon={isLoading ? RiLinkUnlink : RiLink} />

<h4 className="text-white mt-6 mb-2">
<h4 className="mt-6 mb-2 text-white">
{isLoading ? 'Linking accounts ...' : 'Continue linking accounts?'}
</h4>

Expand All @@ -198,7 +198,7 @@ function ConfirmStep({
process by unlinking the account in your settings.{' '}
</p>

<p className="text-white mt-4">No data will be deleted.</p>
<p className="mt-4 text-white">No data will be deleted.</p>
</>
)}
</div>
Expand Down Expand Up @@ -229,9 +229,9 @@ function LinkComplete({ onClose }: { onClose(): void }) {
<>
<BoxIcon icon={RiCheckLine} variant="teal" />

<h4 className="text-white mt-6 mb-2">Accounts linked successfully!</h4>
<h4 className="mt-6 mb-2 text-white">Accounts linked successfully!</h4>

<p className="mb-6 text-gray-50 text-base">
<p className="mb-6 text-base text-gray-50">
Your accounts have been linked and the data has been merged successfully.
</p>

Expand All @@ -249,16 +249,11 @@ function LinkError({ onClose, error }: { onClose(): void; error: string }) {
<>
<BoxIcon icon={RiLink} variant="red" />

<h4 className="text-white mt-6 mb-2">Account linking failed</h4>
<h4 className="mt-6 mb-2 text-white">Account linking failed</h4>

<p className="mb-2 text-gray-50 text-base">{error}</p>
<p className="mb-2 text-base text-gray-50">{error}</p>

<button
className="underline text-cyan text-base mb-6"
onClick={BrowserUtil.showIntercom}
>
Please contact us.
</button>
<button className="mb-6 text-base underline text-cyan">Please contact us.</button>

<div className="flex w-full gap-4">
<Button fullWidth onClick={onClose}>
Expand Down
Loading
Loading