Skip to content

Commit

Permalink
Merge branch 'master' into feat/flags-to-prod
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarticus committed Dec 17, 2024
2 parents 1a78aee + 1847e4a commit f45d6f6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { LemonBanner, LemonButton, Link } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { SupportForm } from 'lib/components/Support/SupportForm'
import { getPublicSupportSnippet, supportLogic } from 'lib/components/Support/supportLogic'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import React from 'react'
import { billingLogic } from 'scenes/billing/billingLogic'
import { organizationLogic } from 'scenes/organizationLogic'
Expand Down Expand Up @@ -95,8 +97,14 @@ const Section = ({ title, children }: { title: string; children: React.ReactNode
)
}

// In order to set these turn on the `support-message-override` feature flag.
const SUPPORT_MESSAGE_OVERRIDE_TITLE = '🎄 🎅 Support during the holidays 🎁 ⛄'
const SUPPORT_MESSAGE_OVERRIDE_BODY =
"We're offering reduced support while we celebrate the holidays. Responses may be slower than normal over the holiday period (23rd December to the 6th January), and between the 25th and 27th of December we'll only be responding to critical issues. Thanks for your patience!"

const SupportFormBlock = ({ onCancel }: { onCancel: () => void }): JSX.Element => {
const { supportPlans, hasSupportAddonPlan } = useValues(billingLogic)
const { featureFlags } = useValues(featureFlagLogic)

return (
<Section title="Email an engineer">
Expand All @@ -123,36 +131,46 @@ const SupportFormBlock = ({ onCancel }: { onCancel: () => void }): JSX.Element =
Cancel
</LemonButton>
<br />
<div className="grid grid-cols-2 border rounded [&_>*]:px-2 [&_>*]:py-0.5 mb-4 bg-bg-light pt-4">
<div className="col-span-full flex justify-between border-b bg-bg-white py-1">
{/* If placing a support message, replace the line below with explanation */}
<strong>Avg support response times</strong>
<div>
<Link to={urls.organizationBilling([ProductKey.PLATFORM_AND_SUPPORT])}>Explore options</Link>
{featureFlags[FEATURE_FLAGS.SUPPORT_MESSAGE_OVERRIDE] ? (
<div className="border bg-bg-light p-2 rounded gap-2">
<strong>{SUPPORT_MESSAGE_OVERRIDE_TITLE}</strong>
<p className="mt-2 mb-0">{SUPPORT_MESSAGE_OVERRIDE_BODY}</p>
</div>
) : (
<div className="grid grid-cols-2 border rounded [&_>*]:px-2 [&_>*]:py-0.5 mb-4 bg-bg-light pt-4">
<div className="col-span-full flex justify-between py-1">
{/* If placing a support message, replace the line below with explanation */}
<strong>Avg support response times</strong>
<div>
<Link to={urls.organizationBilling([ProductKey.PLATFORM_AND_SUPPORT])}>
Explore options
</Link>
</div>
</div>
{/* If placing a support message, comment out (don't remove) the section below */}
{supportPlans?.map((plan) => {
// If they have an addon plan, only show the addon plan
const currentPlan =
plan.current_plan && (!hasSupportAddonPlan || plan.plan_key?.includes('addon'))
return (
<React.Fragment key={`support-panel-${plan.plan_key}`}>
<div className={currentPlan ? 'font-bold' : undefined}>
{plan.name}
{currentPlan && (
<>
{' '}
<span className="font-normal opacity-60 text-sm">(your plan)</span>
</>
)}
</div>
<div className={currentPlan ? 'font-bold' : undefined}>
{plan.features.find((f) => f.key == AvailableFeature.SUPPORT_RESPONSE_TIME)?.note}
</div>
</React.Fragment>
)
})}
</div>
{/* If placing a support message, comment out (don't remove) the section below */}
{supportPlans?.map((plan) => {
// If they have an addon plan, only show the addon plan
const currentPlan = plan.current_plan && (!hasSupportAddonPlan || plan.plan_key?.includes('addon'))
return (
<React.Fragment key={`support-panel-${plan.plan_key}`}>
<div className={currentPlan ? 'font-bold' : undefined}>
{plan.name}
{currentPlan && (
<>
{' '}
<span className="font-normal opacity-60 text-sm">(your plan)</span>
</>
)}
</div>
<div className={currentPlan ? 'font-bold' : undefined}>
{plan.features.find((f) => f.key == AvailableFeature.SUPPORT_RESPONSE_TIME)?.note}
</div>
</React.Fragment>
)
})}
</div>
)}
</Section>
)
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export const FEATURE_FLAGS = {
HOG_TRANSFORMATIONS: 'hog-transformations', // owner: #team-cdp
REPLAY_HOGQL_FILTERS: 'replay-hogql-filters', // owner: @pauldambra #team-replay
REPLAY_LIST_RECORDINGS_AS_QUERY: 'replay-list-recordings-as-query', // owner: @pauldambra #team-replay
SUPPORT_MESSAGE_OVERRIDE: 'support-message-override', // owner: @abigail
BILLING_SKIP_FORECASTING: 'billing-skip-forecasting', // owner: @zach
EXPERIMENT_STATS_V2: 'experiment-stats-v2', // owner: @danielbachhuber #team-experiments
WEB_ANALYTICS_PERIOD_COMPARISON: 'web-analytics-period-comparison', // owner: @rafaeelaudibert #team-web-analytics
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scenes/surveys/SurveyEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ export default function SurveyEdit(): JSX.Element {
}
}}
/>
Don't show to users who saw a survey within the last
Don't show to users who saw any survey in the last
<LemonInput
type="number"
size="xsmall"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ def _current_period_expression(self, field="start_timestamp"):
)

def _previous_period_expression(self, field="start_timestamp"):
# NOTE: Returning `ast.Constant(value=None)` is painfully slow, make sure we return a boolean
if not self.query_compare_to_date_range:
return ast.Constant(value=None)
return ast.Constant(value=False)

return ast.Call(
name="and",
Expand Down

0 comments on commit f45d6f6

Please sign in to comment.