Skip to content

Commit 0ec1dec

Browse files
authored
Merge pull request #20246 from mozilla/churn_fix-email-entrypoint
polish(payments-next): Set entrypoint and update error reasons
2 parents 79839a5 + 447ca15 commit 0ec1dec

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

libs/payments/metrics/src/lib/glean/glean.types.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,24 @@ export type Outcome =
148148
| 'error';
149149

150150
export const ErrorReasons = [
151+
'already_canceling_at_period_end',
152+
'current_interval_not_found',
151153
'customer_mismatch',
152154
'discount_already_applied',
155+
'failed_to_redeem_coupon',
153156
'general_error',
157+
'no_cancel_interstitial_offer_found',
154158
'no_churn_intervention_found',
159+
'no_upgrade_plan_found',
160+
'not_eligible_for_upgrade_interval',
161+
'offering_id_not_found',
162+
'operation_denied',
155163
'redemption_limit_exceeded',
164+
'stripe_price_id_not_found',
165+
'stripe_subscription_update_failed',
156166
'subscription_not_active',
157167
'subscription_not_found',
158168
'subscription_still_active',
159-
'operation_denied',
160169
'unexpected_exception',
161170
] as const;
162171

libs/payments/metrics/src/lib/glean/utils/mapErrorReason.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ describe('mapErrorReason', () => {
99
expect(mapErrorReason('customer_mismatch')).toEqual('customer_mismatch');
1010
});
1111

12+
it('should return the value for an interstitial offer ErrorReason', () => {
13+
expect(mapErrorReason('no_upgrade_plan_found')).toEqual('no_upgrade_plan_found');
14+
});
15+
1216
it('should return general_error for an invalid value', () => {
1317
expect(mapErrorReason('not_a_real_reason')).toEqual('general_error');
1418
});

libs/payments/ui/src/lib/client/components/ChurnStaySubscribed/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ export function ChurnStaySubscribed({
101101
eligibilityStatus: 'stay' as const,
102102
offeringId: apiIdentifier,
103103
interval: interval as Interval,
104-
entrypoint: searchParams.get('entrypoint') ?? undefined,
104+
entrypoint:
105+
searchParams.get('entrypoint') ??
106+
(searchParams.get('utm_medium') === 'email' ? 'email' : undefined),
105107
utmSource: searchParams.get('utm_source') ?? undefined,
106108
utmMedium: searchParams.get('utm_medium') ?? undefined,
107109
utmCampaign: searchParams.get('utm_campaign') ?? undefined,

0 commit comments

Comments
 (0)