@stacksjs/payments 0.75.105 → 0.75.107
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/dist/index.d.ts +7 -2
- package/dist/index.js +1 -1
- package/dist/subscription-state.d.ts +8 -0
- package/dist/subscription-state.js +1 -0
- package/dist/tsconfig.json +5 -0
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type StripeSdk from 'stripe';
|
|
2
1
|
// Type-only re-export of the Stripe SDK namespace (`Stripe.Customer`, etc.).
|
|
3
2
|
// `stripe` is an opt-in dependency, so this must not emit a runtime import —
|
|
4
3
|
// use the lazy `stripe` client from `./drivers/stripe` for actual SDK calls.
|
|
5
|
-
export type {
|
|
4
|
+
export type { default as Stripe } from 'stripe';
|
|
5
|
+
/**
|
|
6
|
+
* Payments Package
|
|
7
|
+
*
|
|
8
|
+
* Provides payment processing capabilities with Stripe integration.
|
|
9
|
+
*/
|
|
6
10
|
// Main Payment facade
|
|
7
11
|
export * from './payment';
|
|
8
12
|
export { default as Payment } from './payment';
|
|
@@ -19,3 +23,4 @@ export * from './drivers/stripe';
|
|
|
19
23
|
// Idempotency-key helpers — passed to every Stripe create/update so
|
|
20
24
|
// retries don't produce duplicate objects (stacksjs/stacks#1876 X-1).
|
|
21
25
|
export { freshIdempotencyKey, stacksIdempotencyKey } from './idempotency';
|
|
26
|
+
export { subscriptionGrantsAccess, subscriptionPeriod } from './subscription-state';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./payment";export{default as Payment}from"./payment";export*from"./driver";export*from"./billable";export*from"./connect";export*from"./drivers/stripe";export{freshIdempotencyKey,stacksIdempotencyKey}from"./idempotency";
|
|
1
|
+
export*from"./payment";export{default as Payment}from"./payment";export*from"./driver";export*from"./billable";export*from"./connect";export*from"./drivers/stripe";export{freshIdempotencyKey,stacksIdempotencyKey}from"./idempotency";export{subscriptionGrantsAccess,subscriptionPeriod}from"./subscription-state";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Provider subscription state determines access; successful API creation alone does not. */
|
|
2
|
+
export declare function subscriptionGrantsAccess(status: string | null | undefined): boolean;
|
|
3
|
+
/** Read both legacy subscription periods and item periods used by newer Stripe APIs. */
|
|
4
|
+
export declare function subscriptionPeriod(subscription: {
|
|
5
|
+
current_period_start?: number
|
|
6
|
+
current_period_end?: number
|
|
7
|
+
items?: { data?: Array<{ current_period_start?: number, current_period_end?: number }> }
|
|
8
|
+
}): { start: string | null, end: string | null };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function subscriptionGrantsAccess(status){return status==="active"||status==="trialing"}export function subscriptionPeriod(subscription){const item=subscription.items?.data?.[0],iso=(value)=>value&&Number.isFinite(value)&&value>0?new Date(value*1000).toISOString():null;return{start:iso(subscription.current_period_start??item?.current_period_start),end:iso(subscription.current_period_end??item?.current_period_end)}}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/payments",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.107",
|
|
6
6
|
"description": "The Stacks payments package. Currently supporting Stripe.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -60,12 +60,12 @@
|
|
|
60
60
|
"prepublishOnly": "bun run build"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@stacksjs/config": "0.75.
|
|
64
|
-
"@stacksjs/database": "0.75.
|
|
65
|
-
"@stacksjs/error-handling": "0.75.
|
|
66
|
-
"@stacksjs/logging": "0.75.
|
|
67
|
-
"@stacksjs/orm": "0.75.
|
|
68
|
-
"@stacksjs/types": "0.75.
|
|
63
|
+
"@stacksjs/config": "0.75.107",
|
|
64
|
+
"@stacksjs/database": "0.75.107",
|
|
65
|
+
"@stacksjs/error-handling": "0.75.107",
|
|
66
|
+
"@stacksjs/logging": "0.75.107",
|
|
67
|
+
"@stacksjs/orm": "0.75.107",
|
|
68
|
+
"@stacksjs/types": "0.75.107"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@stripe/stripe-js": "^10.0.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@stacksjs/utils": "0.75.
|
|
83
|
+
"@stacksjs/utils": "0.75.107",
|
|
84
84
|
"@stripe/stripe-js": "^10.0.0",
|
|
85
85
|
"better-dx": "^0.2.24",
|
|
86
86
|
"stripe": "23.0.0"
|