@funnelsgrove/payments 0.7.2 → 0.7.3

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 CHANGED
@@ -92,6 +92,7 @@ Funnels should call `resolvePublishedBillingRuntime` once at their runtime-provi
92
92
 
93
93
  - Keep every provider-specific component, hook, service, and test helper under `src/providers/<provider>`. Add future providers as sibling folders; do not place provider SDK imports in root `components`, `hooks`, or `services`.
94
94
  - Stripe owns real card fields and wallet controls. Local wallet buttons are placeholders until Stripe confirms availability.
95
+ - Keep `planId` as the funnel plan key and send Stripe's price id only as `providerPlanId`; the API uses both fields to resolve the active test/live offer mapping.
95
96
  - Wallet unavailable state must fall back to card/manual checkout or disappear.
96
97
  - Count `checkout_started` only at shared UI boundaries: when a shared card dialog opens or when Stripe reports an Apple Pay / Google Pay button click.
97
98
  - Pass `checkoutAnalytics` to every current shared dialog and wallet surface. The package then owns `checkout_started`, `add_payment_info`, and verified `checkout_completed`, all deduplicated by the actual Checkout Session.
@@ -355,6 +355,9 @@ export function getPaywallPlanSelectionValue(plan) {
355
355
  var _a;
356
356
  return ((_a = plan.providerPlanId) === null || _a === void 0 ? void 0 : _a.trim()) || plan.id;
357
357
  }
358
+ // The API resolves offer-set mappings by the funnel plan key. Stripe's price id travels in
359
+ // providerPlanId; duplicating it into planId bypasses the configured test/live offer mapping.
360
+ const getPaywallPlanRequestId = (plan) => plan.id.trim() || getPaywallPlanSelectionValue(plan);
358
361
  export function findPaywallPlan(plans, selectionValue) {
359
362
  const normalizedSelectionValue = (selectionValue === null || selectionValue === void 0 ? void 0 : selectionValue.trim()) || '';
360
363
  if (!normalizedSelectionValue) {
@@ -554,7 +557,7 @@ export async function createStripeOneTimeCheckout(input) {
554
557
  return funnelSdkService.createOneTimeCheckout({
555
558
  offerSetId: ((_a = input.plan.offerSetId) === null || _a === void 0 ? void 0 : _a.trim()) || undefined,
556
559
  offerSetKey: ((_b = input.plan.offerSetKey) === null || _b === void 0 ? void 0 : _b.trim()) || undefined,
557
- planId: getPaywallPlanSelectionValue(input.plan),
560
+ planId: getPaywallPlanRequestId(input.plan),
558
561
  providerPlanId: ((_c = input.plan.providerPlanId) === null || _c === void 0 ? void 0 : _c.trim()) || undefined,
559
562
  title: input.plan.title,
560
563
  description: ((_d = input.plan.description) === null || _d === void 0 ? void 0 : _d.trim()) || undefined,
@@ -641,7 +644,7 @@ export async function createStripeSubscriptionCheckout(input) {
641
644
  return funnelSdkService.createSubscriptionCheckout({
642
645
  offerSetId: ((_a = input.plan.offerSetId) === null || _a === void 0 ? void 0 : _a.trim()) || undefined,
643
646
  offerSetKey: ((_b = input.plan.offerSetKey) === null || _b === void 0 ? void 0 : _b.trim()) || undefined,
644
- planId: getPaywallPlanSelectionValue(input.plan),
647
+ planId: getPaywallPlanRequestId(input.plan),
645
648
  providerPlanId: ((_c = input.plan.providerPlanId) === null || _c === void 0 ? void 0 : _c.trim()) || undefined,
646
649
  title: input.plan.title,
647
650
  description: ((_d = input.plan.description) === null || _d === void 0 ? void 0 : _d.trim()) || undefined,
@@ -672,7 +675,7 @@ export async function updateStripeSubscriptionCheckoutPlan(input) {
672
675
  checkoutSessionId: input.checkoutSessionId.trim(),
673
676
  offerSetId: ((_a = input.plan.offerSetId) === null || _a === void 0 ? void 0 : _a.trim()) || undefined,
674
677
  offerSetKey: ((_b = input.plan.offerSetKey) === null || _b === void 0 ? void 0 : _b.trim()) || undefined,
675
- planId: getPaywallPlanSelectionValue(input.plan),
678
+ planId: getPaywallPlanRequestId(input.plan),
676
679
  providerPlanId: ((_c = input.plan.providerPlanId) === null || _c === void 0 ? void 0 : _c.trim()) || undefined,
677
680
  title: input.plan.title,
678
681
  description: ((_d = input.plan.description) === null || _d === void 0 ? void 0 : _d.trim()) || undefined,
@@ -712,7 +715,7 @@ export async function createStripeCheckoutSession(input) {
712
715
  return funnelSdkService.createHostedCheckoutSession({
713
716
  offerSetId: ((_a = input.plan.offerSetId) === null || _a === void 0 ? void 0 : _a.trim()) || undefined,
714
717
  offerSetKey: ((_b = input.plan.offerSetKey) === null || _b === void 0 ? void 0 : _b.trim()) || undefined,
715
- planId: getPaywallPlanSelectionValue(input.plan),
718
+ planId: getPaywallPlanRequestId(input.plan),
716
719
  providerPlanId: ((_c = input.plan.providerPlanId) === null || _c === void 0 ? void 0 : _c.trim()) || undefined,
717
720
  title: input.plan.title,
718
721
  description: ((_d = input.plan.description) === null || _d === void 0 ? void 0 : _d.trim()) || undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",