@nextsparkjs/core 0.1.0-beta.127 → 0.1.0-beta.129

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.
Files changed (157) hide show
  1. package/dist/components/billing/ConfirmPlanChangeModal.d.ts +29 -0
  2. package/dist/components/billing/ConfirmPlanChangeModal.d.ts.map +1 -0
  3. package/dist/components/billing/ConfirmPlanChangeModal.js +100 -0
  4. package/dist/components/billing/ManageBillingButton.d.ts +3 -3
  5. package/dist/components/billing/PricingTable.d.ts +3 -0
  6. package/dist/components/billing/PricingTable.d.ts.map +1 -1
  7. package/dist/components/billing/PricingTable.js +146 -71
  8. package/dist/components/billing/QuotaGate.d.ts +21 -0
  9. package/dist/components/billing/QuotaGate.d.ts.map +1 -0
  10. package/dist/components/billing/QuotaGate.js +33 -0
  11. package/dist/components/billing/index.d.ts +2 -0
  12. package/dist/components/billing/index.d.ts.map +1 -1
  13. package/dist/components/billing/index.js +4 -0
  14. package/dist/components/dashboard/block-editor/dynamic-form.d.ts.map +1 -1
  15. package/dist/components/dashboard/block-editor/dynamic-form.js +7 -5
  16. package/dist/contexts/SubscriptionContext.d.ts +2 -0
  17. package/dist/contexts/SubscriptionContext.d.ts.map +1 -1
  18. package/dist/contexts/SubscriptionContext.js +2 -0
  19. package/dist/hooks/index.d.ts +1 -0
  20. package/dist/hooks/index.d.ts.map +1 -1
  21. package/dist/hooks/index.js +1 -0
  22. package/dist/hooks/useQuotaCheck.d.ts +26 -0
  23. package/dist/hooks/useQuotaCheck.d.ts.map +1 -0
  24. package/dist/hooks/useQuotaCheck.js +33 -0
  25. package/dist/lib/api/entity/generic-handler.d.ts.map +1 -1
  26. package/dist/lib/api/entity/generic-handler.js +54 -6
  27. package/dist/lib/api/rate-limit.d.ts.map +1 -1
  28. package/dist/lib/api/rate-limit.js +9 -6
  29. package/dist/lib/billing/config-types.d.ts +2 -5
  30. package/dist/lib/billing/config-types.d.ts.map +1 -1
  31. package/dist/lib/billing/gateways/factory.d.ts +13 -2
  32. package/dist/lib/billing/gateways/factory.d.ts.map +1 -1
  33. package/dist/lib/billing/gateways/factory.js +13 -6
  34. package/dist/lib/billing/gateways/interface.d.ts +19 -1
  35. package/dist/lib/billing/gateways/interface.d.ts.map +1 -1
  36. package/dist/lib/billing/gateways/polar.d.ts +8 -1
  37. package/dist/lib/billing/gateways/polar.d.ts.map +1 -1
  38. package/dist/lib/billing/gateways/polar.js +25 -0
  39. package/dist/lib/billing/gateways/stripe.d.ts +8 -26
  40. package/dist/lib/billing/gateways/stripe.d.ts.map +1 -1
  41. package/dist/lib/billing/gateways/stripe.js +41 -44
  42. package/dist/lib/billing/gateways/types.d.ts +11 -0
  43. package/dist/lib/billing/gateways/types.d.ts.map +1 -1
  44. package/dist/lib/billing/jobs.d.ts +1 -1
  45. package/dist/lib/billing/polar-webhook.d.ts +38 -0
  46. package/dist/lib/billing/polar-webhook.d.ts.map +1 -0
  47. package/dist/lib/billing/polar-webhook.js +0 -0
  48. package/dist/lib/billing/schema.d.ts +1 -2
  49. package/dist/lib/billing/schema.d.ts.map +1 -1
  50. package/dist/lib/billing/schema.js +1 -1
  51. package/dist/lib/billing/stripe-webhook.d.ts +48 -0
  52. package/dist/lib/billing/stripe-webhook.d.ts.map +1 -0
  53. package/dist/lib/billing/stripe-webhook.js +316 -0
  54. package/dist/lib/billing/types.d.ts +6 -2
  55. package/dist/lib/billing/types.d.ts.map +1 -1
  56. package/dist/lib/oauth/index.d.ts +1 -1
  57. package/dist/lib/rate-limit-redis.d.ts +2 -2
  58. package/dist/lib/rate-limit-redis.d.ts.map +1 -1
  59. package/dist/lib/rate-limit-redis.js +22 -4
  60. package/dist/lib/selectors/core-selectors.d.ts +2 -2
  61. package/dist/lib/selectors/domains/superadmin.selectors.d.ts +2 -2
  62. package/dist/lib/selectors/domains/superadmin.selectors.js +2 -2
  63. package/dist/lib/selectors/selectors.d.ts +4 -4
  64. package/dist/lib/services/invoice.service.d.ts +3 -3
  65. package/dist/lib/services/invoice.service.js +2 -2
  66. package/dist/lib/services/membership.service.d.ts.map +1 -1
  67. package/dist/lib/services/membership.service.js +29 -0
  68. package/dist/lib/services/plan.service.d.ts +0 -3
  69. package/dist/lib/services/plan.service.d.ts.map +1 -1
  70. package/dist/lib/services/plan.service.js +3 -9
  71. package/dist/lib/services/subscription.service.d.ts +5 -5
  72. package/dist/lib/services/subscription.service.d.ts.map +1 -1
  73. package/dist/lib/services/subscription.service.js +54 -41
  74. package/dist/messages/de/billing.json +10 -0
  75. package/dist/messages/de/index.d.ts +9 -0
  76. package/dist/messages/de/index.d.ts.map +1 -1
  77. package/dist/messages/en/billing.json +21 -0
  78. package/dist/messages/en/index.d.ts +19 -0
  79. package/dist/messages/en/index.d.ts.map +1 -1
  80. package/dist/messages/es/billing.json +21 -0
  81. package/dist/messages/es/index.d.ts +19 -0
  82. package/dist/messages/es/index.d.ts.map +1 -1
  83. package/dist/messages/fr/billing.json +10 -0
  84. package/dist/messages/fr/index.d.ts +9 -0
  85. package/dist/messages/fr/index.d.ts.map +1 -1
  86. package/dist/messages/it/billing.json +10 -0
  87. package/dist/messages/it/index.d.ts +9 -0
  88. package/dist/messages/it/index.d.ts.map +1 -1
  89. package/dist/messages/pt/billing.json +10 -0
  90. package/dist/messages/pt/index.d.ts +9 -0
  91. package/dist/messages/pt/index.d.ts.map +1 -1
  92. package/dist/migrations/001_better_auth_and_functions.sql +5 -11
  93. package/dist/migrations/008_team_members_table.sql +27 -23
  94. package/dist/styles/classes.json +6 -2
  95. package/dist/styles/ui.css +1 -1
  96. package/dist/templates/app/api/auth/[...all]/route.ts +35 -0
  97. package/dist/templates/app/api/health/route.ts +43 -23
  98. package/dist/templates/app/api/internal/user-metadata/route.ts +10 -0
  99. package/dist/templates/app/api/superadmin/subscriptions/route.ts +5 -0
  100. package/dist/templates/app/api/superadmin/teams/[teamId]/route.ts +6 -0
  101. package/dist/templates/app/api/v1/billing/cancel/route.ts +9 -11
  102. package/dist/templates/app/api/v1/billing/change-plan/route.ts +3 -3
  103. package/dist/templates/app/api/v1/billing/check-action/route.ts +7 -6
  104. package/dist/templates/app/api/v1/billing/checkout/route.ts +40 -14
  105. package/dist/templates/app/api/v1/billing/portal/route.ts +6 -6
  106. package/dist/templates/app/api/v1/billing/presets.ts +1 -1
  107. package/dist/templates/app/api/v1/billing/webhooks/polar/route.ts +83 -6
  108. package/dist/templates/app/api/v1/billing/webhooks/stripe/route.ts +18 -421
  109. package/dist/templates/app/dashboard/settings/billing/page.tsx +9 -4
  110. package/dist/templates/app/dashboard/settings/plans/page.tsx +29 -7
  111. package/dist/templates/app/layout.tsx +14 -5
  112. package/dist/templates/app/superadmin/subscriptions/page.tsx +16 -14
  113. package/dist/templates/app/superadmin/teams/[teamId]/page.tsx +18 -15
  114. package/dist/templates/blocks/hero/component.tsx +6 -3
  115. package/dist/templates/blocks/hero/schema.ts +2 -1
  116. package/dist/templates/blocks/testimonials/component.tsx +2 -2
  117. package/dist/templates/blocks/testimonials/schema.ts +2 -2
  118. package/dist/templates/contents/themes/starter/tests/cypress/src/features/SuperadminPOM.ts +2 -2
  119. package/dist/templates/features/pages/blocks/hero/component.tsx +6 -3
  120. package/dist/templates/features/pages/blocks/hero/schema.ts +2 -1
  121. package/dist/templates/lib/billing/polar-webhook-extensions.ts +23 -0
  122. package/dist/templates/lib/billing/stripe-webhook-extensions.ts +23 -0
  123. package/dist/types/blocks.d.ts +24 -0
  124. package/dist/types/blocks.d.ts.map +1 -1
  125. package/dist/types/blocks.js +17 -1
  126. package/migrations/001_better_auth_and_functions.sql +5 -11
  127. package/migrations/008_team_members_table.sql +27 -23
  128. package/package.json +10 -2
  129. package/scripts/build/registry/generators/billing-registry.mjs +1 -2
  130. package/templates/app/api/auth/[...all]/route.ts +35 -0
  131. package/templates/app/api/health/route.ts +43 -23
  132. package/templates/app/api/internal/user-metadata/route.ts +10 -0
  133. package/templates/app/api/superadmin/subscriptions/route.ts +5 -0
  134. package/templates/app/api/superadmin/teams/[teamId]/route.ts +6 -0
  135. package/templates/app/api/v1/billing/cancel/route.ts +9 -11
  136. package/templates/app/api/v1/billing/change-plan/route.ts +3 -3
  137. package/templates/app/api/v1/billing/check-action/route.ts +7 -6
  138. package/templates/app/api/v1/billing/checkout/route.ts +40 -14
  139. package/templates/app/api/v1/billing/portal/route.ts +6 -6
  140. package/templates/app/api/v1/billing/presets.ts +1 -1
  141. package/templates/app/api/v1/billing/webhooks/polar/route.ts +83 -6
  142. package/templates/app/api/v1/billing/webhooks/stripe/route.ts +18 -421
  143. package/templates/app/dashboard/settings/billing/page.tsx +9 -4
  144. package/templates/app/dashboard/settings/plans/page.tsx +29 -7
  145. package/templates/app/layout.tsx +14 -5
  146. package/templates/app/superadmin/subscriptions/page.tsx +16 -14
  147. package/templates/app/superadmin/teams/[teamId]/page.tsx +18 -15
  148. package/templates/blocks/hero/component.tsx +6 -3
  149. package/templates/blocks/hero/schema.ts +2 -1
  150. package/templates/blocks/testimonials/component.tsx +2 -2
  151. package/templates/blocks/testimonials/schema.ts +2 -2
  152. package/templates/contents/themes/starter/tests/cypress/src/features/SuperadminPOM.ts +2 -2
  153. package/templates/features/pages/blocks/hero/component.tsx +6 -3
  154. package/templates/features/pages/blocks/hero/schema.ts +2 -1
  155. package/templates/lib/billing/polar-webhook-extensions.ts +23 -0
  156. package/templates/lib/billing/stripe-webhook-extensions.ts +23 -0
  157. package/tests/jest/__mocks__/@nextsparkjs/registries/billing-registry.ts +7 -8
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Hook to check if the current team can perform a billing action.
3
+ * Used to gate entity creation based on plan limits.
4
+ *
5
+ * @param action - The action to check (e.g., 'professionals.create')
6
+ * @param enabled - Whether to run the check (default: true)
7
+ *
8
+ * @example
9
+ * const { canCreate, isLoading, reason } = useQuotaCheck('professionals.create')
10
+ * if (!canCreate) showUpgradeBanner()
11
+ */
12
+ export declare function useQuotaCheck(action: string, enabled?: boolean): {
13
+ canCreate: boolean;
14
+ isLoading: boolean;
15
+ reason: string;
16
+ message: string;
17
+ meta: {
18
+ limitSlug?: string;
19
+ remaining?: number;
20
+ requiredFeature?: string;
21
+ currentPlan?: string;
22
+ };
23
+ isQuotaExceeded: boolean;
24
+ isFeatureBlocked: boolean;
25
+ };
26
+ //# sourceMappingURL=useQuotaCheck.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useQuotaCheck.d.ts","sourceRoot":"","sources":["../../src/hooks/useQuotaCheck.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,UAAO;;;;;;oBAlB5C,MAAM;oBACN,MAAM;0BACA,MAAM;sBACV,MAAM;;;;EAwCvB"}
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { useQuery } from "@tanstack/react-query";
3
+ import { fetchWithTeam } from "../lib/api/entities.js";
4
+ function useQuotaCheck(action, enabled = true) {
5
+ const { data, isLoading } = useQuery({
6
+ queryKey: ["quota-check", action],
7
+ queryFn: async () => {
8
+ const res = await fetchWithTeam("/api/v1/billing/check-action", {
9
+ method: "POST",
10
+ body: JSON.stringify({ action })
11
+ });
12
+ const json = await res.json();
13
+ return json.data || { allowed: true };
14
+ },
15
+ enabled,
16
+ staleTime: 3e4,
17
+ // Cache for 30s
18
+ retry: false
19
+ });
20
+ return {
21
+ canCreate: (data == null ? void 0 : data.allowed) ?? true,
22
+ // Default to true while loading
23
+ isLoading,
24
+ reason: data == null ? void 0 : data.reason,
25
+ message: data == null ? void 0 : data.message,
26
+ meta: data == null ? void 0 : data.meta,
27
+ isQuotaExceeded: (data == null ? void 0 : data.reason) === "quota_exceeded",
28
+ isFeatureBlocked: (data == null ? void 0 : data.reason) === "feature_not_in_plan"
29
+ };
30
+ }
31
+ export {
32
+ useQuotaCheck
33
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"generic-handler.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/entity/generic-handler.ts"],"names":[],"mappings":"AAAA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,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAqYvD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAwdnF;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAiVrF;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CA+KpJ;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAyStJ;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAkItJ;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAEtF"}
@@ -21,6 +21,9 @@ import { afterEntityCreate, afterEntityUpdate, afterEntityDelete } from "../../e
21
21
  import { extractPatternIds } from "../../blocks/pattern-resolver.js";
22
22
  import { isPatternReference } from "../../../types/pattern-reference.js";
23
23
  import { PatternUsageService } from "../../services/pattern-usage.service.js";
24
+ import { SubscriptionService } from "../../services/subscription.service.js";
25
+ import { UsageService } from "../../services/usage.service.js";
26
+ import { BILLING_REGISTRY } from "@nextsparkjs/registries/billing-registry";
24
27
  function filterPublicFields(data, entityConfig, userId) {
25
28
  var _a;
26
29
  const publicFields = (_a = entityConfig.access) == null ? void 0 : _a.publicFields;
@@ -531,7 +534,7 @@ async function handleGenericList(request) {
531
534
  }
532
535
  }
533
536
  async function handleGenericCreate(request) {
534
- var _a, _b, _c, _d, _e, _f, _g;
537
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
535
538
  try {
536
539
  const resolution = await resolveEntityFromUrl(request.nextUrl.pathname);
537
540
  if (!resolution.isValidEntity || !resolution.entityConfig) {
@@ -666,14 +669,45 @@ async function handleGenericCreate(request) {
666
669
  }
667
670
  }
668
671
  });
672
+ const createAction = `${entityConfig.slug}.create`;
673
+ const limitSlug = (_f = (_e = (_d = BILLING_REGISTRY) == null ? void 0 : _d.actionMappings) == null ? void 0 : _e.limits) == null ? void 0 : _f[createAction];
674
+ if (limitSlug) {
675
+ const actionResult = await SubscriptionService.canPerformAction(
676
+ authResult.user.id,
677
+ teamId,
678
+ createAction
679
+ );
680
+ if (!actionResult.allowed) {
681
+ const statusCode = actionResult.reason === "quota_exceeded" ? 429 : 403;
682
+ const response2 = createApiError(
683
+ actionResult.message || `Quota exceeded for ${entityConfig.slug}`,
684
+ statusCode,
685
+ void 0,
686
+ actionResult.reason === "quota_exceeded" ? "QUOTA_EXCEEDED" : "FEATURE_NOT_IN_PLAN"
687
+ );
688
+ return addCorsHeaders(response2, request);
689
+ }
690
+ }
669
691
  const insertQuery = `
670
692
  INSERT INTO "${tableName}" (${insertFields.join(", ")})
671
693
  VALUES (${placeholders.join(", ")}) RETURNING *
672
694
  `;
673
695
  const insertResult = await mutateWithRLS(insertQuery, values, authResult.user.id);
674
- const createdEntityId = String((_d = insertResult.rows[0]) == null ? void 0 : _d.id);
696
+ const createdEntityId = String((_g = insertResult.rows[0]) == null ? void 0 : _g.id);
697
+ if (limitSlug) {
698
+ UsageService.track({
699
+ teamId,
700
+ userId: authResult.user.id,
701
+ limitSlug,
702
+ delta: 1,
703
+ action: createAction,
704
+ resourceType: entityConfig.slug,
705
+ resourceId: createdEntityId
706
+ }).catch(() => {
707
+ });
708
+ }
675
709
  const systemFields = ["id", "userId", "teamId", "createdAt", "updatedAt"];
676
- if ((_e = entityConfig.builder) == null ? void 0 : _e.enabled) {
710
+ if ((_h = entityConfig.builder) == null ? void 0 : _h.enabled) {
677
711
  systemFields.push("blocks");
678
712
  }
679
713
  const configFields = entityConfig.fields.map((field) => {
@@ -692,7 +726,7 @@ async function handleGenericCreate(request) {
692
726
  `;
693
727
  const createdItems = await queryWithRLS(selectQuery, [createdEntityId], authResult.user.id);
694
728
  const createdItem = createdItems[0];
695
- if ((_f = entityConfig.taxonomies) == null ? void 0 : _f.enabled) {
729
+ if ((_i = entityConfig.taxonomies) == null ? void 0 : _i.enabled) {
696
730
  await processTaxonomyRelations(entityConfig, createdEntityId, body, authResult.user.id, false);
697
731
  }
698
732
  const metadataWasProvided = metas && typeof metas === "object" && Object.keys(metas).length > 0;
@@ -705,7 +739,7 @@ async function handleGenericCreate(request) {
705
739
  );
706
740
  }
707
741
  let responseItem = createdItem;
708
- if ((_g = entityConfig.taxonomies) == null ? void 0 : _g.enabled) {
742
+ if ((_j = entityConfig.taxonomies) == null ? void 0 : _j.enabled) {
709
743
  const itemsWithTaxonomies = await includeTaxonomiesInData(
710
744
  entityConfig,
711
745
  [createdItem],
@@ -1062,7 +1096,7 @@ async function handleGenericUpdate(request, { params }) {
1062
1096
  }
1063
1097
  }
1064
1098
  async function handleGenericDelete(request, { params }) {
1065
- var _a, _b;
1099
+ var _a, _b, _c, _d, _e;
1066
1100
  try {
1067
1101
  const { id } = await params;
1068
1102
  const resolution = await resolveEntityFromUrl(request.nextUrl.pathname);
@@ -1137,6 +1171,20 @@ async function handleGenericDelete(request, { params }) {
1137
1171
  } catch (hookError) {
1138
1172
  console.error(`[generic-handler] Error in afterEntityDelete hook for ${entityConfig.slug}:`, hookError);
1139
1173
  }
1174
+ const deleteAction = `${entityConfig.slug}.create`;
1175
+ const deleteLimitSlug = (_e = (_d = (_c = BILLING_REGISTRY) == null ? void 0 : _c.actionMappings) == null ? void 0 : _d.limits) == null ? void 0 : _e[deleteAction];
1176
+ if (deleteLimitSlug) {
1177
+ UsageService.track({
1178
+ teamId,
1179
+ userId: authResult.user.id,
1180
+ limitSlug: deleteLimitSlug,
1181
+ delta: -1,
1182
+ action: `${entityConfig.slug}.delete`,
1183
+ resourceType: entityConfig.slug,
1184
+ resourceId: id
1185
+ }).catch(() => {
1186
+ });
1187
+ }
1140
1188
  const response = createApiResponse({ success: true, id });
1141
1189
  return addCorsHeaders(response, request);
1142
1190
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../../src/lib/api/rate-limit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,MAAa,EACpB,QAAQ,GAAE,MAAc,GACvB,eAAe,CAyCjB;AAED;;;GAGG;AACH,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE,aAAqB,GAC1B,OAAO,CAAC,eAAe,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAsCpD;AA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B,mBAAmB,CACjC,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EAAE,GACf,YAAY,CASd;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,OAAO,EAAE,EAC/C,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC,IAEtD,SAAS,WAAW,EAAE,GAAG,MAAM,CAAC,KAAG,OAAO,CAAC,YAAY,CAAC,CAsCvE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;CACtB,GAAG,IAAI,CAaP;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGlD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,KAAK,CAAC;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CASD;AAED;;GAEG;AACH,wBAAgB,sBAAsB;;;;;EAErC;AAoGD,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAAE,EACnD,OAAO,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,YAAY,CAAC,EACpE,IAAI,GAAE,aAAqB,IAEb,SAAS,WAAW,EAAE,GAAG,MAAM,CAAC,KAAG,OAAO,CAAC,YAAY,CAAC,CAkCvE"}
@@ -46,7 +46,8 @@ async function checkDistributedRateLimit(identifier, type = "api") {
46
46
  api: 100,
47
47
  strict: 10,
48
48
  read: 200,
49
- write: 50
49
+ write: 50,
50
+ webhook: 500
50
51
  };
51
52
  return {
52
53
  allowed: result2.success,
@@ -65,8 +66,10 @@ async function checkDistributedRateLimit(identifier, type = "api") {
65
66
  // 10 requests per hour
66
67
  read: { limit: 200, windowMs: 60 * 1e3 },
67
68
  // 200 requests per minute
68
- write: { limit: 50, windowMs: 60 * 1e3 }
69
+ write: { limit: 50, windowMs: 60 * 1e3 },
69
70
  // 50 requests per minute
71
+ webhook: { limit: 500, windowMs: 60 * 60 * 1e3 }
72
+ // 500 requests per hour
70
73
  };
71
74
  const config = limits[type];
72
75
  const result = checkRateLimit(`${type}:${identifier}`, config.limit, config.windowMs);
@@ -200,15 +203,15 @@ function getRateLimitCacheStats() {
200
203
  return rateLimitCache.getStats();
201
204
  }
202
205
  function getClientIp(request) {
206
+ const cfIp = request.headers.get("cf-connecting-ip");
207
+ if (cfIp) return cfIp;
203
208
  const forwardedFor = request.headers.get("x-forwarded-for");
204
209
  if (forwardedFor) {
205
- const ips = forwardedFor.split(",").map((ip) => ip.trim());
206
- if (ips[0]) return ips[0];
210
+ const ips = forwardedFor.split(",").map((ip) => ip.trim()).filter(Boolean);
211
+ if (ips.length > 0) return ips[ips.length - 1];
207
212
  }
208
213
  const realIp = request.headers.get("x-real-ip");
209
214
  if (realIp) return realIp;
210
- const cfIp = request.headers.get("cf-connecting-ip");
211
- if (cfIp) return cfIp;
212
215
  const trueClientIp = request.headers.get("true-client-ip");
213
216
  if (trueClientIp) return trueClientIp;
214
217
  return "unknown";
@@ -37,10 +37,7 @@ export interface PlanDefinition {
37
37
  features: string[];
38
38
  /** Map of limitSlug -> value (-1 means unlimited) */
39
39
  limits: Record<string, number>;
40
- /** Stripe price IDs (P2: Stripe Integration) */
41
- stripePriceIdMonthly?: string | null;
42
- stripePriceIdYearly?: string | null;
43
- /** Generic price IDs for any payment provider (checked first, falls back to stripe-specific) */
40
+ /** Price IDs for the configured payment provider (monthly and yearly) */
44
41
  providerPriceIds?: {
45
42
  monthly?: string | null;
46
43
  yearly?: string | null;
@@ -64,7 +61,7 @@ export interface ActionMappings {
64
61
  limits: Record<string, string>;
65
62
  }
66
63
  export interface BillingConfig {
67
- /** Payment provider: stripe, paddle, lemonsqueezy */
64
+ /** Payment provider: stripe, polar */
68
65
  provider: PaymentProvider;
69
66
  /** Default currency (ISO 4217) */
70
67
  currency: string;
@@ -1 +1 @@
1
- {"version":3,"file":"config-types.d.ts","sourceRoot":"","sources":["../../../src/lib/billing/config-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAMxE,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;IACjC,sCAAsC;IACtC,WAAW,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAA;CACtD;AAMD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,QAAQ,CAAA;IACd,UAAU,CAAC,EAAE,cAAc,CAAA;IAC3B,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,gDAAgD;IAChD,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAA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AW,EAAE,MAAM,CAAA;IAEnB,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAE3C,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAEvC,uBAAuB;IACvB,KAAK,EAAE,cAAc,EAAE,CAAA;IAEvB,uCAAuC;IACvC,cAAc,EAAE,cAAc,CAAA;CAC/B"}
@@ -2,8 +2,7 @@
2
2
  * Billing Gateway Factory
3
3
  *
4
4
  * Returns the configured BillingGateway implementation based on the
5
- * provider setting in the billing registry. Uses lazy loading so that
6
- * provider SDKs (Stripe, Polar, etc.) are only imported when needed.
5
+ * provider setting in the billing registry.
7
6
  *
8
7
  * Usage:
9
8
  * import { getBillingGateway } from '@nextsparkjs/core/lib/billing/gateways/factory'
@@ -17,6 +16,18 @@ import type { BillingGateway } from './interface';
17
16
  * Provider is determined by BILLING_REGISTRY.config.provider (from billing.config.ts).
18
17
  */
19
18
  export declare function getBillingGateway(): BillingGateway;
19
+ /**
20
+ * Get resource hint domains for the configured billing provider.
21
+ * Use in <head> for performance optimization.
22
+ *
23
+ * @example
24
+ * // In layout.tsx:
25
+ * const { preconnect, dnsPrefetch } = getBillingResourceHints()
26
+ */
27
+ export declare function getBillingResourceHints(): {
28
+ preconnect: string[];
29
+ dnsPrefetch: string[];
30
+ };
20
31
  /**
21
32
  * Reset the cached gateway instance.
22
33
  * Useful for testing or when billing config changes at runtime.
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/lib/billing/gateways/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CA4BlD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/lib/billing/gateways/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAuBlD;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,IAAI;IAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAE,CAMzF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
@@ -1,22 +1,21 @@
1
1
  import { BILLING_REGISTRY } from "@nextsparkjs/registries/billing-registry";
2
+ import { StripeGateway } from "./stripe.js";
3
+ import { PolarGateway } from "./polar.js";
2
4
  let gatewayInstance = null;
3
5
  function getBillingGateway() {
4
6
  if (!gatewayInstance) {
5
7
  const provider = BILLING_REGISTRY.provider;
6
8
  switch (provider) {
7
- case "stripe": {
8
- const { StripeGateway } = require("./stripe");
9
+ case "stripe":
9
10
  gatewayInstance = new StripeGateway();
10
11
  break;
11
- }
12
- case "polar": {
13
- const { PolarGateway } = require("./polar");
12
+ case "polar":
14
13
  gatewayInstance = new PolarGateway();
15
14
  break;
16
- }
17
15
  // Future providers:
18
16
  // case 'paddle': { ... }
19
17
  // case 'lemonsqueezy': { ... }
18
+ // case 'mercadopago': { ... }
20
19
  default:
21
20
  throw new Error(
22
21
  `Unsupported billing provider: "${provider}". Supported providers: stripe, polar. Check your billing.config.ts provider setting.`
@@ -25,10 +24,18 @@ function getBillingGateway() {
25
24
  }
26
25
  return gatewayInstance;
27
26
  }
27
+ function getBillingResourceHints() {
28
+ try {
29
+ return getBillingGateway().getResourceHintDomains();
30
+ } catch {
31
+ return { preconnect: [], dnsPrefetch: [] };
32
+ }
33
+ }
28
34
  function resetBillingGateway() {
29
35
  gatewayInstance = null;
30
36
  }
31
37
  export {
32
38
  getBillingGateway,
39
+ getBillingResourceHints,
33
40
  resetBillingGateway
34
41
  };
@@ -5,9 +5,10 @@
5
5
  * Consumers interact with this interface via the factory (getBillingGateway()),
6
6
  * making provider switching a configuration change rather than a code change.
7
7
  */
8
- import type { CheckoutSessionResult, PortalSessionResult, SubscriptionResult, CustomerResult, WebhookEventResult, CreateCheckoutParams, CreatePortalParams, CreateCustomerParams, UpdateSubscriptionParams } from './types';
8
+ import type { CheckoutSessionResult, PortalSessionResult, SubscriptionResult, CustomerResult, WebhookEventResult, CreateCheckoutParams, CreatePortalParams, CreateCustomerParams, UpdateSubscriptionParams, CreateOneTimeCheckoutParams } from './types';
9
9
  export interface BillingGateway {
10
10
  createCheckoutSession(params: CreateCheckoutParams): Promise<CheckoutSessionResult>;
11
+ createOneTimeCheckout(params: CreateOneTimeCheckoutParams): Promise<CheckoutSessionResult>;
11
12
  createPortalSession(params: CreatePortalParams): Promise<PortalSessionResult>;
12
13
  getCustomer(customerId: string): Promise<CustomerResult>;
13
14
  createCustomer(params: CreateCustomerParams): Promise<CustomerResult>;
@@ -15,6 +16,23 @@ export interface BillingGateway {
15
16
  cancelSubscriptionAtPeriodEnd(subscriptionId: string): Promise<SubscriptionResult>;
16
17
  cancelSubscriptionImmediately(subscriptionId: string): Promise<SubscriptionResult>;
17
18
  reactivateSubscription(subscriptionId: string): Promise<SubscriptionResult>;
19
+ /** Get the human-readable provider name (e.g., "Stripe", "Polar") */
20
+ getProviderName(): string;
21
+ /**
22
+ * Get resource hint domains for the <head>.
23
+ * - preconnect: domains loaded immediately on page render (DNS + TCP + TLS)
24
+ * - dnsPrefetch: domains used later after user interaction (DNS only)
25
+ *
26
+ * Note: preconnect sockets expire after ~10s, so only use for resources
27
+ * loaded during initial render. Use dnsPrefetch for domains used after
28
+ * user interaction (e.g., API calls on form submit).
29
+ */
30
+ getResourceHintDomains(): {
31
+ preconnect: string[];
32
+ dnsPrefetch: string[];
33
+ };
34
+ /** Get the provider dashboard URL for a subscription (e.g., Stripe Dashboard, Polar Dashboard) */
35
+ getSubscriptionDashboardUrl(externalSubscriptionId: string | null | undefined): string | null;
18
36
  verifyWebhookSignature(payload: string | Buffer, signatureOrHeaders: string | Record<string, string>): WebhookEventResult;
19
37
  }
20
38
  //# sourceMappingURL=interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/lib/billing/gateways/interface.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,cAAc;IAE7B,qBAAqB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;IACnF,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;IAG7E,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IACxD,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAGrE,sBAAsB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACrF,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAClF,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAClF,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IAG3E,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,kBAAkB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BAAsB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAAA;IAG7F,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,kBAAkB,CAAA;CAC1H"}
@@ -23,13 +23,14 @@
23
23
  */
24
24
  import { Polar } from '@polar-sh/sdk';
25
25
  import type { BillingGateway } from './interface';
26
- import type { CheckoutSessionResult, PortalSessionResult, SubscriptionResult, CustomerResult, WebhookEventResult, CreateCheckoutParams, CreatePortalParams, CreateCustomerParams, UpdateSubscriptionParams } from './types';
26
+ import type { CheckoutSessionResult, PortalSessionResult, SubscriptionResult, CustomerResult, WebhookEventResult, CreateCheckoutParams, CreatePortalParams, CreateCustomerParams, UpdateSubscriptionParams, CreateOneTimeCheckoutParams } from './types';
27
27
  /**
28
28
  * Polar.sh implementation of the BillingGateway interface.
29
29
  * Maps Polar SDK types to provider-agnostic result types.
30
30
  */
31
31
  export declare class PolarGateway implements BillingGateway {
32
32
  createCheckoutSession(params: CreateCheckoutParams): Promise<CheckoutSessionResult>;
33
+ createOneTimeCheckout(params: CreateOneTimeCheckoutParams): Promise<CheckoutSessionResult>;
33
34
  createPortalSession(params: CreatePortalParams): Promise<PortalSessionResult>;
34
35
  verifyWebhookSignature(payload: string | Buffer, signatureOrHeaders: string | Record<string, string>): WebhookEventResult;
35
36
  getCustomer(customerId: string): Promise<CustomerResult>;
@@ -37,6 +38,12 @@ export declare class PolarGateway implements BillingGateway {
37
38
  updateSubscriptionPlan(params: UpdateSubscriptionParams): Promise<SubscriptionResult>;
38
39
  cancelSubscriptionAtPeriodEnd(subscriptionId: string): Promise<SubscriptionResult>;
39
40
  cancelSubscriptionImmediately(subscriptionId: string): Promise<SubscriptionResult>;
41
+ getProviderName(): string;
42
+ getResourceHintDomains(): {
43
+ preconnect: string[];
44
+ dnsPrefetch: string[];
45
+ };
46
+ getSubscriptionDashboardUrl(externalSubscriptionId: string | null | undefined): string | null;
40
47
  reactivateSubscription(subscriptionId: string): Promise<SubscriptionResult>;
41
48
  }
42
49
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"polar.d.ts","sourceRoot":"","sources":["../../../../src/lib/billing/gateways/polar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAKrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAiBhB;;;GAGG;AACH,qBAAa,YAAa,YAAW,cAAc;IAC3C,qBAAqB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA0BnF,mBAAmB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAcnF,sBAAsB,CACpB,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAClD,kBAAkB;IA4Bf,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAUxD,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC;IAsBrE,sBAAsB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkBrF,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAiBlF,6BAA6B,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAalF,sBAAsB,CAAC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,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAaxF,eAAe,IAAI,MAAM;IAIzB,sBAAsB,IAAI;QAAE,UAAU,EAAE,MAAM,EAAE,CAAC;QAAC,WAAW,EAAE,MAAM,EAAE,CAAA;KAAE;IAMzE,2BAA2B,CAAC,sBAAsB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI;IAOvF,sBAAsB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAelF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAExC"}
@@ -34,6 +34,21 @@ class PolarGateway {
34
34
  url: result.url ?? null
35
35
  };
36
36
  }
37
+ async createOneTimeCheckout(params) {
38
+ const { teamId, priceId, successUrl, cancelUrl, customerEmail, customerId, metadata } = params;
39
+ const checkoutParams = {
40
+ products: [priceId],
41
+ successUrl,
42
+ metadata: { teamId, ...metadata },
43
+ allowTrial: false,
44
+ // one-time purchases should never start a trial
45
+ ...cancelUrl && { returnUrl: cancelUrl },
46
+ ...customerEmail && { customerEmail },
47
+ ...customerId && { customerId }
48
+ };
49
+ const result = await getPolar().checkouts.create(checkoutParams);
50
+ return { id: result.id, url: result.url ?? null };
51
+ }
37
52
  async createPortalSession(params) {
38
53
  const { customerId, returnUrl } = params;
39
54
  const result = await getPolar().customerSessions.create({
@@ -127,6 +142,16 @@ class PolarGateway {
127
142
  cancelAtPeriodEnd: false
128
143
  };
129
144
  }
145
+ getProviderName() {
146
+ return "Polar";
147
+ }
148
+ getResourceHintDomains() {
149
+ return { preconnect: [], dnsPrefetch: [] };
150
+ }
151
+ getSubscriptionDashboardUrl(externalSubscriptionId) {
152
+ if (!externalSubscriptionId) return null;
153
+ return "https://polar.sh/dashboard/sales/subscriptions";
154
+ }
130
155
  async reactivateSubscription(subscriptionId) {
131
156
  const result = await getPolar().subscriptions.update({
132
157
  id: subscriptionId,
@@ -6,16 +6,15 @@
6
6
  *
7
7
  * P2: Stripe Integration
8
8
  */
9
- import Stripe from 'stripe';
10
9
  import type { BillingGateway } from './interface';
11
- import type { CheckoutSessionResult, PortalSessionResult, SubscriptionResult, CustomerResult, WebhookEventResult, CreateCheckoutParams, CreatePortalParams, CreateCustomerParams, UpdateSubscriptionParams } from './types';
12
- export type { CreateCheckoutParams, CreatePortalParams, UpdateSubscriptionParams } from './types';
10
+ import type { CheckoutSessionResult, PortalSessionResult, SubscriptionResult, CustomerResult, WebhookEventResult, CreateCheckoutParams, CreatePortalParams, CreateCustomerParams, UpdateSubscriptionParams, CreateOneTimeCheckoutParams } from './types';
13
11
  /**
14
12
  * Stripe implementation of the BillingGateway interface.
15
13
  * Maps Stripe SDK types to provider-agnostic result types.
16
14
  */
17
15
  export declare class StripeGateway implements BillingGateway {
18
16
  createCheckoutSession(params: CreateCheckoutParams): Promise<CheckoutSessionResult>;
17
+ createOneTimeCheckout(params: CreateOneTimeCheckoutParams): Promise<CheckoutSessionResult>;
19
18
  createPortalSession(params: CreatePortalParams): Promise<PortalSessionResult>;
20
19
  verifyWebhookSignature(payload: string | Buffer, signatureOrHeaders: string | Record<string, string>): WebhookEventResult;
21
20
  getCustomer(customerId: string): Promise<CustomerResult>;
@@ -23,29 +22,12 @@ export declare class StripeGateway implements BillingGateway {
23
22
  updateSubscriptionPlan(params: UpdateSubscriptionParams): Promise<SubscriptionResult>;
24
23
  cancelSubscriptionAtPeriodEnd(subscriptionId: string): Promise<SubscriptionResult>;
25
24
  cancelSubscriptionImmediately(subscriptionId: string): Promise<SubscriptionResult>;
25
+ getProviderName(): string;
26
+ getResourceHintDomains(): {
27
+ preconnect: string[];
28
+ dnsPrefetch: string[];
29
+ };
30
+ getSubscriptionDashboardUrl(externalSubscriptionId: string | null | undefined): string | null;
26
31
  reactivateSubscription(subscriptionId: string): Promise<SubscriptionResult>;
27
32
  }
28
- /**
29
- * Get raw Stripe instance for advanced usage (webhook handlers that need Stripe.Event types).
30
- * Prefer using getBillingGateway() for all other operations.
31
- */
32
- export declare function getStripeInstance(): Stripe;
33
- /** @deprecated Use getBillingGateway().createCheckoutSession() instead */
34
- export declare function createCheckoutSession(params: CreateCheckoutParams): Promise<CheckoutSessionResult>;
35
- /** @deprecated Use getBillingGateway().createPortalSession() instead */
36
- export declare function createPortalSession(params: CreatePortalParams): Promise<PortalSessionResult>;
37
- /** @deprecated Use getBillingGateway().verifyWebhookSignature() instead */
38
- export declare function verifyWebhookSignature(payload: string | Buffer, signatureOrHeaders: string | Record<string, string>): WebhookEventResult;
39
- /** @deprecated Use getBillingGateway().getCustomer() instead */
40
- export declare function getCustomer(customerId: string): Promise<CustomerResult>;
41
- /** @deprecated Use getBillingGateway().createCustomer() instead */
42
- export declare function createCustomer(params: CreateCustomerParams): Promise<CustomerResult>;
43
- /** @deprecated Use getBillingGateway().cancelSubscriptionAtPeriodEnd() instead */
44
- export declare function cancelSubscriptionAtPeriodEnd(subscriptionId: string): Promise<SubscriptionResult>;
45
- /** @deprecated Use getBillingGateway().cancelSubscriptionImmediately() instead */
46
- export declare function cancelSubscriptionImmediately(subscriptionId: string): Promise<SubscriptionResult>;
47
- /** @deprecated Use getBillingGateway().reactivateSubscription() instead */
48
- export declare function reactivateSubscription(subscriptionId: string): Promise<SubscriptionResult>;
49
- /** @deprecated Use getBillingGateway().updateSubscriptionPlan() instead */
50
- export declare function updateSubscriptionPlan(params: UpdateSubscriptionParams): Promise<SubscriptionResult>;
51
33
  //# sourceMappingURL=stripe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../../../src/lib/billing/gateways/stripe.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,kBAA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