@nextsparkjs/core 0.1.0-beta.126 → 0.1.0-beta.128

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 (103) hide show
  1. package/dist/components/billing/ManageBillingButton.d.ts +3 -3
  2. package/dist/components/dashboard/block-editor/config-panel.d.ts.map +1 -1
  3. package/dist/components/dashboard/block-editor/config-panel.js +11 -1
  4. package/dist/components/dashboard/block-editor/entity-fields-sidebar.d.ts.map +1 -1
  5. package/dist/components/dashboard/block-editor/entity-fields-sidebar.js +11 -1
  6. package/dist/components/entities/EntityFieldRenderer.d.ts.map +1 -1
  7. package/dist/components/entities/EntityFieldRenderer.js +3 -1
  8. package/dist/components/ui/simple-relation-select.d.ts +5 -1
  9. package/dist/components/ui/simple-relation-select.d.ts.map +1 -1
  10. package/dist/components/ui/simple-relation-select.js +10 -3
  11. package/dist/lib/api/rate-limit.d.ts.map +1 -1
  12. package/dist/lib/api/rate-limit.js +9 -6
  13. package/dist/lib/billing/config-types.d.ts +2 -5
  14. package/dist/lib/billing/config-types.d.ts.map +1 -1
  15. package/dist/lib/billing/gateways/factory.d.ts +13 -2
  16. package/dist/lib/billing/gateways/factory.d.ts.map +1 -1
  17. package/dist/lib/billing/gateways/factory.js +13 -6
  18. package/dist/lib/billing/gateways/interface.d.ts +19 -1
  19. package/dist/lib/billing/gateways/interface.d.ts.map +1 -1
  20. package/dist/lib/billing/gateways/polar.d.ts +8 -1
  21. package/dist/lib/billing/gateways/polar.d.ts.map +1 -1
  22. package/dist/lib/billing/gateways/polar.js +25 -0
  23. package/dist/lib/billing/gateways/stripe.d.ts +8 -26
  24. package/dist/lib/billing/gateways/stripe.d.ts.map +1 -1
  25. package/dist/lib/billing/gateways/stripe.js +41 -44
  26. package/dist/lib/billing/gateways/types.d.ts +11 -0
  27. package/dist/lib/billing/gateways/types.d.ts.map +1 -1
  28. package/dist/lib/billing/jobs.d.ts +1 -1
  29. package/dist/lib/billing/polar-webhook.d.ts +38 -0
  30. package/dist/lib/billing/polar-webhook.d.ts.map +1 -0
  31. package/dist/lib/billing/polar-webhook.js +0 -0
  32. package/dist/lib/billing/schema.d.ts +1 -2
  33. package/dist/lib/billing/schema.d.ts.map +1 -1
  34. package/dist/lib/billing/schema.js +1 -1
  35. package/dist/lib/billing/stripe-webhook.d.ts +48 -0
  36. package/dist/lib/billing/stripe-webhook.d.ts.map +1 -0
  37. package/dist/lib/billing/stripe-webhook.js +316 -0
  38. package/dist/lib/billing/types.d.ts +6 -2
  39. package/dist/lib/billing/types.d.ts.map +1 -1
  40. package/dist/lib/entities/types.d.ts +11 -0
  41. package/dist/lib/entities/types.d.ts.map +1 -1
  42. package/dist/lib/rate-limit-redis.d.ts +2 -2
  43. package/dist/lib/rate-limit-redis.d.ts.map +1 -1
  44. package/dist/lib/rate-limit-redis.js +22 -4
  45. package/dist/lib/selectors/core-selectors.d.ts +2 -2
  46. package/dist/lib/selectors/domains/superadmin.selectors.d.ts +2 -2
  47. package/dist/lib/selectors/domains/superadmin.selectors.js +2 -2
  48. package/dist/lib/selectors/selectors.d.ts +4 -4
  49. package/dist/lib/services/invoice.service.d.ts +3 -3
  50. package/dist/lib/services/invoice.service.js +2 -2
  51. package/dist/lib/services/membership.service.d.ts.map +1 -1
  52. package/dist/lib/services/membership.service.js +29 -0
  53. package/dist/lib/services/plan.service.d.ts +0 -3
  54. package/dist/lib/services/plan.service.d.ts.map +1 -1
  55. package/dist/lib/services/plan.service.js +3 -9
  56. package/dist/lib/services/subscription.service.d.ts +5 -5
  57. package/dist/lib/services/subscription.service.d.ts.map +1 -1
  58. package/dist/lib/services/subscription.service.js +54 -41
  59. package/dist/migrations/001_better_auth_and_functions.sql +5 -11
  60. package/dist/migrations/008_team_members_table.sql +27 -23
  61. package/dist/styles/classes.json +1 -1
  62. package/dist/templates/app/api/auth/[...all]/route.ts +35 -0
  63. package/dist/templates/app/api/health/route.ts +43 -23
  64. package/dist/templates/app/api/internal/user-metadata/route.ts +10 -0
  65. package/dist/templates/app/api/superadmin/subscriptions/route.ts +5 -0
  66. package/dist/templates/app/api/superadmin/teams/[teamId]/route.ts +6 -0
  67. package/dist/templates/app/api/v1/billing/cancel/route.ts +8 -10
  68. package/dist/templates/app/api/v1/billing/change-plan/route.ts +2 -2
  69. package/dist/templates/app/api/v1/billing/checkout/route.ts +6 -8
  70. package/dist/templates/app/api/v1/billing/portal/route.ts +5 -5
  71. package/dist/templates/app/api/v1/billing/presets.ts +1 -1
  72. package/dist/templates/app/api/v1/billing/webhooks/polar/route.ts +83 -6
  73. package/dist/templates/app/api/v1/billing/webhooks/stripe/route.ts +18 -421
  74. package/dist/templates/app/layout.tsx +14 -5
  75. package/dist/templates/app/superadmin/subscriptions/page.tsx +16 -14
  76. package/dist/templates/app/superadmin/teams/[teamId]/page.tsx +18 -15
  77. package/dist/templates/contents/themes/starter/tests/cypress/src/features/SuperadminPOM.ts +2 -2
  78. package/dist/templates/lib/billing/polar-webhook-extensions.ts +23 -0
  79. package/dist/templates/lib/billing/stripe-webhook-extensions.ts +23 -0
  80. package/migrations/001_better_auth_and_functions.sql +5 -11
  81. package/migrations/008_team_members_table.sql +27 -23
  82. package/package.json +10 -2
  83. package/scripts/build/registry/generators/billing-registry.mjs +1 -2
  84. package/scripts/build/registry/generators/entity-registry.mjs +2 -1
  85. package/templates/app/api/auth/[...all]/route.ts +35 -0
  86. package/templates/app/api/health/route.ts +43 -23
  87. package/templates/app/api/internal/user-metadata/route.ts +10 -0
  88. package/templates/app/api/superadmin/subscriptions/route.ts +5 -0
  89. package/templates/app/api/superadmin/teams/[teamId]/route.ts +6 -0
  90. package/templates/app/api/v1/billing/cancel/route.ts +8 -10
  91. package/templates/app/api/v1/billing/change-plan/route.ts +2 -2
  92. package/templates/app/api/v1/billing/checkout/route.ts +6 -8
  93. package/templates/app/api/v1/billing/portal/route.ts +5 -5
  94. package/templates/app/api/v1/billing/presets.ts +1 -1
  95. package/templates/app/api/v1/billing/webhooks/polar/route.ts +83 -6
  96. package/templates/app/api/v1/billing/webhooks/stripe/route.ts +18 -421
  97. package/templates/app/layout.tsx +14 -5
  98. package/templates/app/superadmin/subscriptions/page.tsx +16 -14
  99. package/templates/app/superadmin/teams/[teamId]/page.tsx +18 -15
  100. package/templates/contents/themes/starter/tests/cypress/src/features/SuperadminPOM.ts +2 -2
  101. package/templates/lib/billing/polar-webhook-extensions.ts +23 -0
  102. package/templates/lib/billing/stripe-webhook-extensions.ts +23 -0
  103. package/tests/jest/__mocks__/@nextsparkjs/registries/billing-registry.ts +7 -8
@@ -2,10 +2,10 @@ interface ManageBillingButtonProps {
2
2
  className?: string;
3
3
  }
4
4
  /**
5
- * ManageBillingButton - Redirect to Stripe Customer Portal
5
+ * ManageBillingButton - Redirect to Billing Management Portal
6
6
  *
7
- * Button that opens Stripe's hosted billing portal for subscription management.
8
- * Only visible for subscriptions with an external Stripe customer ID.
7
+ * Button that opens the payment provider's hosted billing portal for subscription management.
8
+ * Only visible for subscriptions with an external customer ID.
9
9
  *
10
10
  * Features:
11
11
  * - Update payment method
@@ -1 +1 @@
1
- {"version":3,"file":"config-panel.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/block-editor/config-panel.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAA;AACxF,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,uBAAuB,CAAA;AAiB1E,UAAU,gBAAgB;IACxB,YAAY,EAAE,kBAAkB,CAAA;IAChC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5D,YAAY,EAAE,YAAY,CAAA;IAC1B,oBAAoB,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAA;CACvD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAC1B,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACrB,EAAE,gBAAgB,2CA6dlB"}
1
+ {"version":3,"file":"config-panel.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/block-editor/config-panel.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAA;AACxF,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,uBAAuB,CAAA;AAiB1E,UAAU,gBAAgB;IACxB,YAAY,EAAE,kBAAkB,CAAA;IAChC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5D,YAAY,EAAE,YAAY,CAAA;IAC1B,oBAAoB,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAA;CACvD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAC1B,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACrB,EAAE,gBAAgB,2CA2elB"}
@@ -74,6 +74,14 @@ function ConfigPanel({
74
74
  const value = entityFields[fieldName];
75
75
  const sidebarFieldsConfig = (_a2 = entityConfig.builder) == null ? void 0 : _a2.sidebarFieldsConfig;
76
76
  const fieldConfig = sidebarFieldsConfig == null ? void 0 : sidebarFieldsConfig.find((f) => f.name === fieldName);
77
+ if (fieldConfig == null ? void 0 : fieldConfig.conditionalOn) {
78
+ const { field: depField, value: depValue } = fieldConfig.conditionalOn;
79
+ const currentDepValue = entityFields[depField];
80
+ const allowedValues = Array.isArray(depValue) ? depValue : [depValue];
81
+ if (!currentDepValue || !allowedValues.includes(currentDepValue)) {
82
+ return null;
83
+ }
84
+ }
77
85
  const fieldLabel = (fieldConfig == null ? void 0 : fieldConfig.label) || fieldName.charAt(0).toUpperCase() + fieldName.slice(1).replace(/([A-Z])/g, " $1");
78
86
  if ((fieldConfig == null ? void 0 : fieldConfig.type) === "relation" && fieldConfig.relation) {
79
87
  return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
@@ -86,7 +94,9 @@ function ConfigPanel({
86
94
  value: value || void 0,
87
95
  onChange: (v) => onEntityFieldChange(fieldName, v ?? null),
88
96
  userFiltered: fieldConfig.relation.userFiltered,
89
- placeholder: "Select..."
97
+ placeholder: "Select...",
98
+ limit: fieldConfig.relation.limit,
99
+ filter: fieldConfig.relation.filter
90
100
  }
91
101
  )
92
102
  ] }, fieldName);
@@ -1 +1 @@
1
- {"version":3,"file":"entity-fields-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/block-editor/entity-fields-sidebar.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAA;AAiBxF,UAAU,wBAAwB;IAChC,YAAY,EAAE,kBAAkB,CAAA;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACjD,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;CAChD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,kBAAuB,EACvB,gBAAgB,EACjB,EAAE,wBAAwB,2CAoR1B"}
1
+ {"version":3,"file":"entity-fields-sidebar.d.ts","sourceRoot":"","sources":["../../../../src/components/dashboard/block-editor/entity-fields-sidebar.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAA;AAiBxF,UAAU,wBAAwB;IAChC,YAAY,EAAE,kBAAkB,CAAA;IAChC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACjD,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;CAChD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,kBAAuB,EACvB,gBAAgB,EACjB,EAAE,wBAAwB,2CAiS1B"}
@@ -47,6 +47,14 @@ function EntityFieldsSidebar({
47
47
  const value = fields[fieldName];
48
48
  const sidebarFieldsConfig = (_a2 = entityConfig.builder) == null ? void 0 : _a2.sidebarFieldsConfig;
49
49
  const fieldConfig = sidebarFieldsConfig == null ? void 0 : sidebarFieldsConfig.find((f) => f.name === fieldName);
50
+ if (fieldConfig == null ? void 0 : fieldConfig.conditionalOn) {
51
+ const { field: depField, value: depValue } = fieldConfig.conditionalOn;
52
+ const currentDepValue = fields[depField];
53
+ const allowedValues = Array.isArray(depValue) ? depValue : [depValue];
54
+ if (!currentDepValue || !allowedValues.includes(currentDepValue)) {
55
+ return null;
56
+ }
57
+ }
50
58
  const fieldLabel = (fieldConfig == null ? void 0 : fieldConfig.label) || fieldName.charAt(0).toUpperCase() + fieldName.slice(1).replace(/([A-Z])/g, " $1");
51
59
  if ((fieldConfig == null ? void 0 : fieldConfig.type) === "relation" && fieldConfig.relation) {
52
60
  return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
@@ -59,7 +67,9 @@ function EntityFieldsSidebar({
59
67
  value: value || void 0,
60
68
  onChange: (v) => onChange(fieldName, v ?? null),
61
69
  userFiltered: fieldConfig.relation.userFiltered,
62
- placeholder: "Select..."
70
+ placeholder: "Select...",
71
+ limit: fieldConfig.relation.limit,
72
+ filter: fieldConfig.relation.filter
63
73
  }
64
74
  )
65
75
  ] }, fieldName);
@@ -1 +1 @@
1
- {"version":3,"file":"EntityFieldRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/entities/EntityFieldRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AA6CH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAG3D,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,CAAA;CACF;AA8zBD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,QAAgB,EAChB,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,GACR,EAAE,wBAAwB,2CAyC1B"}
1
+ {"version":3,"file":"EntityFieldRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/entities/EntityFieldRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AA6CH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAG3D,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACnC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,CAAA;CACF;AAg0BD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,QAAgB,EAChB,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,GACR,EAAE,wBAAwB,2CAyC1B"}
@@ -496,7 +496,9 @@ function renderFormField(field, value, onChange, error, disabled, required, test
496
496
  placeholder: dependsOnParent && !parentValue ? `Selecciona ${parentFieldName == null ? void 0 : parentFieldName.replace("Id", "").toLowerCase()} primero` : field.display.placeholder || `Seleccionar ${((_c = field.display.label) == null ? void 0 : _c.toLowerCase()) || relationEntityType}...`,
497
497
  parentId: parentIdForRelation,
498
498
  userFiltered: relationConfig.userFiltered,
499
- teamId: context == null ? void 0 : context.teamId
499
+ teamId: context == null ? void 0 : context.teamId,
500
+ limit: relationConfig.limit,
501
+ filter: relationConfig.filter
500
502
  }
501
503
  );
502
504
  // Property-based relationship types
@@ -25,6 +25,10 @@ export interface SimpleRelationSelectProps {
25
25
  }>;
26
26
  userFiltered?: boolean;
27
27
  teamId?: string;
28
+ /** Max items to load in dropdown (default: 20). Set higher for entities with many records. */
29
+ limit?: number;
30
+ /** Query filter params appended to the API call (e.g., { type: 'generic' }) */
31
+ filter?: Record<string, string>;
28
32
  }
29
- export declare function SimpleRelationSelect({ value, onChange, entityType, titleField, multiple, placeholder, disabled, parentId, propField, usePropertyMode, propertyOptions, userFiltered, teamId, }: SimpleRelationSelectProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare function SimpleRelationSelect({ value, onChange, entityType, titleField, multiple, placeholder, disabled, parentId, propField, usePropertyMode, propertyOptions, userFiltered, teamId, limit, filter, }: SimpleRelationSelectProps): import("react/jsx-runtime").JSX.Element;
30
34
  //# sourceMappingURL=simple-relation-select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"simple-relation-select.d.ts","sourceRoot":"","sources":["../../../src/components/ui/simple-relation-select.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,KAAK,IAAI,CAAA;IACnD,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,eAAe,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAEzD,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACV,QAAgB,EAChB,WAA8B,EAC9B,QAAgB,EAChB,QAAQ,EACR,SAAS,EACT,eAAuB,EACvB,eAAoB,EACpB,YAAoB,EACpB,MAAM,GACP,EAAE,yBAAyB,2CAklB3B"}
1
+ {"version":3,"file":"simple-relation-select.d.ts","sourceRoot":"","sources":["../../../src/components/ui/simple-relation-select.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,KAAK,IAAI,CAAA;IACnD,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,eAAe,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAEzD,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACV,QAAgB,EAChB,WAA8B,EAC9B,QAAgB,EAChB,QAAQ,EACR,SAAS,EACT,eAAuB,EACvB,eAAoB,EACpB,YAAoB,EACpB,MAAM,EACN,KAAU,EACV,MAAM,GACP,EAAE,yBAAyB,2CAulB3B"}
@@ -32,7 +32,9 @@ function SimpleRelationSelect({
32
32
  usePropertyMode = false,
33
33
  propertyOptions = [],
34
34
  userFiltered = false,
35
- teamId
35
+ teamId,
36
+ limit = 20,
37
+ filter
36
38
  }) {
37
39
  const [open, setOpen] = React.useState(false);
38
40
  const [options, setOptions] = React.useState([]);
@@ -109,13 +111,18 @@ function SimpleRelationSelect({
109
111
  const hasSpecificAPI = apiPath !== null;
110
112
  if (hasSpecificAPI) {
111
113
  url = new URL(`/api/v1/${apiPath}`, window.location.origin);
112
- url.searchParams.set("limit", "20");
114
+ url.searchParams.set("limit", String(limit));
113
115
  if (parentId) {
114
116
  url.searchParams.set("parentId", parentId);
115
117
  }
116
118
  if (userFiltered) {
117
119
  url.searchParams.set("userFiltered", "true");
118
120
  }
121
+ if (filter) {
122
+ for (const [key, val] of Object.entries(filter)) {
123
+ url.searchParams.set(key, val);
124
+ }
125
+ }
119
126
  } else {
120
127
  console.warn(`No specific API available for entity type: ${entityType}`);
121
128
  return [];
@@ -145,7 +152,7 @@ function SimpleRelationSelect({
145
152
  } finally {
146
153
  setLoading(false);
147
154
  }
148
- }, [entityType, parentId, titleField, propField, usePropertyMode, userFiltered, loading, teamId]);
155
+ }, [entityType, parentId, titleField, propField, usePropertyMode, userFiltered, loading, teamId, limit, filter]);
149
156
  React.useEffect(() => {
150
157
  const childInfo = parseChildEntity(entityType);
151
158
  if (childInfo.isChild && parentId && options.length === 0 && !loading) {
@@ -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;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,eAAe,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CAwB5G;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,IAAI,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EAAE,GACf,YAAY,GAAG,IAAI,CAkCrB;A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AAO,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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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,EAC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SessionResult, 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,EAA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AAO,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,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAGhB,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAkBjG;;;GAGG;AACH,qBAAa,aAAc,YAAW,cAAc;IAC5C,qBAAqB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA6CnF,mBAAmB,CAAC,MAAM,EAA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