Skip to content

Instantly share code, notes, and snippets.

@salemhilal
Created March 15, 2023 20:49
Show Gist options
  • Save salemhilal/94ab44095f8b77053d5501397d6a64c0 to your computer and use it in GitHub Desktop.
Save salemhilal/94ab44095f8b77053d5501397d6a64c0 to your computer and use it in GitHub Desktop.
commit 73eaa015e2841a90537295ac8cc1799306440ce1
Author: shilal <salem@getoctane.io>
Date: Wed Mar 15 16:47:58 2023 -0400
refactor: Remove flags related to ECP
We're takin it live for everyone
diff --git a/src/components/customer/CustomerDetailsContactCard.tsx b/src/components/customer/CustomerDetailsContactCard.tsx
index c59ab5ee..0e7412a7 100644
--- a/src/components/customer/CustomerDetailsContactCard.tsx
+++ b/src/components/customer/CustomerDetailsContactCard.tsx
@@ -12,7 +12,6 @@ import {
Tooltip,
} from '@chakra-ui/react';
import { useMemo } from 'react';
-import { useFlags } from 'launchdarkly-react-client-sdk';
import { CustomerDetailsContactCardQueryDocument } from './CustomerDetailsContactCard.generated';
import { useActiveVendorName } from 'hooks/useActiveVendor';
import {
@@ -61,7 +60,6 @@ export const CustomerDetailsContactCard = ({
const contactInfo = customer?.contactInfo;
const status = stringToCustomerStatus(data?.getCustomerStatus?.status);
- const { enableLinkToHostedPage = false } = useFlags();
const [isEditing, setIsEditing] = useOcBoolean(false);
const customerMetadata = useMemo<Record<string, string | undefined>>(() => {
@@ -113,7 +111,7 @@ export const CustomerDetailsContactCard = ({
/>
<HStack align="center" justify="space-between" w="full">
- <Box maxW={enableLinkToHostedPage ? 240 : 370}>
+ <Box maxW={240}>
<Text
textStyle="h2"
color="fontPrimary"
@@ -172,12 +170,10 @@ export const CustomerDetailsContactCard = ({
id={customerName}
/>
</HStack>
- {enableLinkToHostedPage && (
- <LinkToCustomerHostedPageCopyButton
- customerName={customerName}
- iconWidth={ICON_WIDTH}
- />
- )}
+ <LinkToCustomerHostedPageCopyButton
+ customerName={customerName}
+ iconWidth={ICON_WIDTH}
+ />
{/* For now, we're only showing these properties. We'll let them be editable in another pass. */}
{(vendorPropertiesAndValues.length ?? 0 > 0) && (
diff --git a/src/components/price_plan/PricePlanListContainer.tsx b/src/components/price_plan/PricePlanListContainer.tsx
index 3e8fd31d..84012f54 100644
--- a/src/components/price_plan/PricePlanListContainer.tsx
+++ b/src/components/price_plan/PricePlanListContainer.tsx
@@ -63,7 +63,6 @@ export const PricePlanListContainer = () => {
const { colors } = useOctaneTheme();
const vendorName = useActiveVendorName() ?? '';
const [filterText, setFilterText] = useURLState('pricePlanListFilter', '');
- const { enableHostedPageConfiguration = false } = useFlags();
const { loading, data, error } = useQuery(PricePlansPageQueryDocument, {
variables: {
@@ -138,9 +137,7 @@ export const PricePlanListContainer = () => {
<TabList>
<Tab key="Price Plans">Price Plans</Tab>
<Tab key="Coupons">Coupons</Tab>
- {enableHostedPageConfiguration && (
- <Tab key="Self-Serve">Self-Serve Configuration</Tab>
- )}
+ <Tab key="Self-Serve">Self-Serve Configuration</Tab>
</TabList>
<TabPanels
position="absolute"
@@ -268,7 +265,7 @@ export const PricePlanListContainer = () => {
</Grid>
)}
</TabPanel>
- {enableHostedPageConfiguration && <SelfServeConfigurationTab />}
+ <SelfServeConfigurationTab />
</TabPanels>
</Tabs>
</PageContainer>
diff --git a/src/components/vendor/settings/CredentialSettings.tsx b/src/components/vendor/settings/CredentialSettings.tsx
index 9c55231a..340ae082 100644
--- a/src/components/vendor/settings/CredentialSettings.tsx
+++ b/src/components/vendor/settings/CredentialSettings.tsx
@@ -89,7 +89,7 @@ export const CredentialSettings = ({
const { colors } = useOctaneTheme();
const vendorId = useActiveVendorIdAsNumber();
// const currencySymbol = useActiveCurrencySymbol();
- const { showCustomerProperties, enableHostedPageConfiguration } = useFlags();
+ const { showCustomerProperties } = useFlags();
const [showRollModal, setShowRollModal] = useOcBoolean(false);
const [showWebhookModal, setShowWebhookModal] = useOcBoolean(false);
@@ -364,10 +364,8 @@ export const CredentialSettings = ({
</OcFormSection>
)}
- {enableHostedPageConfiguration && (
- <>
- {/* // TODO: hide credits for now, BE isn't ready */}
- {/* <OcFormSection
+ {/* // TODO: hide credits for now, BE isn't ready */}
+ {/* <OcFormSection
title="Credits"
instructions="Credits allow you to maintain a dollar balance for your customers. You can manually grant credits or allow your customers to purchase their own."
>
@@ -435,80 +433,78 @@ export const CredentialSettings = ({
</VStack>
</Flex>
</OcFormSection> */}
- <OcFormSection
- title="Hosted Page"
- instructions="Configuration options for customer-facing hosted pages."
- >
- <VStack align="start" spacing={5}>
- <Flex alignContent="start">
- <Switch
- id="allowPurchaseCredits"
- size="md"
- isDisabled={loading}
- isChecked={allowPurchasingCredits}
- onChange={() =>
- hangleChangeSelfServeSettings(
- !allowPurchasingCredits,
- allowSwitchingPricePlans,
- allowCustomization,
- )
- }
- />
- <FormLabel htmlFor="allowPurchaseCredits" mb={0} ml={6}>
- <Text textStyle="body4" textColor="fontPrimary">
- Customers can purchase credits.
- </Text>
- </FormLabel>
- </Flex>
- <Flex alignContent="start">
- <Switch
- id="allowSwitchPricePlan"
- size="md"
- isDisabled={loading}
- isChecked={allowSwitchingPricePlans}
- onChange={() =>
- hangleChangeSelfServeSettings(
- allowPurchasingCredits,
- !allowSwitchingPricePlans,
- allowCustomization,
- )
- }
- />
- <FormLabel htmlFor="allowSwitchPricePlan" mb={0} ml={6}>
- <Text textStyle="body4" textColor="fontPrimary">
- Customers can switch their Price Plan.
- </Text>
- </FormLabel>
- </Flex>
- <Flex alignContent="start">
- <Switch
- id="allowCustomization"
- size="md"
- isDisabled={loading}
- isChecked={allowCustomization}
- onChange={() =>
- hangleChangeSelfServeSettings(
- allowPurchasingCredits,
- allowSwitchingPricePlans,
- !allowCustomization,
- )
- }
- />
- <Box ml={6}>
- <FormLabel htmlFor="allowCustomization" mb={0}>
- <Text textStyle="body4" textColor="fontPrimary">
- Use a custom theme on the hosted page.
- </Text>
- </FormLabel>
- <Button variant="link" onClick={setShowThemeEditor.on}>
- View and edit theme <ChevronRightIcon fontSize="18px" />
- </Button>
- </Box>
- </Flex>
- </VStack>
- </OcFormSection>
- </>
- )}
+ <OcFormSection
+ title="Hosted Page"
+ instructions="Configuration options for customer-facing hosted pages."
+ >
+ <VStack align="start" spacing={5}>
+ <Flex alignContent="start">
+ <Switch
+ id="allowPurchaseCredits"
+ size="md"
+ isDisabled={loading}
+ isChecked={allowPurchasingCredits}
+ onChange={() =>
+ hangleChangeSelfServeSettings(
+ !allowPurchasingCredits,
+ allowSwitchingPricePlans,
+ allowCustomization,
+ )
+ }
+ />
+ <FormLabel htmlFor="allowPurchaseCredits" mb={0} ml={6}>
+ <Text textStyle="body4" textColor="fontPrimary">
+ Customers can purchase credits.
+ </Text>
+ </FormLabel>
+ </Flex>
+ <Flex alignContent="start">
+ <Switch
+ id="allowSwitchPricePlan"
+ size="md"
+ isDisabled={loading}
+ isChecked={allowSwitchingPricePlans}
+ onChange={() =>
+ hangleChangeSelfServeSettings(
+ allowPurchasingCredits,
+ !allowSwitchingPricePlans,
+ allowCustomization,
+ )
+ }
+ />
+ <FormLabel htmlFor="allowSwitchPricePlan" mb={0} ml={6}>
+ <Text textStyle="body4" textColor="fontPrimary">
+ Customers can switch their Price Plan.
+ </Text>
+ </FormLabel>
+ </Flex>
+ <Flex alignContent="start">
+ <Switch
+ id="allowCustomization"
+ size="md"
+ isDisabled={loading}
+ isChecked={allowCustomization}
+ onChange={() =>
+ hangleChangeSelfServeSettings(
+ allowPurchasingCredits,
+ allowSwitchingPricePlans,
+ !allowCustomization,
+ )
+ }
+ />
+ <Box ml={6}>
+ <FormLabel htmlFor="allowCustomization" mb={0}>
+ <Text textStyle="body4" textColor="fontPrimary">
+ Use a custom theme on the hosted page.
+ </Text>
+ </FormLabel>
+ <Button variant="link" onClick={setShowThemeEditor.on}>
+ View and edit theme <ChevronRightIcon fontSize="18px" />
+ </Button>
+ </Box>
+ </Flex>
+ </VStack>
+ </OcFormSection>
<AddPropertyModal
isOpen={showAddPropertyModal}
diff --git a/src/types/launchdarkly-react-client-sdk.d.ts b/src/types/launchdarkly-react-client-sdk.d.ts
index b2caf7af..02c7110a 100644
--- a/src/types/launchdarkly-react-client-sdk.d.ts
+++ b/src/types/launchdarkly-react-client-sdk.d.ts
@@ -12,12 +12,9 @@ declare module 'launchdarkly-react-client-sdk' {
markInvoiceAsPaid: boolean;
customerAnalyticsTabs: boolean;
mrrAnalyticsTabs: boolean;
- enableLinkToHostedPage: boolean;
showCustomerProperties: boolean;
addOnImmediateCharge: boolean;
scopedDiscounts: boolean;
- enableHostedPageConfiguration: boolean;
- hostedPageCustomColors: boolean;
avalaraIntegration: boolean;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment