@lunora/payment 1.0.0-alpha.26 → 1.0.0-alpha.28
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.mts +203 -203
- package/dist/index.d.ts +203 -203
- package/dist/packem_shared/{adapter.d-BOheUepr.d.mts → adapter.d-CMjjkTGB.d.mts} +155 -155
- package/dist/packem_shared/{adapter.d-BOheUepr.d.ts → adapter.d-CMjjkTGB.d.ts} +155 -155
- package/dist/providers/autumn-features.d.mts +37 -37
- package/dist/providers/autumn-features.d.ts +37 -37
- package/dist/providers/autumn.d.mts +12 -12
- package/dist/providers/autumn.d.ts +12 -12
- package/dist/providers/creem.d.mts +12 -12
- package/dist/providers/creem.d.ts +12 -12
- package/dist/providers/creem.mjs +34 -3
- package/dist/providers/dodopayments.d.mts +12 -12
- package/dist/providers/dodopayments.d.ts +12 -12
- package/dist/providers/polar.d.mts +12 -12
- package/dist/providers/polar.d.ts +12 -12
- package/dist/providers/stripe.d.mts +12 -12
- package/dist/providers/stripe.d.ts +12 -12
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A per-seat / per-workspace sub-customer with its own feature balances.
|
|
3
|
-
* @experimental
|
|
4
|
-
*/
|
|
2
|
+
* A per-seat / per-workspace sub-customer with its own feature balances.
|
|
3
|
+
* @experimental
|
|
4
|
+
*/
|
|
5
5
|
interface AutumnEntity {
|
|
6
6
|
readonly featureId?: string;
|
|
7
7
|
readonly id: string;
|
|
@@ -10,9 +10,9 @@ interface AutumnEntity {
|
|
|
10
10
|
readonly raw: Record<string, unknown>;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* `CreateEntityInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
14
|
-
* @experimental
|
|
15
|
-
*/
|
|
13
|
+
* `CreateEntityInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
14
|
+
* @experimental
|
|
15
|
+
*/
|
|
16
16
|
interface CreateEntityInput {
|
|
17
17
|
/** The feature the entity consumes a seat/allowance of (e.g. `"seats"`). */
|
|
18
18
|
readonly featureId: string;
|
|
@@ -21,49 +21,49 @@ interface CreateEntityInput {
|
|
|
21
21
|
readonly name?: string;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* One point in a usage-events aggregation.
|
|
25
|
-
* @experimental
|
|
26
|
-
*/
|
|
24
|
+
* One point in a usage-events aggregation.
|
|
25
|
+
* @experimental
|
|
26
|
+
*/
|
|
27
27
|
interface UsageEventPoint {
|
|
28
28
|
readonly count: number;
|
|
29
29
|
readonly period?: string;
|
|
30
30
|
readonly raw: Record<string, unknown>;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* `EventsListInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
34
|
-
* @experimental
|
|
35
|
-
*/
|
|
33
|
+
* `EventsListInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
34
|
+
* @experimental
|
|
35
|
+
*/
|
|
36
36
|
interface EventsListInput {
|
|
37
37
|
/** Feature(s) to report on. */
|
|
38
38
|
readonly featureId: ReadonlyArray<string> | string;
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
|
-
* `EventsAggregateInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
42
|
-
* @experimental
|
|
43
|
-
*/
|
|
41
|
+
* `EventsAggregateInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
42
|
+
* @experimental
|
|
43
|
+
*/
|
|
44
44
|
interface EventsAggregateInput extends EventsListInput {
|
|
45
45
|
/** Time window to aggregate over (aggregate only — `list` ignores it, so it isn't accepted there). */
|
|
46
46
|
readonly range?: "7d" | "24h" | "30d" | "90d" | "last_cycle";
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* A prepaid feature quantity purchased at checkout (e.g. buy 5 seats up front).
|
|
50
|
-
* @experimental
|
|
51
|
-
*/
|
|
49
|
+
* A prepaid feature quantity purchased at checkout (e.g. buy 5 seats up front).
|
|
50
|
+
* @experimental
|
|
51
|
+
*/
|
|
52
52
|
interface PrepaidOption {
|
|
53
53
|
readonly featureId: string;
|
|
54
54
|
readonly quantity: number;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Autumn-native checkout — richer than the generic `createCheckout` (trials, prepaid, entities, rewards).
|
|
58
|
-
* @experimental
|
|
59
|
-
*/
|
|
57
|
+
* Autumn-native checkout — richer than the generic `createCheckout` (trials, prepaid, entities, rewards).
|
|
58
|
+
* @experimental
|
|
59
|
+
*/
|
|
60
60
|
interface AutumnCheckoutInput {
|
|
61
61
|
/** Scope the checkout to a specific entity (seat/workspace) rather than the top-level customer. */
|
|
62
62
|
readonly entityId?: string;
|
|
63
63
|
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
* Autumn applies a plan's configured free trial automatically. Pass `false` to opt out of that
|
|
65
|
+
* trial for this checkout; leave unset (or `true`) to keep the plan default.
|
|
66
|
+
*/
|
|
67
67
|
readonly freeTrial?: boolean;
|
|
68
68
|
/** Prepaid feature quantities to purchase up front. */
|
|
69
69
|
readonly options?: ReadonlyArray<PrepaidOption>;
|
|
@@ -74,9 +74,9 @@ interface AutumnCheckoutInput {
|
|
|
74
74
|
readonly successUrl?: string;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
-
* The subset of the Autumn SDK surface the native facade calls. A real `Autumn` instance satisfies it.
|
|
78
|
-
* @experimental
|
|
79
|
-
*/
|
|
77
|
+
* The subset of the Autumn SDK surface the native facade calls. A real `Autumn` instance satisfies it.
|
|
78
|
+
* @experimental
|
|
79
|
+
*/
|
|
80
80
|
interface AutumnFeaturesClientLike {
|
|
81
81
|
readonly billing: unknown;
|
|
82
82
|
readonly entities: unknown;
|
|
@@ -85,16 +85,16 @@ interface AutumnFeaturesClientLike {
|
|
|
85
85
|
readonly referrals: unknown;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
* `AutumnFeaturesOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
89
|
-
* @experimental
|
|
90
|
-
*/
|
|
88
|
+
* `AutumnFeaturesOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
89
|
+
* @experimental
|
|
90
|
+
*/
|
|
91
91
|
interface AutumnFeaturesOptions {
|
|
92
92
|
readonly client: AutumnFeaturesClientLike;
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* The Autumn-native feature facade returned by {@link createAutumnFeatures}.
|
|
96
|
-
* @experimental
|
|
97
|
-
*/
|
|
95
|
+
* The Autumn-native feature facade returned by {@link createAutumnFeatures}.
|
|
96
|
+
* @experimental
|
|
97
|
+
*/
|
|
98
98
|
interface AutumnFeatures {
|
|
99
99
|
readonly checkout: (referenceId: string, input: AutumnCheckoutInput) => Promise<{
|
|
100
100
|
raw: Record<string, unknown>;
|
|
@@ -121,9 +121,9 @@ interface AutumnFeatures {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
|
-
* Build the Autumn-native feature facade over an injected client. Companion to `createAutumnAdapter`;
|
|
125
|
-
* share the same underlying `autumn-js` `Autumn` client between them.
|
|
126
|
-
* @experimental
|
|
127
|
-
*/
|
|
124
|
+
* Build the Autumn-native feature facade over an injected client. Companion to `createAutumnAdapter`;
|
|
125
|
+
* share the same underlying `autumn-js` `Autumn` client between them.
|
|
126
|
+
* @experimental
|
|
127
|
+
*/
|
|
128
128
|
declare const createAutumnFeatures: (options: AutumnFeaturesOptions) => AutumnFeatures;
|
|
129
129
|
export { type AutumnCheckoutInput, type AutumnEntity, type AutumnFeatures, type AutumnFeaturesClientLike, type AutumnFeaturesOptions, type CreateEntityInput, type EventsAggregateInput, type EventsListInput, type PrepaidOption, type UsageEventPoint, createAutumnFeatures };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PaymentAdapter } from "../packem_shared/adapter.d-
|
|
1
|
+
import { P as PaymentAdapter } from "../packem_shared/adapter.d-CMjjkTGB.mjs";
|
|
2
2
|
/**
|
|
3
|
-
* The `autumn-js` SDK surface the adapter uses, as a structural type — a real `Autumn` instance
|
|
4
|
-
* satisfies it without a cast. Resources/methods are `unknown` (the adapter re-types the client as
|
|
5
|
-
* the real `Autumn` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
-
* @experimental
|
|
7
|
-
*/
|
|
3
|
+
* The `autumn-js` SDK surface the adapter uses, as a structural type — a real `Autumn` instance
|
|
4
|
+
* satisfies it without a cast. Resources/methods are `unknown` (the adapter re-types the client as
|
|
5
|
+
* the real `Autumn` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
8
|
interface AutumnClientLike {
|
|
9
9
|
readonly billing: unknown;
|
|
10
10
|
readonly check: unknown;
|
|
@@ -12,17 +12,17 @@ interface AutumnClientLike {
|
|
|
12
12
|
readonly track: unknown;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* `AutumnAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
16
|
-
* @experimental
|
|
17
|
-
*/
|
|
15
|
+
* `AutumnAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
16
|
+
* @experimental
|
|
17
|
+
*/
|
|
18
18
|
interface AutumnAdapterOptions {
|
|
19
19
|
readonly client: AutumnClientLike;
|
|
20
20
|
readonly webhookSecret: string;
|
|
21
21
|
readonly webhookToleranceSeconds?: number;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* `createAutumnAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
25
|
-
* @experimental
|
|
26
|
-
*/
|
|
24
|
+
* `createAutumnAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
25
|
+
* @experimental
|
|
26
|
+
*/
|
|
27
27
|
declare const createAutumnAdapter: (options: AutumnAdapterOptions) => PaymentAdapter;
|
|
28
28
|
export { type AutumnAdapterOptions, type AutumnClientLike, createAutumnAdapter };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PaymentAdapter } from "../packem_shared/adapter.d-
|
|
1
|
+
import { P as PaymentAdapter } from "../packem_shared/adapter.d-CMjjkTGB.js";
|
|
2
2
|
/**
|
|
3
|
-
* The `autumn-js` SDK surface the adapter uses, as a structural type — a real `Autumn` instance
|
|
4
|
-
* satisfies it without a cast. Resources/methods are `unknown` (the adapter re-types the client as
|
|
5
|
-
* the real `Autumn` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
-
* @experimental
|
|
7
|
-
*/
|
|
3
|
+
* The `autumn-js` SDK surface the adapter uses, as a structural type — a real `Autumn` instance
|
|
4
|
+
* satisfies it without a cast. Resources/methods are `unknown` (the adapter re-types the client as
|
|
5
|
+
* the real `Autumn` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
8
|
interface AutumnClientLike {
|
|
9
9
|
readonly billing: unknown;
|
|
10
10
|
readonly check: unknown;
|
|
@@ -12,17 +12,17 @@ interface AutumnClientLike {
|
|
|
12
12
|
readonly track: unknown;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* `AutumnAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
16
|
-
* @experimental
|
|
17
|
-
*/
|
|
15
|
+
* `AutumnAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
16
|
+
* @experimental
|
|
17
|
+
*/
|
|
18
18
|
interface AutumnAdapterOptions {
|
|
19
19
|
readonly client: AutumnClientLike;
|
|
20
20
|
readonly webhookSecret: string;
|
|
21
21
|
readonly webhookToleranceSeconds?: number;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* `createAutumnAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
25
|
-
* @experimental
|
|
26
|
-
*/
|
|
24
|
+
* `createAutumnAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
25
|
+
* @experimental
|
|
26
|
+
*/
|
|
27
27
|
declare const createAutumnAdapter: (options: AutumnAdapterOptions) => PaymentAdapter;
|
|
28
28
|
export { type AutumnAdapterOptions, type AutumnClientLike, createAutumnAdapter };
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { P as PaymentAdapter } from "../packem_shared/adapter.d-
|
|
1
|
+
import { P as PaymentAdapter } from "../packem_shared/adapter.d-CMjjkTGB.mjs";
|
|
2
2
|
/**
|
|
3
|
-
* The `creem` SDK surface the adapter uses, as a structural type — a real `Creem` instance satisfies
|
|
4
|
-
* it without a cast. Resources are `unknown` (the adapter re-types the client as the real `Creem`
|
|
5
|
-
* internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
-
* @experimental
|
|
7
|
-
*/
|
|
3
|
+
* The `creem` SDK surface the adapter uses, as a structural type — a real `Creem` instance satisfies
|
|
4
|
+
* it without a cast. Resources are `unknown` (the adapter re-types the client as the real `Creem`
|
|
5
|
+
* internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
8
|
interface CreemClientLike {
|
|
9
9
|
readonly checkouts: unknown;
|
|
10
10
|
readonly customers: unknown;
|
|
11
11
|
readonly subscriptions: unknown;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* `CreemAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
15
|
-
* @experimental
|
|
16
|
-
*/
|
|
14
|
+
* `CreemAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
15
|
+
* @experimental
|
|
16
|
+
*/
|
|
17
17
|
interface CreemAdapterOptions {
|
|
18
18
|
readonly client: CreemClientLike;
|
|
19
19
|
readonly webhookSecret: string;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* `createCreemAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
23
|
-
* @experimental
|
|
24
|
-
*/
|
|
22
|
+
* `createCreemAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
23
|
+
* @experimental
|
|
24
|
+
*/
|
|
25
25
|
declare const createCreemAdapter: (options: CreemAdapterOptions) => PaymentAdapter;
|
|
26
26
|
export { type CreemAdapterOptions, type CreemClientLike, createCreemAdapter };
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { P as PaymentAdapter } from "../packem_shared/adapter.d-
|
|
1
|
+
import { P as PaymentAdapter } from "../packem_shared/adapter.d-CMjjkTGB.js";
|
|
2
2
|
/**
|
|
3
|
-
* The `creem` SDK surface the adapter uses, as a structural type — a real `Creem` instance satisfies
|
|
4
|
-
* it without a cast. Resources are `unknown` (the adapter re-types the client as the real `Creem`
|
|
5
|
-
* internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
-
* @experimental
|
|
7
|
-
*/
|
|
3
|
+
* The `creem` SDK surface the adapter uses, as a structural type — a real `Creem` instance satisfies
|
|
4
|
+
* it without a cast. Resources are `unknown` (the adapter re-types the client as the real `Creem`
|
|
5
|
+
* internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
8
|
interface CreemClientLike {
|
|
9
9
|
readonly checkouts: unknown;
|
|
10
10
|
readonly customers: unknown;
|
|
11
11
|
readonly subscriptions: unknown;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* `CreemAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
15
|
-
* @experimental
|
|
16
|
-
*/
|
|
14
|
+
* `CreemAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
15
|
+
* @experimental
|
|
16
|
+
*/
|
|
17
17
|
interface CreemAdapterOptions {
|
|
18
18
|
readonly client: CreemClientLike;
|
|
19
19
|
readonly webhookSecret: string;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* `createCreemAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
23
|
-
* @experimental
|
|
24
|
-
*/
|
|
22
|
+
* `createCreemAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
23
|
+
* @experimental
|
|
24
|
+
*/
|
|
25
25
|
declare const createCreemAdapter: (options: CreemAdapterOptions) => PaymentAdapter;
|
|
26
26
|
export { type CreemAdapterOptions, type CreemClientLike, createCreemAdapter };
|
package/dist/providers/creem.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { verifyCreemSignature } from '../packem_shared/constantTimeEqual-BQjoW85
|
|
|
4
4
|
import { m as makeNotSupported } from '../packem_shared/not-supported-C0onRyia.mjs';
|
|
5
5
|
import { s as stateToEventType } from '../packem_shared/subscription-event-CwEsWRCK.mjs';
|
|
6
6
|
|
|
7
|
+
const ALREADY_EXISTS_PATTERN = /already exists/iu;
|
|
7
8
|
const PAYMENT_STATE_BY_CREEM_STATUS = {
|
|
8
9
|
canceled: "canceled",
|
|
9
10
|
completed: "captured",
|
|
@@ -34,6 +35,16 @@ const notSupported = makeNotSupported("creem (merchant-of-record)");
|
|
|
34
35
|
const idOf = (value) => typeof value === "string" ? value : readString(asRecord(value), "id");
|
|
35
36
|
const readCheckoutUrl = (checkout) => readAny(checkout, "checkout_url", "checkoutUrl") ?? "";
|
|
36
37
|
const isCanceling = (subscription) => readAny(subscription, "canceled_at", "canceledAt") !== void 0 || readString(subscription, "status") === "scheduled_cancel";
|
|
38
|
+
const isDuplicateCustomerError = (error) => {
|
|
39
|
+
if (!(error instanceof Error)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
const { statusCode } = error;
|
|
43
|
+
if (typeof statusCode === "number" && statusCode !== 400 && statusCode !== 409) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return ALREADY_EXISTS_PATTERN.test(error.message);
|
|
47
|
+
};
|
|
37
48
|
const subscriptionFromCreem = (input) => {
|
|
38
49
|
const subscription = asRecord(input);
|
|
39
50
|
const now = Date.now();
|
|
@@ -172,10 +183,30 @@ const createCreemAdapter = (options) => {
|
|
|
172
183
|
};
|
|
173
184
|
};
|
|
174
185
|
try {
|
|
175
|
-
return toCustomer(
|
|
186
|
+
return toCustomer(
|
|
187
|
+
asRecord(
|
|
188
|
+
await client.customers.create({
|
|
189
|
+
email: ref.email ?? "",
|
|
190
|
+
// Pin the framework-controlled `referenceId` LAST so caller metadata can never
|
|
191
|
+
// override it (same pattern as `createCheckout`) — this is the only thing Creem
|
|
192
|
+
// lets us key a customer on (no `externalId`-style create, unlike Polar/Dodo), so
|
|
193
|
+
// the recovery path below can verify it before ever adopting a retrieved customer.
|
|
194
|
+
metadata: { ...ref.metadata, referenceId: ref.referenceId },
|
|
195
|
+
name: ref.metadata?.name ?? ref.referenceId
|
|
196
|
+
})
|
|
197
|
+
)
|
|
198
|
+
);
|
|
176
199
|
} catch (error) {
|
|
177
|
-
if (ref.email !== void 0) {
|
|
178
|
-
|
|
200
|
+
if (ref.email !== void 0 && isDuplicateCustomerError(error)) {
|
|
201
|
+
const existing = asRecord(await client.customers.retrieve(void 0, ref.email));
|
|
202
|
+
const existingReferenceId = referenceFromMetadata(existing);
|
|
203
|
+
if (existingReferenceId !== ref.referenceId) {
|
|
204
|
+
throw new Error(
|
|
205
|
+
`Creem customer for email "${ref.email}" already belongs to a different reference; refusing to bind it to "${ref.referenceId}".`,
|
|
206
|
+
{ cause: error }
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
return toCustomer(existing);
|
|
179
210
|
}
|
|
180
211
|
throw error;
|
|
181
212
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PaymentAdapter } from "../packem_shared/adapter.d-
|
|
1
|
+
import { P as PaymentAdapter } from "../packem_shared/adapter.d-CMjjkTGB.mjs";
|
|
2
2
|
/**
|
|
3
|
-
* The `dodopayments` SDK surface the adapter uses, as a structural type — a real `DodoPayments`
|
|
4
|
-
* instance satisfies it without a cast. Resources are `unknown` (the adapter re-types the client as
|
|
5
|
-
* the real `DodoPayments` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
-
* @experimental
|
|
7
|
-
*/
|
|
3
|
+
* The `dodopayments` SDK surface the adapter uses, as a structural type — a real `DodoPayments`
|
|
4
|
+
* instance satisfies it without a cast. Resources are `unknown` (the adapter re-types the client as
|
|
5
|
+
* the real `DodoPayments` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
8
|
interface DodoPaymentsClientLike {
|
|
9
9
|
readonly checkoutSessions: unknown;
|
|
10
10
|
readonly customers: unknown;
|
|
@@ -14,17 +14,17 @@ interface DodoPaymentsClientLike {
|
|
|
14
14
|
readonly usageEvents: unknown;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* `DodoPaymentsAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
18
|
-
* @experimental
|
|
19
|
-
*/
|
|
17
|
+
* `DodoPaymentsAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
18
|
+
* @experimental
|
|
19
|
+
*/
|
|
20
20
|
interface DodoPaymentsAdapterOptions {
|
|
21
21
|
readonly client: DodoPaymentsClientLike;
|
|
22
22
|
readonly webhookSecret: string;
|
|
23
23
|
readonly webhookToleranceSeconds?: number;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* `createDodoPaymentsAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
27
|
-
* @experimental
|
|
28
|
-
*/
|
|
26
|
+
* `createDodoPaymentsAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
27
|
+
* @experimental
|
|
28
|
+
*/
|
|
29
29
|
declare const createDodoPaymentsAdapter: (options: DodoPaymentsAdapterOptions) => PaymentAdapter;
|
|
30
30
|
export { type DodoPaymentsAdapterOptions, type DodoPaymentsClientLike, createDodoPaymentsAdapter };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PaymentAdapter } from "../packem_shared/adapter.d-
|
|
1
|
+
import { P as PaymentAdapter } from "../packem_shared/adapter.d-CMjjkTGB.js";
|
|
2
2
|
/**
|
|
3
|
-
* The `dodopayments` SDK surface the adapter uses, as a structural type — a real `DodoPayments`
|
|
4
|
-
* instance satisfies it without a cast. Resources are `unknown` (the adapter re-types the client as
|
|
5
|
-
* the real `DodoPayments` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
-
* @experimental
|
|
7
|
-
*/
|
|
3
|
+
* The `dodopayments` SDK surface the adapter uses, as a structural type — a real `DodoPayments`
|
|
4
|
+
* instance satisfies it without a cast. Resources are `unknown` (the adapter re-types the client as
|
|
5
|
+
* the real `DodoPayments` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
8
|
interface DodoPaymentsClientLike {
|
|
9
9
|
readonly checkoutSessions: unknown;
|
|
10
10
|
readonly customers: unknown;
|
|
@@ -14,17 +14,17 @@ interface DodoPaymentsClientLike {
|
|
|
14
14
|
readonly usageEvents: unknown;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* `DodoPaymentsAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
18
|
-
* @experimental
|
|
19
|
-
*/
|
|
17
|
+
* `DodoPaymentsAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
18
|
+
* @experimental
|
|
19
|
+
*/
|
|
20
20
|
interface DodoPaymentsAdapterOptions {
|
|
21
21
|
readonly client: DodoPaymentsClientLike;
|
|
22
22
|
readonly webhookSecret: string;
|
|
23
23
|
readonly webhookToleranceSeconds?: number;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* `createDodoPaymentsAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
27
|
-
* @experimental
|
|
28
|
-
*/
|
|
26
|
+
* `createDodoPaymentsAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
27
|
+
* @experimental
|
|
28
|
+
*/
|
|
29
29
|
declare const createDodoPaymentsAdapter: (options: DodoPaymentsAdapterOptions) => PaymentAdapter;
|
|
30
30
|
export { type DodoPaymentsAdapterOptions, type DodoPaymentsClientLike, createDodoPaymentsAdapter };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PaymentAdapter } from "../packem_shared/adapter.d-
|
|
1
|
+
import { P as PaymentAdapter } from "../packem_shared/adapter.d-CMjjkTGB.mjs";
|
|
2
2
|
/**
|
|
3
|
-
* The `@polar-sh/sdk` surface the adapter uses, as a structural type — a real `Polar` instance
|
|
4
|
-
* satisfies it without a cast. Resources are `unknown` (the adapter re-types the client as the real
|
|
5
|
-
* `Polar` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
-
* @experimental
|
|
7
|
-
*/
|
|
3
|
+
* The `@polar-sh/sdk` surface the adapter uses, as a structural type — a real `Polar` instance
|
|
4
|
+
* satisfies it without a cast. Resources are `unknown` (the adapter re-types the client as the real
|
|
5
|
+
* `Polar` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
8
|
interface PolarClientLike {
|
|
9
9
|
readonly checkouts: unknown;
|
|
10
10
|
readonly customers: unknown;
|
|
@@ -15,17 +15,17 @@ interface PolarClientLike {
|
|
|
15
15
|
readonly subscriptions: unknown;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* `PolarAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
19
|
-
* @experimental
|
|
20
|
-
*/
|
|
18
|
+
* `PolarAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
19
|
+
* @experimental
|
|
20
|
+
*/
|
|
21
21
|
interface PolarAdapterOptions {
|
|
22
22
|
readonly client: PolarClientLike;
|
|
23
23
|
readonly webhookSecret: string;
|
|
24
24
|
readonly webhookToleranceSeconds?: number;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* `createPolarAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
28
|
-
* @experimental
|
|
29
|
-
*/
|
|
27
|
+
* `createPolarAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
28
|
+
* @experimental
|
|
29
|
+
*/
|
|
30
30
|
declare const createPolarAdapter: (options: PolarAdapterOptions) => PaymentAdapter;
|
|
31
31
|
export { type PolarAdapterOptions, type PolarClientLike, createPolarAdapter };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PaymentAdapter } from "../packem_shared/adapter.d-
|
|
1
|
+
import { P as PaymentAdapter } from "../packem_shared/adapter.d-CMjjkTGB.js";
|
|
2
2
|
/**
|
|
3
|
-
* The `@polar-sh/sdk` surface the adapter uses, as a structural type — a real `Polar` instance
|
|
4
|
-
* satisfies it without a cast. Resources are `unknown` (the adapter re-types the client as the real
|
|
5
|
-
* `Polar` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
-
* @experimental
|
|
7
|
-
*/
|
|
3
|
+
* The `@polar-sh/sdk` surface the adapter uses, as a structural type — a real `Polar` instance
|
|
4
|
+
* satisfies it without a cast. Resources are `unknown` (the adapter re-types the client as the real
|
|
5
|
+
* `Polar` internally); this keeps the SDK's full type out of the published declarations.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
8
|
interface PolarClientLike {
|
|
9
9
|
readonly checkouts: unknown;
|
|
10
10
|
readonly customers: unknown;
|
|
@@ -15,17 +15,17 @@ interface PolarClientLike {
|
|
|
15
15
|
readonly subscriptions: unknown;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* `PolarAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
19
|
-
* @experimental
|
|
20
|
-
*/
|
|
18
|
+
* `PolarAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
19
|
+
* @experimental
|
|
20
|
+
*/
|
|
21
21
|
interface PolarAdapterOptions {
|
|
22
22
|
readonly client: PolarClientLike;
|
|
23
23
|
readonly webhookSecret: string;
|
|
24
24
|
readonly webhookToleranceSeconds?: number;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* `createPolarAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
28
|
-
* @experimental
|
|
29
|
-
*/
|
|
27
|
+
* `createPolarAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
28
|
+
* @experimental
|
|
29
|
+
*/
|
|
30
30
|
declare const createPolarAdapter: (options: PolarAdapterOptions) => PaymentAdapter;
|
|
31
31
|
export { type PolarAdapterOptions, type PolarClientLike, createPolarAdapter };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PaymentAdapter } from "../packem_shared/adapter.d-
|
|
1
|
+
import { P as PaymentAdapter } from "../packem_shared/adapter.d-CMjjkTGB.mjs";
|
|
2
2
|
/**
|
|
3
|
-
* The Stripe SDK surface the adapter uses, as a structural type — a real `Stripe` instance satisfies
|
|
4
|
-
* it without a cast. Resources are `unknown` here (the adapter re-types the client as the real
|
|
5
|
-
* `Stripe` internally); this keeps the SDK's full type out of the published declaration files.
|
|
6
|
-
* @experimental
|
|
7
|
-
*/
|
|
3
|
+
* The Stripe SDK surface the adapter uses, as a structural type — a real `Stripe` instance satisfies
|
|
4
|
+
* it without a cast. Resources are `unknown` here (the adapter re-types the client as the real
|
|
5
|
+
* `Stripe` internally); this keeps the SDK's full type out of the published declaration files.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
8
|
interface StripeClientLike {
|
|
9
9
|
readonly billing: unknown;
|
|
10
10
|
readonly billingPortal: unknown;
|
|
@@ -16,17 +16,17 @@ interface StripeClientLike {
|
|
|
16
16
|
readonly webhooks: unknown;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* `StripeAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
20
|
-
* @experimental
|
|
21
|
-
*/
|
|
19
|
+
* `StripeAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
20
|
+
* @experimental
|
|
21
|
+
*/
|
|
22
22
|
interface StripeAdapterOptions {
|
|
23
23
|
readonly client: StripeClientLike;
|
|
24
24
|
readonly webhookSecret: string;
|
|
25
25
|
readonly webhookToleranceSeconds?: number;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* `createStripeAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
29
|
-
* @experimental
|
|
30
|
-
*/
|
|
28
|
+
* `createStripeAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
29
|
+
* @experimental
|
|
30
|
+
*/
|
|
31
31
|
declare const createStripeAdapter: (options: StripeAdapterOptions) => PaymentAdapter;
|
|
32
32
|
export { type StripeAdapterOptions, type StripeClientLike, createStripeAdapter };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { P as PaymentAdapter } from "../packem_shared/adapter.d-
|
|
1
|
+
import { P as PaymentAdapter } from "../packem_shared/adapter.d-CMjjkTGB.js";
|
|
2
2
|
/**
|
|
3
|
-
* The Stripe SDK surface the adapter uses, as a structural type — a real `Stripe` instance satisfies
|
|
4
|
-
* it without a cast. Resources are `unknown` here (the adapter re-types the client as the real
|
|
5
|
-
* `Stripe` internally); this keeps the SDK's full type out of the published declaration files.
|
|
6
|
-
* @experimental
|
|
7
|
-
*/
|
|
3
|
+
* The Stripe SDK surface the adapter uses, as a structural type — a real `Stripe` instance satisfies
|
|
4
|
+
* it without a cast. Resources are `unknown` here (the adapter re-types the client as the real
|
|
5
|
+
* `Stripe` internally); this keeps the SDK's full type out of the published declaration files.
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
8
|
interface StripeClientLike {
|
|
9
9
|
readonly billing: unknown;
|
|
10
10
|
readonly billingPortal: unknown;
|
|
@@ -16,17 +16,17 @@ interface StripeClientLike {
|
|
|
16
16
|
readonly webhooks: unknown;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* `StripeAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
20
|
-
* @experimental
|
|
21
|
-
*/
|
|
19
|
+
* `StripeAdapterOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
20
|
+
* @experimental
|
|
21
|
+
*/
|
|
22
22
|
interface StripeAdapterOptions {
|
|
23
23
|
readonly client: StripeClientLike;
|
|
24
24
|
readonly webhookSecret: string;
|
|
25
25
|
readonly webhookToleranceSeconds?: number;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* `createStripeAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
29
|
-
* @experimental
|
|
30
|
-
*/
|
|
28
|
+
* `createStripeAdapter` is part of the experimental `@lunora/payment` API and may change without a major version bump.
|
|
29
|
+
* @experimental
|
|
30
|
+
*/
|
|
31
31
|
declare const createStripeAdapter: (options: StripeAdapterOptions) => PaymentAdapter;
|
|
32
32
|
export { type StripeAdapterOptions, type StripeClientLike, createStripeAdapter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/payment",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.28",
|
|
4
4
|
"description": "Provider-agnostic payments for Lunora: Stripe-first adapter, webhook sync, and subscription/payment state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"billing",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
75
|
-
"@lunora/server": "1.0.0-alpha.
|
|
76
|
-
"@lunora/values": "1.0.0-alpha.
|
|
74
|
+
"@lunora/errors": "1.0.0-alpha.6",
|
|
75
|
+
"@lunora/server": "1.0.0-alpha.28",
|
|
76
|
+
"@lunora/values": "1.0.0-alpha.9",
|
|
77
77
|
"dinero.js": "2.0.2"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|