Skip to content

Commit

Permalink
Merge pull request #4748 from HedvigInsurance/09-19-remove_custom_cha…
Browse files Browse the repository at this point in the history
…t_feature_flag_always_on

Remove CUSTOM_CHAT feature flag, always on
  • Loading branch information
alebedev authored Sep 19, 2024
2 parents a520871 + 55d107c commit 737c800
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 82 deletions.
2 changes: 1 addition & 1 deletion apps/store/public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* - Please do NOT serve this file on production.
*/

const PACKAGE_VERSION = '2.4.4'
const PACKAGE_VERSION = '2.4.7'
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set()
Expand Down
4 changes: 1 addition & 3 deletions apps/store/src/app/[locale]/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { cache } from 'react'
import { ContactUs } from '@/components/ContactUs/ContactUs'
import { DefaultDebugDialog } from '@/components/DebugDialog/DefaultDebugDialog'
import { PriceCalculatorCmsPage } from '@/features/priceCalculator/PriceCalculatorCmsPage'
import { CustomerFirstScript } from '@/services/CustomerFirst'
import type { PageStory } from '@/services/storyblok/storyblok'
import { MOST_VISITED_PATHS } from '@/services/storyblok/Storyblok.constant'
import {
Expand All @@ -17,7 +16,6 @@ import {
type PageLink,
} from '@/services/storyblok/Storyblok.helpers'
import { getCmsPageLinks, getStoryBySlug } from '@/services/storyblok/storyblok.rsc'
import { Features } from '@/utils/Features'
import { locales } from '@/utils/l10n/locales'
import {
getHrefLang,
Expand Down Expand Up @@ -50,7 +48,7 @@ export default async function CmsPage({ params }: Props) {
const { hideBreadcrumbs, hideChat } = story.content
let chat: ReactNode = null
if (!hideChat) {
chat = Features.enabled('CUSTOM_CHAT') ? <ContactUs /> : <CustomerFirstScript />
chat = <ContactUs />
}
if (isProductStory(story)) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Head from 'next/head'
import { type ComponentProps } from 'react'
import { Heading } from 'ui'
import { CarBuyerValidationPage } from '@/features/carDealership/CarBuyerValidationPage'
import { hideChatOnPage } from '@/services/CustomerFirst'
import { hideChatOnPage } from '@/services/pageChat'
import { patchNextI18nContext } from '@/utils/patchNextI18nContext'

type Props = ComponentProps<typeof CarBuyerValidationPage> & { authenticated: boolean }
Expand Down
2 changes: 1 addition & 1 deletion apps/store/src/pages/[locale]/widget/[[...slug]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { fetchCompanyReviewsMetadata } from '@/features/memberReviews/memberRevi
import type { ReviewsMetadata } from '@/features/memberReviews/memberReviews.types'
import { HeaderFrame, LogoArea } from '@/features/widget/Header'
import { STORYBLOK_WIDGET_FOLDER_SLUG } from '@/features/widget/widget.constants'
import { hideChatOnPage } from '@/services/CustomerFirst'
import { hideChatOnPage } from '@/services/pageChat'
import {
getPageLinks,
getRevalidate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { ProductDataProvider } from '@/components/ProductData/ProductDataProvide
import { CalculatePricePage } from '@/features/widget/CalculatePricePage'
import { fetchFlowStory, getWidgetPriceTemplate } from '@/features/widget/widget.helpers'
import { addApolloState, initializeApolloServerSide } from '@/services/apollo/client'
import { hideChatOnPage } from '@/services/CustomerFirst'
import {
useShopSessionQuery,
useWidgetPriceIntentQuery,
WidgetPriceIntentDocument,
type WidgetPriceIntentQuery,
} from '@/services/graphql/generated'
import { hideChatOnPage } from '@/services/pageChat'
import { SHOP_SESSION_PROP_NAME } from '@/services/shopSession/ShopSession.constants'
import { setupShopSessionServiceServerSide } from '@/services/shopSession/ShopSession.helpers'
import { ShopSessionProvider, useShopSessionId } from '@/services/shopSession/ShopSessionContext'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { ProductDataProvider } from '@/components/ProductData/ProductDataProvide
import { SignPage } from '@/features/widget/SignPage'
import { fetchFlowStory } from '@/features/widget/widget.helpers'
import { initializeApolloServerSide } from '@/services/apollo/client'
import { hideChatOnPage } from '@/services/CustomerFirst'
import { usePriceIntentQuery, useShopSessionQuery } from '@/services/graphql/generated'
import { hideChatOnPage } from '@/services/pageChat'
import { priceIntentServiceInitServerSide } from '@/services/priceIntent/PriceIntentService'
import { setupShopSessionServiceServerSide } from '@/services/shopSession/ShopSession.helpers'
import { TrackingProvider } from '@/services/Tracking/TrackingContext'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { SuccessAnimation } from '@/components/ConfirmationPage/SuccessAnimation
import { fetchSwitchingData } from '@/components/ConfirmationPage/SwitchingAssistantSection/fetchSwitchingData'
import { ConfirmationPage } from '@/features/widget/ConfirmationPage'
import { addApolloState, initializeApolloServerSide } from '@/services/apollo/client'
import { hideChatOnPage } from '@/services/CustomerFirst'
import { useShopSessionQuery } from '@/services/graphql/generated'
import { hideChatOnPage } from '@/services/pageChat'
import { setupShopSessionServiceServerSide } from '@/services/shopSession/ShopSession.helpers'
import { getStoryById, type WidgetFlowStory } from '@/services/storyblok/storyblok'
import { isRoutingLocale } from '@/utils/l10n/localeUtils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import { type ComponentProps } from 'react'
import { PaymentPage } from '@/features/widget/PaymentPage'
import { initializeApolloServerSide } from '@/services/apollo/client'
import { hideChatOnPage } from '@/services/CustomerFirst'
import { hideChatOnPage } from '@/services/pageChat'
import { createTrustlyUrl } from '@/services/trustly/createTrustlyUrl'
import { isRoutingLocale } from '@/utils/l10n/localeUtils'
import { patchNextI18nContext } from '@/utils/patchNextI18nContext'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { parseProductNameSearchParams } from '@/features/widget/parseSearchParam
import { SelectProductPage } from '@/features/widget/SelectProductPage'
import { createPriceIntent, getWidgetPriceTemplate } from '@/features/widget/widget.helpers'
import { initializeApolloServerSide } from '@/services/apollo/client'
import { hideChatOnPage } from '@/services/CustomerFirst'
import { hideChatOnPage } from '@/services/pageChat'
import type { Template } from '@/services/PriceCalculator/PriceCalculator.types'
import { priceIntentServiceInitServerSide } from '@/services/priceIntent/PriceIntentService'
import { TrackingProvider } from '@/services/Tracking/TrackingContext'
Expand Down
8 changes: 4 additions & 4 deletions apps/store/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import { GlobalLinkStyles } from '@/components/RichText/RichText.styles'
import { usePublishWidgetInitEvent } from '@/features/widget/usePublishWidgetInitEvent'
import { useApollo } from '@/services/apollo/client'
import { BankIdContextProvider } from '@/services/bankId/BankIdContext'
import { CustomerFirstScript, hasHiddenChat } from '@/services/CustomerFirst'
import { useInitDatadogAfterInteractive } from '@/services/logger/client'
import { PageTransitionProgressBar } from '@/services/nprogress/pageTransition'
import { OneTrustStyles } from '@/services/OneTrust'
import { hasHiddenChat } from '@/services/pageChat'
import { SHOP_SESSION_PROP_NAME } from '@/services/shopSession/ShopSession.constants'
import { ShopSessionProvider, useShopSessionId } from '@/services/shopSession/ShopSessionContext'
import { initStoryblok } from '@/services/storyblok/storyblok'
Expand Down Expand Up @@ -84,9 +84,9 @@ const MyApp = ({ Component, pageProps }: AppPropsWithLayout) => {
const apolloClient = useApollo(pageProps)
const getLayout = Component.getLayout ?? ((page) => page)

let Chat: ReactNode = null
let chat: ReactNode = null
if (!hasHiddenChat(pageProps)) {
Chat = Features.enabled('CUSTOM_CHAT') ? <ContactUs /> : <CustomerFirstScript />
chat = <ContactUs />
}

return (
Expand All @@ -110,7 +110,7 @@ const MyApp = ({ Component, pageProps }: AppPropsWithLayout) => {
</BankIdContextProvider>
</ShopSessionTrackingProvider>
</ShopSessionProvider>
{Chat}
{chat}
</JotaiProvider>
</ApolloProvider>
</>
Expand Down
65 changes: 0 additions & 65 deletions apps/store/src/services/CustomerFirst.tsx

This file was deleted.

4 changes: 4 additions & 0 deletions apps/store/src/services/pageChat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const HIDE_CHAT_PAGE_PROP = '_hideChat'

export const hideChatOnPage = (hidden?: boolean) => ({ [HIDE_CHAT_PAGE_PROP]: hidden ?? true })
export const hasHiddenChat = (props: Record<string, unknown>) => Boolean(props[HIDE_CHAT_PAGE_PROP])
2 changes: 1 addition & 1 deletion apps/store/src/services/storyblok/getStoryblokPageProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { type BreadcrumbListItem } from '@/components/PageBreadcrumbs/PageBreadc
import { fetchCompanyReviewsMetadata } from '@/features/memberReviews/memberReviews'
import { type RoutingLocale } from '@/utils/l10n/types'
import { initializeApollo } from '../apollo/client'
import { hideChatOnPage } from '../CustomerFirst'
import { hideChatOnPage } from '../pageChat'
import type { PageStory, ProductStory } from './storyblok'
import { getStoryBySlug } from './storyblok'
import { STORY_PROP_NAME } from './Storyblok.constant'
Expand Down
1 change: 0 additions & 1 deletion apps/store/src/utils/Features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const config = {
COOKIE_BANNER: process.env.NEXT_PUBLIC_FEATURE_COOKIE_BANNER === 'true',
INSURELY: process.env.NEXT_PUBLIC_FEATURE_INSURELY === 'true',
SAS_PARTNERSHIP: process.env.NEXT_PUBLIC_FEATURE_SAS_PARTNERSHIP === 'true',
CUSTOM_CHAT: process.env.NEXT_PUBLIC_FEATURE_CUSTOM_CHAT === 'true',
MYMONEY: process.env.NEXT_PUBLIC_FEATURE_MYMONEY === 'true',
HIDE_REVIEWS_FROM_PRODUCT_AVERAGE_RATING:
process.env.NEXT_PUBLIC_HIDE_REVIEWS_FROM_PRODUCT_AVERAGE_RATING === 'true',
Expand Down

0 comments on commit 737c800

Please sign in to comment.