@funnelsgrove/payments 0.1.58 → 0.1.59

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.
@@ -1,10 +1,7 @@
1
- var _a, _b, _c, _d;
2
1
  import { loadStripe } from '@stripe/stripe-js';
3
2
  import { billingPlanList, } from '../config/billing.config.js';
4
- import { FUNNEL_ID, FUNNEL_SDK_PUBLISHABLE_KEY, funnelSdkService, runtimeEnvConfig, } from '@funnelsgrove/runtime';
3
+ import { FUNNEL_ID, FUNNEL_SDK_PUBLISHABLE_KEY, funnelSdkService, } from '@funnelsgrove/runtime';
5
4
  import { isBillingPlanMappingCatalog, resolveMappedProjectPlans, } from './planCatalog.service.js';
6
- const STRIPE_TEST_PUBLISHABLE_KEY = ((_b = (_a = runtimeEnvConfig.stripeTestPublishableKey) !== null && _a !== void 0 ? _a : runtimeEnvConfig.stripePublishableKey) !== null && _b !== void 0 ? _b : '').trim();
7
- const STRIPE_LIVE_PUBLISHABLE_KEY = ((_d = (_c = runtimeEnvConfig.stripeLivePublishableKey) !== null && _c !== void 0 ? _c : runtimeEnvConfig.stripePublishableKey) !== null && _d !== void 0 ? _d : '').trim();
8
5
  const stripePromiseByKey = new Map();
9
6
  const syncedPlansPromiseByMode = new Map();
10
7
  export const buildPaywallPlanResolutionSignature = (options) => {
@@ -292,12 +289,6 @@ export function buildConfigPaywallPlans(planCatalog, orderedPlanIds = []) {
292
289
  : Object.entries(planCatalog !== null && planCatalog !== void 0 ? planCatalog : {}).map(([key, plan]) => toConfigPaywallPlan(key, plan));
293
290
  return getOrderedPaywallPlans(plans, orderedPlanIds);
294
291
  }
295
- const getStripePublishableKeyFromEnv = (mode) => {
296
- if (mode === 'live') {
297
- return STRIPE_LIVE_PUBLISHABLE_KEY || STRIPE_TEST_PUBLISHABLE_KEY;
298
- }
299
- return STRIPE_TEST_PUBLISHABLE_KEY || STRIPE_LIVE_PUBLISHABLE_KEY;
300
- };
301
292
  const toFallbackPaywallPlans = (planCatalog, options) => {
302
293
  const sourcePlans = buildConfigPaywallPlans(planCatalog);
303
294
  return reorderPlans(sourcePlans.length > 0 ? sourcePlans : fallbackPaywallPlans, options === null || options === void 0 ? void 0 : options.pricing);
@@ -430,7 +421,8 @@ export async function getPaywallPlans(mode, planCatalog, options) {
430
421
  return getFallbackPlans(planCatalog, options);
431
422
  }
432
423
  export function isStripeConfigured(mode) {
433
- return getStripePublishableKeyFromEnv(mode).length > 0 || FUNNEL_SDK_PUBLISHABLE_KEY.length > 0;
424
+ void mode;
425
+ return FUNNEL_SDK_PUBLISHABLE_KEY.length > 0;
434
426
  }
435
427
  export function getStripePromise(_mode, runtimePublishableKey) {
436
428
  const resolvedPublishableKey = (runtimePublishableKey === null || runtimePublishableKey === void 0 ? void 0 : runtimePublishableKey.trim()) || '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",