@funnelsgrove/payments 0.11.4 → 0.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/providers/stripe/hooks/checkoutAttempt.d.ts +11 -0
- package/dist/providers/stripe/hooks/checkoutAttempt.js +10 -0
- package/dist/providers/stripe/hooks/useStripeOneTimeCheckoutSession.js +10 -5
- package/dist/providers/stripe/hooks/useStripeSubscriptionCheckoutSession.js +17 -1
- package/dist/providers/stripe/services/checkout/createOneTimeCheckout.d.ts +2 -0
- package/dist/providers/stripe/services/checkout/createOneTimeCheckout.js +5 -0
- package/dist/providers/stripe/services/checkout/createSubscriptionCheckout.d.ts +2 -0
- package/dist/providers/stripe/services/checkout/createSubscriptionCheckout.js +5 -0
- package/dist/providers/stripe/services/checkout/requests.d.ts +84 -0
- package/dist/providers/stripe/services/checkout/requests.js +100 -0
- package/dist/providers/stripe/services/checkout/types.d.ts +84 -0
- package/dist/providers/stripe/services/checkout/types.js +1 -0
- package/dist/providers/stripe/services/checkout/updateSubscriptionCheckoutPlan.d.ts +2 -0
- package/dist/providers/stripe/services/checkout/updateSubscriptionCheckoutPlan.js +5 -0
- package/dist/providers/stripe/services/checkout/verifySubscriptionCheckoutPayment.d.ts +2 -0
- package/dist/providers/stripe/services/checkout/verifySubscriptionCheckoutPayment.js +5 -0
- package/dist/providers/stripe/services/hostedCheckout/createCheckoutSession.d.ts +2 -0
- package/dist/providers/stripe/services/hostedCheckout/createCheckoutSession.js +5 -0
- package/dist/providers/stripe/services/hostedCheckout/redirectToCheckout.d.ts +2 -0
- package/dist/providers/stripe/services/hostedCheckout/redirectToCheckout.js +13 -0
- package/dist/providers/stripe/services/hostedCheckout/requests.d.ts +20 -0
- package/dist/providers/stripe/services/hostedCheckout/requests.js +26 -0
- package/dist/providers/stripe/services/hostedCheckout/types.d.ts +24 -0
- package/dist/providers/stripe/services/hostedCheckout/types.js +1 -0
- package/dist/providers/stripe/services/oneClick/chargePayment.d.ts +2 -0
- package/dist/providers/stripe/services/oneClick/chargePayment.js +5 -0
- package/dist/providers/stripe/services/oneClick/completePayment.d.ts +3 -0
- package/dist/providers/stripe/services/oneClick/completePayment.js +13 -0
- package/dist/providers/stripe/services/oneClick/confirmation.d.ts +6 -0
- package/dist/providers/stripe/services/oneClick/confirmation.js +22 -0
- package/dist/providers/stripe/services/oneClick/requests.d.ts +20 -0
- package/dist/providers/stripe/services/oneClick/requests.js +23 -0
- package/dist/providers/stripe/services/oneClick/types.d.ts +40 -0
- package/dist/providers/stripe/services/oneClick/types.js +1 -0
- package/dist/providers/stripe/services/paymentIntent/createPaymentIntent.d.ts +5 -0
- package/dist/providers/stripe/services/paymentIntent/createPaymentIntent.js +8 -0
- package/dist/providers/stripe/services/paymentIntent/requests.d.ts +12 -0
- package/dist/providers/stripe/services/paymentIntent/requests.js +15 -0
- package/dist/providers/stripe/services/paymentIntent/types.d.ts +18 -0
- package/dist/providers/stripe/services/paymentIntent/types.js +1 -0
- package/dist/providers/stripe/services/shared/checkout.validator.d.ts +3 -0
- package/dist/providers/stripe/services/shared/checkout.validator.js +15 -0
- package/dist/providers/stripe/services/shared/checkoutMetadata.d.ts +3 -0
- package/dist/providers/stripe/services/shared/checkoutMetadata.js +107 -0
- package/dist/providers/stripe/services/shared/types.d.ts +2 -0
- package/dist/providers/stripe/services/shared/types.js +1 -0
- package/dist/providers/stripe/services/stripe.service.d.ts +29 -221
- package/dist/providers/stripe/services/stripe.service.js +20 -546
- package/dist/providers/stripe/services/stripeClient.d.ts +4 -0
- package/dist/providers/stripe/services/stripeClient.js +19 -0
- package/dist/services/paywallOffer.service.d.ts +1 -1
- package/dist/services/paywallPlans/recurring.d.ts +2 -0
- package/dist/services/paywallPlans/recurring.js +72 -0
- package/dist/services/paywallPlans/selection.d.ts +11 -0
- package/dist/services/paywallPlans/selection.js +144 -0
- package/dist/services/paywallPlans/types.d.ts +39 -0
- package/dist/services/paywallPlans/types.js +1 -0
- package/dist/services/paywallPlans.service.d.ts +10 -0
- package/dist/services/paywallPlans.service.js +8 -0
- package/dist/services/publishedBillingRuntime.service.d.ts +1 -1
- package/dist/services/publishedBillingRuntime.service.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const asTrimmedStringOrNull = (value) => {
|
|
2
|
+
if (typeof value !== 'string') {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
5
|
+
const trimmed = value.trim();
|
|
6
|
+
return trimmed || null;
|
|
7
|
+
};
|
|
8
|
+
const asFiniteNumberOrNull = (value) => {
|
|
9
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
const asPositiveIntOrNull = (value) => {
|
|
15
|
+
const numeric = asFiniteNumberOrNull(value);
|
|
16
|
+
if (numeric === null || numeric <= 0) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return Math.round(numeric);
|
|
20
|
+
};
|
|
21
|
+
const asBillingPlanIntervalOrNull = (value) => {
|
|
22
|
+
var _a;
|
|
23
|
+
const normalized = (_a = asTrimmedStringOrNull(value)) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
24
|
+
if (normalized !== 'day' &&
|
|
25
|
+
normalized !== 'week' &&
|
|
26
|
+
normalized !== 'month' &&
|
|
27
|
+
normalized !== 'year') {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return normalized;
|
|
31
|
+
};
|
|
32
|
+
const inferCheckoutPlanRecurringFromText = (value) => {
|
|
33
|
+
const normalized = value === null || value === void 0 ? void 0 : value.trim().toLowerCase();
|
|
34
|
+
if (!normalized) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const countedMatch = normalized.match(/(\d+)\s*[- ]?(day|week|month|year)s?\b/);
|
|
38
|
+
if (countedMatch) {
|
|
39
|
+
return {
|
|
40
|
+
interval: countedMatch[2],
|
|
41
|
+
intervalCount: Number.parseInt(countedMatch[1] || '1', 10) || 1,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (normalized.includes('daily') || normalized.includes('day')) {
|
|
45
|
+
return { interval: 'day', intervalCount: 1 };
|
|
46
|
+
}
|
|
47
|
+
if (normalized.includes('weekly') || normalized.includes('week')) {
|
|
48
|
+
return { interval: 'week', intervalCount: 1 };
|
|
49
|
+
}
|
|
50
|
+
if (normalized.includes('monthly') || normalized.includes('month')) {
|
|
51
|
+
return { interval: 'month', intervalCount: 1 };
|
|
52
|
+
}
|
|
53
|
+
if (normalized.includes('yearly') ||
|
|
54
|
+
normalized.includes('annual') ||
|
|
55
|
+
normalized.includes('year')) {
|
|
56
|
+
return { interval: 'year', intervalCount: 1 };
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
};
|
|
60
|
+
export const resolveCheckoutPlanRecurringConfig = (plan) => {
|
|
61
|
+
const explicitInterval = asBillingPlanIntervalOrNull(plan.billingInterval);
|
|
62
|
+
if (explicitInterval) {
|
|
63
|
+
return {
|
|
64
|
+
interval: explicitInterval,
|
|
65
|
+
intervalCount: asPositiveIntOrNull(plan.billingIntervalCount) || 1,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return (inferCheckoutPlanRecurringFromText(plan.title) ||
|
|
69
|
+
inferCheckoutPlanRecurringFromText(plan.providerPlanId) ||
|
|
70
|
+
inferCheckoutPlanRecurringFromText(plan.id) ||
|
|
71
|
+
inferCheckoutPlanRecurringFromText(plan.description));
|
|
72
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BillingFallbackPlanConfig, BillingPlanCatalog, BillingPlanInputCatalog } from '../../config/billing.config.js';
|
|
2
|
+
import type { PaywallPlan, PaywallPlanResolutionOptions } from './types.js';
|
|
3
|
+
import type { ResolvedCountryPricing } from '@funnelsgrove/runtime';
|
|
4
|
+
export declare function buildConfigPaywallPlans(planCatalog?: BillingPlanCatalog | readonly BillingFallbackPlanConfig[], orderedPlanIds?: readonly string[]): readonly PaywallPlan[];
|
|
5
|
+
export declare function getFallbackPlans(planCatalog?: BillingPlanInputCatalog | readonly BillingFallbackPlanConfig[], options?: PaywallPlanResolutionOptions): readonly PaywallPlan[];
|
|
6
|
+
export declare function getOrderedPaywallPlans(plans: readonly PaywallPlan[], orderedPlanIds: readonly string[]): readonly PaywallPlan[];
|
|
7
|
+
export declare function getDefaultPlanId(plans: readonly PaywallPlan[], pricing?: ResolvedCountryPricing<string> | null): string | null;
|
|
8
|
+
export declare function getPaywallPlanSelectionValue(plan: Pick<PaywallPlan, 'id' | 'providerPlanId'>): string;
|
|
9
|
+
export declare const getPaywallPlanRequestId: (plan: Pick<PaywallPlan, "id" | "providerPlanId">) => string;
|
|
10
|
+
export declare function findPaywallPlan(plans: readonly PaywallPlan[], selectionValue: string | null | undefined): PaywallPlan | null;
|
|
11
|
+
export declare function getDefaultPlanSelectionValue(plans: readonly PaywallPlan[], pricing?: ResolvedCountryPricing<string> | null): string | null;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { billingPlanList } from '../../config/billing.config.js';
|
|
2
|
+
import { isBillingPlanMappingCatalog } from '../planCatalog.service.js';
|
|
3
|
+
const parseBillingIntervalFromText = (value) => {
|
|
4
|
+
const normalized = (value === null || value === void 0 ? void 0 : value.trim().toLowerCase()) || '';
|
|
5
|
+
if (!normalized) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
const explicitMatch = normalized.match(/(?:^|[^a-z])(\d+)?\s*-?\s*(day|week|month|year)s?(?:[^a-z]|$)/);
|
|
9
|
+
if (explicitMatch === null || explicitMatch === void 0 ? void 0 : explicitMatch[2]) {
|
|
10
|
+
return {
|
|
11
|
+
interval: explicitMatch[2],
|
|
12
|
+
intervalCount: explicitMatch[1] ? Number(explicitMatch[1]) : 1,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const slashMatch = normalized.match(/\/\s*(day|week|month|year)s?\b/);
|
|
16
|
+
if (slashMatch === null || slashMatch === void 0 ? void 0 : slashMatch[1]) {
|
|
17
|
+
return {
|
|
18
|
+
interval: slashMatch[1],
|
|
19
|
+
intervalCount: 1,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
const resolveConfigBillingInterval = (plan) => {
|
|
25
|
+
var _a, _b, _c, _d;
|
|
26
|
+
const inferred = (_a = parseBillingIntervalFromText(plan.priceLabel)) !== null && _a !== void 0 ? _a : parseBillingIntervalFromText(plan.title);
|
|
27
|
+
const interval = (_b = plan.billingInterval) !== null && _b !== void 0 ? _b : inferred === null || inferred === void 0 ? void 0 : inferred.interval;
|
|
28
|
+
if (!interval) {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
interval,
|
|
33
|
+
intervalCount: (_d = (_c = plan.billingIntervalCount) !== null && _c !== void 0 ? _c : inferred === null || inferred === void 0 ? void 0 : inferred.intervalCount) !== null && _d !== void 0 ? _d : 1,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const toConfigPaywallPlan = (key, plan) => {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
const interval = resolveConfigBillingInterval(plan);
|
|
39
|
+
return Object.assign(Object.assign({}, plan), { id: ((_a = plan.id) === null || _a === void 0 ? void 0 : _a.trim()) || key.trim() || ((_b = plan.providerPlanId) === null || _b === void 0 ? void 0 : _b.trim()) || plan.projectPlanId.trim(), perDayLabel: ((_c = plan.perDayLabel) === null || _c === void 0 ? void 0 : _c.trim()) || 'per day', billingInterval: interval.interval, billingIntervalCount: interval.intervalCount, source: 'config' });
|
|
40
|
+
};
|
|
41
|
+
const fallbackPaywallPlans = buildConfigPaywallPlans(billingPlanList);
|
|
42
|
+
const reorderPlans = (plans, pricing) => {
|
|
43
|
+
if (!pricing || pricing.offerOrder.length === 0) {
|
|
44
|
+
return plans;
|
|
45
|
+
}
|
|
46
|
+
const orderByPlanId = new Map(pricing.offerOrder.map((planId, index) => [planId, index]));
|
|
47
|
+
return [...plans].sort((left, right) => {
|
|
48
|
+
const leftIndex = orderByPlanId.get(left.id);
|
|
49
|
+
const rightIndex = orderByPlanId.get(right.id);
|
|
50
|
+
if (leftIndex === undefined && rightIndex === undefined) {
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
if (leftIndex === undefined) {
|
|
54
|
+
return 1;
|
|
55
|
+
}
|
|
56
|
+
if (rightIndex === undefined) {
|
|
57
|
+
return -1;
|
|
58
|
+
}
|
|
59
|
+
return leftIndex - rightIndex;
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
export function buildConfigPaywallPlans(planCatalog, orderedPlanIds = []) {
|
|
63
|
+
const plans = Array.isArray(planCatalog)
|
|
64
|
+
? planCatalog.map((plan, index) => toConfigPaywallPlan(String(index), plan))
|
|
65
|
+
: Object.entries(planCatalog !== null && planCatalog !== void 0 ? planCatalog : {}).map(([key, plan]) => toConfigPaywallPlan(key, plan));
|
|
66
|
+
return getOrderedPaywallPlans(plans, orderedPlanIds);
|
|
67
|
+
}
|
|
68
|
+
const toFallbackPaywallPlans = (planCatalog, options) => {
|
|
69
|
+
const sourcePlans = buildConfigPaywallPlans(planCatalog);
|
|
70
|
+
return reorderPlans(sourcePlans.length > 0 ? sourcePlans : fallbackPaywallPlans, options === null || options === void 0 ? void 0 : options.pricing);
|
|
71
|
+
};
|
|
72
|
+
const isFallbackBillingPlanCatalog = (planCatalog) => {
|
|
73
|
+
return Array.isArray(planCatalog) || !isBillingPlanMappingCatalog(planCatalog);
|
|
74
|
+
};
|
|
75
|
+
export function getFallbackPlans(planCatalog, options) {
|
|
76
|
+
if (!planCatalog) {
|
|
77
|
+
return reorderPlans(fallbackPaywallPlans, options === null || options === void 0 ? void 0 : options.pricing);
|
|
78
|
+
}
|
|
79
|
+
if (!isFallbackBillingPlanCatalog(planCatalog)) {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
return toFallbackPaywallPlans(planCatalog, options);
|
|
83
|
+
}
|
|
84
|
+
export function getOrderedPaywallPlans(plans, orderedPlanIds) {
|
|
85
|
+
if (orderedPlanIds.length === 0) {
|
|
86
|
+
return plans;
|
|
87
|
+
}
|
|
88
|
+
const planByKey = new Map();
|
|
89
|
+
for (const plan of plans) {
|
|
90
|
+
for (const key of [plan.id, plan.providerPlanId]) {
|
|
91
|
+
const normalizedKey = key === null || key === void 0 ? void 0 : key.trim();
|
|
92
|
+
if (normalizedKey && !planByKey.has(normalizedKey)) {
|
|
93
|
+
planByKey.set(normalizedKey, plan);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const selectedPlans = [];
|
|
98
|
+
const selectedPlanIds = new Set();
|
|
99
|
+
for (const planId of orderedPlanIds) {
|
|
100
|
+
const plan = planByKey.get(planId.trim()) || null;
|
|
101
|
+
if (!plan || selectedPlanIds.has(plan.id)) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
selectedPlans.push(plan);
|
|
105
|
+
selectedPlanIds.add(plan.id);
|
|
106
|
+
}
|
|
107
|
+
return selectedPlans;
|
|
108
|
+
}
|
|
109
|
+
export function getDefaultPlanId(plans, pricing) {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
if (plans.length === 0) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const countryDefaultPlanId = (_a = pricing === null || pricing === void 0 ? void 0 : pricing.defaultOfferKey) === null || _a === void 0 ? void 0 : _a.trim();
|
|
115
|
+
if (countryDefaultPlanId && plans.some((plan) => plan.id === countryDefaultPlanId)) {
|
|
116
|
+
return countryDefaultPlanId;
|
|
117
|
+
}
|
|
118
|
+
return ((_b = plans[0]) === null || _b === void 0 ? void 0 : _b.id) || null;
|
|
119
|
+
}
|
|
120
|
+
export function getPaywallPlanSelectionValue(plan) {
|
|
121
|
+
var _a;
|
|
122
|
+
return ((_a = plan.providerPlanId) === null || _a === void 0 ? void 0 : _a.trim()) || plan.id;
|
|
123
|
+
}
|
|
124
|
+
// The API resolves offer-set mappings by the funnel plan key. Stripe's price id travels in
|
|
125
|
+
// providerPlanId; duplicating it into planId bypasses the configured test/live offer mapping.
|
|
126
|
+
export const getPaywallPlanRequestId = (plan) => plan.id.trim() || getPaywallPlanSelectionValue(plan);
|
|
127
|
+
export function findPaywallPlan(plans, selectionValue) {
|
|
128
|
+
const normalizedSelectionValue = (selectionValue === null || selectionValue === void 0 ? void 0 : selectionValue.trim()) || '';
|
|
129
|
+
if (!normalizedSelectionValue) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
return (plans.find((plan) => {
|
|
133
|
+
var _a;
|
|
134
|
+
const providerPlanId = ((_a = plan.providerPlanId) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
135
|
+
return plan.id === normalizedSelectionValue || providerPlanId === normalizedSelectionValue;
|
|
136
|
+
}) || null);
|
|
137
|
+
}
|
|
138
|
+
export function getDefaultPlanSelectionValue(plans, pricing) {
|
|
139
|
+
const defaultPlanId = getDefaultPlanId(plans, pricing);
|
|
140
|
+
if (!defaultPlanId) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
return getPaywallPlanSelectionValue(plans.find((plan) => plan.id === defaultPlanId) || plans[0]);
|
|
144
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { BillingFallbackPlanConfig, BillingPlanInterval } from '../../config/billing.config.js';
|
|
2
|
+
import type { ResolvedCountryPricing } from '@funnelsgrove/runtime';
|
|
3
|
+
export type PaywallPlan = {
|
|
4
|
+
id: string;
|
|
5
|
+
funnelPlanKey?: string;
|
|
6
|
+
projectPlanId?: string;
|
|
7
|
+
offerSetId?: string;
|
|
8
|
+
offerSetKey?: string;
|
|
9
|
+
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
providerPlanId?: string;
|
|
12
|
+
priceLabel: string;
|
|
13
|
+
oldPriceLabel?: string;
|
|
14
|
+
featuredTag?: string;
|
|
15
|
+
perDayAmount: string;
|
|
16
|
+
perDayLabel: string;
|
|
17
|
+
amountCents: number;
|
|
18
|
+
analyticsPurchaseValue?: number;
|
|
19
|
+
comparison?: BillingFallbackPlanConfig['comparison'];
|
|
20
|
+
checkoutOriginalAmountCents?: number;
|
|
21
|
+
checkoutSummaryLabel?: string;
|
|
22
|
+
billingInterval?: BillingPlanInterval;
|
|
23
|
+
billingIntervalCount?: number;
|
|
24
|
+
followUpProviderPlanId?: string;
|
|
25
|
+
followUpPlanTitle?: string;
|
|
26
|
+
followUpBillingInterval?: BillingPlanInterval;
|
|
27
|
+
followUpBillingIntervalCount?: number;
|
|
28
|
+
introIterations?: number;
|
|
29
|
+
source: 'stripe' | 'config';
|
|
30
|
+
};
|
|
31
|
+
export type PaywallPlanResolutionOptions = {
|
|
32
|
+
locale?: string | null;
|
|
33
|
+
pricing?: ResolvedCountryPricing<string> | null;
|
|
34
|
+
};
|
|
35
|
+
export type CheckoutSessionPlanInput = Pick<PaywallPlan, 'amountCents' | 'analyticsPurchaseValue' | 'billingInterval' | 'billingIntervalCount' | 'description' | 'funnelPlanKey' | 'id' | 'providerPlanId' | 'title' | 'followUpProviderPlanId' | 'followUpPlanTitle' | 'followUpBillingInterval' | 'followUpBillingIntervalCount' | 'introIterations' | 'offerSetId' | 'offerSetKey'>;
|
|
36
|
+
export type CheckoutPlanRecurringConfig = {
|
|
37
|
+
interval: BillingPlanInterval;
|
|
38
|
+
intervalCount: number;
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { PaywallPlan } from './paywallPlans/types.js';
|
|
2
|
+
export type { PaywallPlanResolutionOptions } from './paywallPlans/types.js';
|
|
3
|
+
export { buildConfigPaywallPlans } from './paywallPlans/selection.js';
|
|
4
|
+
export { getFallbackPlans } from './paywallPlans/selection.js';
|
|
5
|
+
export { getOrderedPaywallPlans } from './paywallPlans/selection.js';
|
|
6
|
+
export { getDefaultPlanId } from './paywallPlans/selection.js';
|
|
7
|
+
export { getPaywallPlanSelectionValue } from './paywallPlans/selection.js';
|
|
8
|
+
export { findPaywallPlan } from './paywallPlans/selection.js';
|
|
9
|
+
export { getDefaultPlanSelectionValue } from './paywallPlans/selection.js';
|
|
10
|
+
export { resolveCheckoutPlanRecurringConfig } from './paywallPlans/recurring.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { buildConfigPaywallPlans } from './paywallPlans/selection.js';
|
|
2
|
+
export { getFallbackPlans } from './paywallPlans/selection.js';
|
|
3
|
+
export { getOrderedPaywallPlans } from './paywallPlans/selection.js';
|
|
4
|
+
export { getDefaultPlanId } from './paywallPlans/selection.js';
|
|
5
|
+
export { getPaywallPlanSelectionValue } from './paywallPlans/selection.js';
|
|
6
|
+
export { findPaywallPlan } from './paywallPlans/selection.js';
|
|
7
|
+
export { getDefaultPlanSelectionValue } from './paywallPlans/selection.js';
|
|
8
|
+
export { resolveCheckoutPlanRecurringConfig } from './paywallPlans/recurring.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FunnelExperimentDefinition, type FunnelManifestExperiment, type OfferSetRuntimePlanOverrides, type ResolvedFunnelRuntimeConfig, type ResolvedPublishedExperiments, type RuntimeMode } from '@funnelsgrove/runtime';
|
|
2
2
|
import type { BillingDiscountCatalog, BillingDiscountList, BillingFallbackPlanConfig, BillingPlanCatalog } from '../config/billing.config.js';
|
|
3
|
-
import { type PaywallPlan } from '
|
|
3
|
+
import { type PaywallPlan } from './paywallPlans.service.js';
|
|
4
4
|
export type PublishedBillingPlan = BillingFallbackPlanConfig & OfferSetRuntimePlanOverrides;
|
|
5
5
|
export type ResolvedPublishedBillingRuntime = {
|
|
6
6
|
revisionId: string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveGeneratedOfferSetRuntime, resolvePublishedOfferSetSelection, resolvePublishedRuntimeExperiments, } from '@funnelsgrove/runtime';
|
|
2
2
|
import { buildBillingDiscountCatalog } from './paywallOffer.service.js';
|
|
3
|
-
import { buildConfigPaywallPlans, } from '
|
|
3
|
+
import { buildConfigPaywallPlans, } from './paywallPlans.service.js';
|
|
4
4
|
export const resolvePublishedBillingRuntime = ({ config, featureFlags, mode, search = '', defaultOfferSetId, baseCatalogsByMode, fallbackDiscounts, resolvedExperiments = resolvePublishedRuntimeExperiments(config), }) => {
|
|
5
5
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6
6
|
const offerSets = (_a = config === null || config === void 0 ? void 0 : config.offerSets) !== null && _a !== void 0 ? _a : [];
|