@shware/purchase 1.8.8 → 1.9.0
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/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/app-store/config.cjs +98 -128
- package/dist/app-store/config.cjs.map +1 -1
- package/dist/app-store/config.d.cts +31 -31
- package/dist/app-store/config.d.cts.map +1 -0
- package/dist/app-store/config.d.mts +39 -0
- package/dist/app-store/config.d.mts.map +1 -0
- package/dist/app-store/config.mjs +93 -91
- package/dist/app-store/config.mjs.map +1 -1
- package/dist/app-store/index.cjs +3 -31
- package/dist/app-store/index.d.cts +2 -3
- package/dist/app-store/index.d.mts +2 -0
- package/dist/app-store/index.mjs +1 -5
- package/dist/google-play/config.cjs +100 -123
- package/dist/google-play/config.cjs.map +1 -1
- package/dist/google-play/config.d.cts +31 -31
- package/dist/google-play/config.d.cts.map +1 -0
- package/dist/google-play/config.d.mts +39 -0
- package/dist/google-play/config.d.mts.map +1 -0
- package/dist/google-play/config.mjs +95 -86
- package/dist/google-play/config.mjs.map +1 -1
- package/dist/google-play/index.cjs +9 -42
- package/dist/google-play/index.d.cts +3 -4
- package/dist/google-play/index.d.mts +3 -0
- package/dist/google-play/index.mjs +2 -17
- package/dist/google-play/real-time-developer-notification.cjs +122 -81
- package/dist/google-play/real-time-developer-notification.cjs.map +1 -1
- package/dist/google-play/real-time-developer-notification.d.cts +119 -117
- package/dist/google-play/real-time-developer-notification.d.cts.map +1 -0
- package/dist/google-play/real-time-developer-notification.d.mts +150 -0
- package/dist/google-play/real-time-developer-notification.d.mts.map +1 -0
- package/dist/google-play/real-time-developer-notification.mjs +118 -53
- package/dist/google-play/real-time-developer-notification.mjs.map +1 -1
- package/dist/index.cjs +13 -48
- package/dist/index.d.cts +5 -6
- package/dist/index.d.mts +5 -0
- package/dist/index.mjs +2 -19
- package/dist/stripe/config.cjs +104 -133
- package/dist/stripe/config.cjs.map +1 -1
- package/dist/stripe/config.d.cts +35 -35
- package/dist/stripe/config.d.cts.map +1 -0
- package/dist/stripe/config.d.mts +43 -0
- package/dist/stripe/config.d.mts.map +1 -0
- package/dist/stripe/config.mjs +99 -96
- package/dist/stripe/config.mjs.map +1 -1
- package/dist/stripe/handler.cjs +25 -53
- package/dist/stripe/handler.cjs.map +1 -1
- package/dist/stripe/handler.d.cts +10 -9
- package/dist/stripe/handler.d.cts.map +1 -0
- package/dist/stripe/handler.d.mts +16 -0
- package/dist/stripe/handler.d.mts.map +1 -0
- package/dist/stripe/handler.mjs +25 -29
- package/dist/stripe/handler.mjs.map +1 -1
- package/dist/stripe/index.cjs +27 -74
- package/dist/stripe/index.d.cts +8 -12
- package/dist/stripe/index.d.mts +8 -0
- package/dist/stripe/index.mjs +5 -44
- package/dist/stripe/mapper.cjs +168 -218
- package/dist/stripe/mapper.cjs.map +1 -1
- package/dist/stripe/mapper.d.cts +115 -114
- package/dist/stripe/mapper.d.cts.map +1 -0
- package/dist/stripe/mapper.d.mts +158 -0
- package/dist/stripe/mapper.d.mts.map +1 -0
- package/dist/stripe/mapper.mjs +155 -181
- package/dist/stripe/mapper.mjs.map +1 -1
- package/dist/stripe/metadata.cjs +11 -35
- package/dist/stripe/metadata.cjs.map +1 -1
- package/dist/stripe/metadata.d.cts +9 -7
- package/dist/stripe/metadata.d.cts.map +1 -0
- package/dist/stripe/metadata.d.mts +12 -0
- package/dist/stripe/metadata.d.mts.map +1 -0
- package/dist/stripe/metadata.mjs +11 -11
- package/dist/stripe/metadata.mjs.map +1 -1
- package/dist/stripe/pending-checkout.cjs +55 -61
- package/dist/stripe/pending-checkout.cjs.map +1 -1
- package/dist/stripe/pending-checkout.d.cts +3 -1
- package/dist/stripe/pending-checkout.d.cts.map +1 -0
- package/dist/stripe/{pending-checkout.d.ts → pending-checkout.d.mts} +3 -1
- package/dist/stripe/pending-checkout.d.mts.map +1 -0
- package/dist/stripe/pending-checkout.mjs +52 -34
- package/dist/stripe/pending-checkout.mjs.map +1 -1
- package/dist/stripe/schema.cjs +30 -55
- package/dist/stripe/schema.cjs.map +1 -1
- package/dist/stripe/schema.d.cts +36 -37
- package/dist/stripe/schema.d.cts.map +1 -0
- package/dist/stripe/schema.d.mts +40 -0
- package/dist/stripe/schema.d.mts.map +1 -0
- package/dist/stripe/schema.mjs +28 -40
- package/dist/stripe/schema.mjs.map +1 -1
- package/dist/subscription/index.cjs +178 -80
- package/dist/subscription/index.cjs.map +1 -1
- package/dist/subscription/index.d.cts +136 -134
- package/dist/subscription/index.d.cts.map +1 -0
- package/dist/subscription/index.d.mts +150 -0
- package/dist/subscription/index.d.mts.map +1 -0
- package/dist/subscription/index.mjs +173 -51
- package/dist/subscription/index.mjs.map +1 -1
- package/dist/types.cjs +0 -19
- package/dist/types.d.cts +7 -6
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +10 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +1 -1
- package/package.json +41 -26
- package/dist/app-store/config.d.ts +0 -39
- package/dist/app-store/index.cjs.map +0 -1
- package/dist/app-store/index.d.ts +0 -3
- package/dist/app-store/index.mjs.map +0 -1
- package/dist/google-play/config.d.ts +0 -39
- package/dist/google-play/index.cjs.map +0 -1
- package/dist/google-play/index.d.ts +0 -4
- package/dist/google-play/index.mjs.map +0 -1
- package/dist/google-play/real-time-developer-notification.d.ts +0 -148
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.mjs.map +0 -1
- package/dist/stripe/config.d.ts +0 -43
- package/dist/stripe/handler.d.ts +0 -15
- package/dist/stripe/index.cjs.map +0 -1
- package/dist/stripe/index.d.ts +0 -12
- package/dist/stripe/index.mjs.map +0 -1
- package/dist/stripe/mapper.d.ts +0 -157
- package/dist/stripe/metadata.d.ts +0 -10
- package/dist/stripe/schema.d.ts +0 -41
- package/dist/subscription/index.d.ts +0 -148
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.ts +0 -9
- package/dist/types.mjs.map +0 -1
package/dist/stripe/config.mjs
CHANGED
|
@@ -1,102 +1,105 @@
|
|
|
1
|
-
// src/stripe/config.ts
|
|
2
1
|
import { invariant } from "@shware/utils";
|
|
3
2
|
import ms from "ms";
|
|
4
|
-
|
|
3
|
+
//#region src/stripe/config.ts
|
|
4
|
+
const addMethod = Symbol("addMethod");
|
|
5
5
|
var Product = class {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
id;
|
|
7
|
+
config;
|
|
8
|
+
plan;
|
|
9
|
+
prices;
|
|
10
|
+
defaultPriceId;
|
|
11
|
+
constructor(config, id, plan = null) {
|
|
12
|
+
this.id = id;
|
|
13
|
+
this.config = config;
|
|
14
|
+
this.plan = plan;
|
|
15
|
+
this.prices = /* @__PURE__ */ new Map();
|
|
16
|
+
this.defaultPriceId = null;
|
|
17
|
+
}
|
|
18
|
+
price = (priceId, metadata = {
|
|
19
|
+
credits: 0,
|
|
20
|
+
expiresIn: "0"
|
|
21
|
+
}) => {
|
|
22
|
+
this.prices.set(priceId, metadata);
|
|
23
|
+
return this;
|
|
24
|
+
};
|
|
25
|
+
default = (defaultPriceId) => {
|
|
26
|
+
this.defaultPriceId = defaultPriceId;
|
|
27
|
+
this.config[addMethod](this);
|
|
28
|
+
return this.config;
|
|
29
|
+
};
|
|
27
30
|
};
|
|
28
|
-
var StripeConfig = class
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
};
|
|
99
|
-
export {
|
|
100
|
-
StripeConfig
|
|
31
|
+
var StripeConfig = class StripeConfig {
|
|
32
|
+
products = /* @__PURE__ */ new Map();
|
|
33
|
+
returnUrl;
|
|
34
|
+
cancelUrl;
|
|
35
|
+
successUrl;
|
|
36
|
+
cancellationCouponId;
|
|
37
|
+
allowPromotionCodes;
|
|
38
|
+
get productIds() {
|
|
39
|
+
return Array.from(this.products.keys());
|
|
40
|
+
}
|
|
41
|
+
[addMethod] = (product) => {
|
|
42
|
+
this.products.set(product.id, product);
|
|
43
|
+
return this;
|
|
44
|
+
};
|
|
45
|
+
constructor(options) {
|
|
46
|
+
this.returnUrl = options.returnUrl;
|
|
47
|
+
this.cancelUrl = options.cancelUrl;
|
|
48
|
+
this.successUrl = options.successUrl;
|
|
49
|
+
this.cancellationCouponId = options.cancellationCouponId;
|
|
50
|
+
this.allowPromotionCodes = options.allowPromotionCodes;
|
|
51
|
+
}
|
|
52
|
+
static create = (options) => {
|
|
53
|
+
return new StripeConfig(options);
|
|
54
|
+
};
|
|
55
|
+
product = (productId, plan = null) => {
|
|
56
|
+
return new Product(this, productId, plan);
|
|
57
|
+
};
|
|
58
|
+
getPlan = (productId) => {
|
|
59
|
+
const product = this.products.get(productId);
|
|
60
|
+
invariant(product, `Product not found for ${productId}`);
|
|
61
|
+
invariant(product.plan, `Product ${productId} is not a subscription`);
|
|
62
|
+
return product.plan;
|
|
63
|
+
};
|
|
64
|
+
getMode = (productId) => {
|
|
65
|
+
const product = this.products.get(productId);
|
|
66
|
+
invariant(product, `Product not found for ${productId}`);
|
|
67
|
+
return product.plan === null ? "payment" : "subscription";
|
|
68
|
+
};
|
|
69
|
+
getPriceId = (productId) => {
|
|
70
|
+
const product = this.products.get(productId);
|
|
71
|
+
invariant(product, `Product not found for ${productId}`);
|
|
72
|
+
invariant(product.defaultPriceId, `Default price not found for product ${productId}`);
|
|
73
|
+
return product.defaultPriceId;
|
|
74
|
+
};
|
|
75
|
+
getCreditAmount = (productId, priceId) => {
|
|
76
|
+
const product = this.products.get(productId);
|
|
77
|
+
invariant(product, `Product not found for ${productId}`);
|
|
78
|
+
if (priceId) {
|
|
79
|
+
const price = product.prices.get(priceId);
|
|
80
|
+
invariant(price, `Price not found for ${priceId}`);
|
|
81
|
+
return price.credits;
|
|
82
|
+
}
|
|
83
|
+
invariant(product.defaultPriceId, `Default price not found for product ${productId}`);
|
|
84
|
+
return product.prices.get(product.defaultPriceId)?.credits ?? 0;
|
|
85
|
+
};
|
|
86
|
+
getCreditExpiresIn = (productId, priceId) => {
|
|
87
|
+
const product = this.products.get(productId);
|
|
88
|
+
invariant(product, `Product not found for ${productId}`);
|
|
89
|
+
if (priceId) {
|
|
90
|
+
const price = product.prices.get(priceId);
|
|
91
|
+
invariant(price, `Price not found for ${priceId}`);
|
|
92
|
+
return ms(price.expiresIn);
|
|
93
|
+
}
|
|
94
|
+
invariant(product.defaultPriceId, `Default price not found for product ${productId}`);
|
|
95
|
+
return ms(product.prices.get(product.defaultPriceId)?.expiresIn ?? "0");
|
|
96
|
+
};
|
|
97
|
+
getCreditExpiresAt = (productId, priceId) => {
|
|
98
|
+
const expiresIn = this.getCreditExpiresIn(productId, priceId);
|
|
99
|
+
return new Date(Date.now() + expiresIn).toISOString();
|
|
100
|
+
};
|
|
101
101
|
};
|
|
102
|
+
//#endregion
|
|
103
|
+
export { StripeConfig };
|
|
104
|
+
|
|
102
105
|
//# sourceMappingURL=config.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/stripe/config.ts"],"sourcesContent":["import { invariant } from '@shware/utils';\nimport ms from 'ms';\nimport type { Metadata } from '../types';\n\nexport type PriceId = `price_${string}`;\n\nconst addMethod = Symbol('addMethod');\n\nclass Product<\n NS extends Lowercase<string> = Lowercase<string>,\n PE extends string = string,\n PI extends string = never,\n I extends PriceId = never,\n> {\n readonly id: string;\n readonly config: StripeConfig<NS, PE, PI>;\n readonly plan: PE | null;\n readonly prices: Map<PriceId, Metadata>;\n\n defaultPriceId: I | null;\n\n constructor(config: StripeConfig<NS, PE, PI>, id: string, plan: PE | null = null) {\n this.id = id;\n this.config = config;\n this.plan = plan;\n this.prices = new Map();\n this.defaultPriceId = null;\n }\n\n price = <K extends PriceId>(\n priceId: K extends I ? never : K,\n metadata: Metadata = { credits: 0, expiresIn: '0' }\n ): Product<NS, PE, PI, I | K> => {\n this.prices.set(priceId, metadata);\n return this as Product<NS, PE, PI, I | K>;\n };\n\n default = (defaultPriceId: I) => {\n this.defaultPriceId = defaultPriceId;\n this.config[addMethod](this as never);\n return this.config;\n };\n}\n\ntype Options = {\n returnUrl: string;\n cancelUrl: string;\n successUrl: `${string}session_id={CHECKOUT_SESSION_ID}${string}`;\n cancellationCouponId: string;\n allowPromotionCodes: boolean;\n};\n\nexport class StripeConfig<\n NS extends Lowercase<string> = Lowercase<string>,\n PE extends string = string,\n PI extends string = never,\n> {\n private products: Map<string, Product<NS, PE, PI>> = new Map();\n\n public returnUrl: string;\n public cancelUrl: string;\n public successUrl: `${string}session_id={CHECKOUT_SESSION_ID}${string}`;\n public cancellationCouponId: string;\n public allowPromotionCodes: boolean;\n\n get productIds(): string[] {\n return Array.from(this.products.keys());\n }\n\n [addMethod] = (product: Product<NS, PE, PI>) => {\n this.products.set(product.id, product);\n return this;\n };\n\n private constructor(options: Options) {\n this.returnUrl = options.returnUrl;\n this.cancelUrl = options.cancelUrl;\n this.successUrl = options.successUrl;\n this.cancellationCouponId = options.cancellationCouponId;\n this.allowPromotionCodes = options.allowPromotionCodes;\n }\n\n static create = <NS extends Lowercase<string>, PE extends string>(options: Options) => {\n return new StripeConfig<NS, PE>(options);\n };\n\n product = <K extends `${NS}.${Lowercase<string>}`>(\n productId: K extends PI ? never : K,\n plan: PE | null = null\n ) => {\n return new Product<NS, PE, K | PI>(this, productId, plan);\n };\n\n getPlan = (productId: string): PE => {\n const product = this.products.get(productId);\n invariant(product, `Product not found for ${productId}`);\n invariant(product.plan, `Product ${productId} is not a subscription`);\n return product.plan;\n };\n\n getMode = (productId: string): 'payment' | 'subscription' => {\n const product = this.products.get(productId);\n invariant(product, `Product not found for ${productId}`);\n return product.plan === null ? 'payment' : 'subscription';\n };\n\n getPriceId = (productId: string): PriceId => {\n const product = this.products.get(productId);\n invariant(product, `Product not found for ${productId}`);\n invariant(product.defaultPriceId, `Default price not found for product ${productId}`);\n return product.defaultPriceId;\n };\n\n getCreditAmount = (productId: string, priceId?: string): number => {\n const product = this.products.get(productId);\n invariant(product, `Product not found for ${productId}`);\n if (priceId) {\n const price = product.prices.get(priceId as PriceId);\n invariant(price, `Price not found for ${priceId}`);\n return price.credits;\n }\n\n invariant(product.defaultPriceId, `Default price not found for product ${productId}`);\n return product.prices.get(product.defaultPriceId)?.credits ?? 0;\n };\n\n private getCreditExpiresIn = (productId: string, priceId?: string): number => {\n const product = this.products.get(productId);\n invariant(product, `Product not found for ${productId}`);\n if (priceId) {\n const price = product.prices.get(priceId as PriceId);\n invariant(price, `Price not found for ${priceId}`);\n return ms(price.expiresIn);\n }\n\n invariant(product.defaultPriceId, `Default price not found for product ${productId}`);\n return ms(product.prices.get(product.defaultPriceId)?.expiresIn ?? '0');\n };\n\n getCreditExpiresAt = (productId: string, priceId?: string): string => {\n const expiresIn = this.getCreditExpiresIn(productId, priceId);\n return new Date(Date.now() + expiresIn).toISOString();\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../../src/stripe/config.ts"],"sourcesContent":["import { invariant } from '@shware/utils';\nimport ms from 'ms';\nimport type { Metadata } from '../types';\n\nexport type PriceId = `price_${string}`;\n\nconst addMethod = Symbol('addMethod');\n\nclass Product<\n NS extends Lowercase<string> = Lowercase<string>,\n PE extends string = string,\n PI extends string = never,\n I extends PriceId = never,\n> {\n readonly id: string;\n readonly config: StripeConfig<NS, PE, PI>;\n readonly plan: PE | null;\n readonly prices: Map<PriceId, Metadata>;\n\n defaultPriceId: I | null;\n\n constructor(config: StripeConfig<NS, PE, PI>, id: string, plan: PE | null = null) {\n this.id = id;\n this.config = config;\n this.plan = plan;\n this.prices = new Map();\n this.defaultPriceId = null;\n }\n\n price = <K extends PriceId>(\n priceId: K extends I ? never : K,\n metadata: Metadata = { credits: 0, expiresIn: '0' }\n ): Product<NS, PE, PI, I | K> => {\n this.prices.set(priceId, metadata);\n return this as Product<NS, PE, PI, I | K>;\n };\n\n default = (defaultPriceId: I) => {\n this.defaultPriceId = defaultPriceId;\n this.config[addMethod](this as never);\n return this.config;\n };\n}\n\ntype Options = {\n returnUrl: string;\n cancelUrl: string;\n successUrl: `${string}session_id={CHECKOUT_SESSION_ID}${string}`;\n cancellationCouponId: string;\n allowPromotionCodes: boolean;\n};\n\nexport class StripeConfig<\n NS extends Lowercase<string> = Lowercase<string>,\n PE extends string = string,\n PI extends string = never,\n> {\n private products: Map<string, Product<NS, PE, PI>> = new Map();\n\n public returnUrl: string;\n public cancelUrl: string;\n public successUrl: `${string}session_id={CHECKOUT_SESSION_ID}${string}`;\n public cancellationCouponId: string;\n public allowPromotionCodes: boolean;\n\n get productIds(): string[] {\n return Array.from(this.products.keys());\n }\n\n [addMethod] = (product: Product<NS, PE, PI>) => {\n this.products.set(product.id, product);\n return this;\n };\n\n private constructor(options: Options) {\n this.returnUrl = options.returnUrl;\n this.cancelUrl = options.cancelUrl;\n this.successUrl = options.successUrl;\n this.cancellationCouponId = options.cancellationCouponId;\n this.allowPromotionCodes = options.allowPromotionCodes;\n }\n\n static create = <NS extends Lowercase<string>, PE extends string>(options: Options) => {\n return new StripeConfig<NS, PE>(options);\n };\n\n product = <K extends `${NS}.${Lowercase<string>}`>(\n productId: K extends PI ? never : K,\n plan: PE | null = null\n ) => {\n return new Product<NS, PE, K | PI>(this, productId, plan);\n };\n\n getPlan = (productId: string): PE => {\n const product = this.products.get(productId);\n invariant(product, `Product not found for ${productId}`);\n invariant(product.plan, `Product ${productId} is not a subscription`);\n return product.plan;\n };\n\n getMode = (productId: string): 'payment' | 'subscription' => {\n const product = this.products.get(productId);\n invariant(product, `Product not found for ${productId}`);\n return product.plan === null ? 'payment' : 'subscription';\n };\n\n getPriceId = (productId: string): PriceId => {\n const product = this.products.get(productId);\n invariant(product, `Product not found for ${productId}`);\n invariant(product.defaultPriceId, `Default price not found for product ${productId}`);\n return product.defaultPriceId;\n };\n\n getCreditAmount = (productId: string, priceId?: string): number => {\n const product = this.products.get(productId);\n invariant(product, `Product not found for ${productId}`);\n if (priceId) {\n const price = product.prices.get(priceId as PriceId);\n invariant(price, `Price not found for ${priceId}`);\n return price.credits;\n }\n\n invariant(product.defaultPriceId, `Default price not found for product ${productId}`);\n return product.prices.get(product.defaultPriceId)?.credits ?? 0;\n };\n\n private getCreditExpiresIn = (productId: string, priceId?: string): number => {\n const product = this.products.get(productId);\n invariant(product, `Product not found for ${productId}`);\n if (priceId) {\n const price = product.prices.get(priceId as PriceId);\n invariant(price, `Price not found for ${priceId}`);\n return ms(price.expiresIn);\n }\n\n invariant(product.defaultPriceId, `Default price not found for product ${productId}`);\n return ms(product.prices.get(product.defaultPriceId)?.expiresIn ?? '0');\n };\n\n getCreditExpiresAt = (productId: string, priceId?: string): string => {\n const expiresIn = this.getCreditExpiresIn(productId, priceId);\n return new Date(Date.now() + expiresIn).toISOString();\n };\n}\n"],"mappings":";;;AAMA,MAAM,YAAY,OAAO,WAAW;AAEpC,IAAM,UAAN,MAKE;CACA;CACA;CACA;CACA;CAEA;CAEA,YAAY,QAAkC,IAAY,OAAkB,MAAM;EAChF,KAAK,KAAK;EACV,KAAK,SAAS;EACd,KAAK,OAAO;EACZ,KAAK,yBAAS,IAAI,IAAI;EACtB,KAAK,iBAAiB;CACxB;CAEA,SACE,SACA,WAAqB;EAAE,SAAS;EAAG,WAAW;CAAI,MACnB;EAC/B,KAAK,OAAO,IAAI,SAAS,QAAQ;EACjC,OAAO;CACT;CAEA,WAAW,mBAAsB;EAC/B,KAAK,iBAAiB;EACtB,KAAK,OAAO,UAAU,CAAC,IAAa;EACpC,OAAO,KAAK;CACd;AACF;AAUA,IAAa,eAAb,MAAa,aAIX;CACA,2BAAqD,IAAI,IAAI;CAE7D;CACA;CACA;CACA;CACA;CAEA,IAAI,aAAuB;EACzB,OAAO,MAAM,KAAK,KAAK,SAAS,KAAK,CAAC;CACxC;CAEA,CAAC,cAAc,YAAiC;EAC9C,KAAK,SAAS,IAAI,QAAQ,IAAI,OAAO;EACrC,OAAO;CACT;CAEA,YAAoB,SAAkB;EACpC,KAAK,YAAY,QAAQ;EACzB,KAAK,YAAY,QAAQ;EACzB,KAAK,aAAa,QAAQ;EAC1B,KAAK,uBAAuB,QAAQ;EACpC,KAAK,sBAAsB,QAAQ;CACrC;CAEA,OAAO,UAA2D,YAAqB;EACrF,OAAO,IAAI,aAAqB,OAAO;CACzC;CAEA,WACE,WACA,OAAkB,SACf;EACH,OAAO,IAAI,QAAwB,MAAM,WAAW,IAAI;CAC1D;CAEA,WAAW,cAA0B;EACnC,MAAM,UAAU,KAAK,SAAS,IAAI,SAAS;EAC3C,UAAU,SAAS,yBAAyB,WAAW;EACvD,UAAU,QAAQ,MAAM,WAAW,UAAU,uBAAuB;EACpE,OAAO,QAAQ;CACjB;CAEA,WAAW,cAAkD;EAC3D,MAAM,UAAU,KAAK,SAAS,IAAI,SAAS;EAC3C,UAAU,SAAS,yBAAyB,WAAW;EACvD,OAAO,QAAQ,SAAS,OAAO,YAAY;CAC7C;CAEA,cAAc,cAA+B;EAC3C,MAAM,UAAU,KAAK,SAAS,IAAI,SAAS;EAC3C,UAAU,SAAS,yBAAyB,WAAW;EACvD,UAAU,QAAQ,gBAAgB,uCAAuC,WAAW;EACpF,OAAO,QAAQ;CACjB;CAEA,mBAAmB,WAAmB,YAA6B;EACjE,MAAM,UAAU,KAAK,SAAS,IAAI,SAAS;EAC3C,UAAU,SAAS,yBAAyB,WAAW;EACvD,IAAI,SAAS;GACX,MAAM,QAAQ,QAAQ,OAAO,IAAI,OAAkB;GACnD,UAAU,OAAO,uBAAuB,SAAS;GACjD,OAAO,MAAM;EACf;EAEA,UAAU,QAAQ,gBAAgB,uCAAuC,WAAW;EACpF,OAAO,QAAQ,OAAO,IAAI,QAAQ,cAAc,CAAC,EAAE,WAAW;CAChE;CAEA,sBAA8B,WAAmB,YAA6B;EAC5E,MAAM,UAAU,KAAK,SAAS,IAAI,SAAS;EAC3C,UAAU,SAAS,yBAAyB,WAAW;EACvD,IAAI,SAAS;GACX,MAAM,QAAQ,QAAQ,OAAO,IAAI,OAAkB;GACnD,UAAU,OAAO,uBAAuB,SAAS;GACjD,OAAO,GAAG,MAAM,SAAS;EAC3B;EAEA,UAAU,QAAQ,gBAAgB,uCAAuC,WAAW;EACpF,OAAO,GAAG,QAAQ,OAAO,IAAI,QAAQ,cAAc,CAAC,EAAE,aAAa,GAAG;CACxE;CAEA,sBAAsB,WAAmB,YAA6B;EACpE,MAAM,YAAY,KAAK,mBAAmB,WAAW,OAAO;EAC5D,OAAO,IAAI,KAAK,KAAK,IAAI,IAAI,SAAS,CAAC,CAAC,YAAY;CACtD;AACF"}
|
package/dist/stripe/handler.cjs
CHANGED
|
@@ -1,56 +1,28 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/stripe/handler.ts
|
|
3
|
+
var StripeEventHandler = class StripeEventHandler {
|
|
4
|
+
handlers;
|
|
5
|
+
constructor() {
|
|
6
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
7
|
+
}
|
|
8
|
+
static create() {
|
|
9
|
+
return new StripeEventHandler();
|
|
10
|
+
}
|
|
11
|
+
on = (type, handler) => {
|
|
12
|
+
if (!this.handlers.has(type)) this.handlers.set(type, []);
|
|
13
|
+
this.handlers.get(type)?.push(handler);
|
|
14
|
+
return this;
|
|
15
|
+
};
|
|
16
|
+
process = async (event) => {
|
|
17
|
+
const eventHandlers = this.handlers.get(event.type);
|
|
18
|
+
if (eventHandlers) await Promise.all(eventHandlers.map((handler) => handler(event.data.object)));
|
|
19
|
+
else {
|
|
20
|
+
console.error(`No stripe event handler found for event type: ${event.type}`);
|
|
21
|
+
throw new Error(`No stripe event handler found for event type: ${event.type}`);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
9
24
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.StripeEventHandler = StripeEventHandler;
|
|
19
27
|
|
|
20
|
-
// src/stripe/handler.ts
|
|
21
|
-
var handler_exports = {};
|
|
22
|
-
__export(handler_exports, {
|
|
23
|
-
StripeEventHandler: () => StripeEventHandler
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(handler_exports);
|
|
26
|
-
var StripeEventHandler = class _StripeEventHandler {
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
-
handlers;
|
|
29
|
-
constructor() {
|
|
30
|
-
this.handlers = /* @__PURE__ */ new Map();
|
|
31
|
-
}
|
|
32
|
-
static create() {
|
|
33
|
-
return new _StripeEventHandler();
|
|
34
|
-
}
|
|
35
|
-
on = (type, handler) => {
|
|
36
|
-
if (!this.handlers.has(type)) {
|
|
37
|
-
this.handlers.set(type, []);
|
|
38
|
-
}
|
|
39
|
-
this.handlers.get(type)?.push(handler);
|
|
40
|
-
return this;
|
|
41
|
-
};
|
|
42
|
-
process = async (event) => {
|
|
43
|
-
const eventHandlers = this.handlers.get(event.type);
|
|
44
|
-
if (eventHandlers) {
|
|
45
|
-
await Promise.all(eventHandlers.map((handler) => handler(event.data.object)));
|
|
46
|
-
} else {
|
|
47
|
-
console.error(`No stripe event handler found for event type: ${event.type}`);
|
|
48
|
-
throw new Error(`No stripe event handler found for event type: ${event.type}`);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
StripeEventHandler
|
|
55
|
-
});
|
|
56
28
|
//# sourceMappingURL=handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/stripe/handler.ts"],"sourcesContent":["import { type Stripe } from 'stripe';\n\ntype StripeEventObject<T extends Stripe.Event.Type> = Extract<\n Stripe.Event,\n { type: T }\n>['data']['object'];\n\ntype EventHandlerFn<T extends Stripe.Event.Type = Stripe.Event.Type> = (\n object: StripeEventObject<T>\n) => Promise<void>;\n\nexport class StripeEventHandler {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private readonly handlers: Map<Stripe.Event.Type, Array<EventHandlerFn<any>>>;\n\n private constructor() {\n this.handlers = new Map();\n }\n\n static create() {\n return new StripeEventHandler();\n }\n\n on = <T extends Stripe.Event.Type>(type: T, handler: EventHandlerFn<T>) => {\n if (!this.handlers.has(type)) {\n this.handlers.set(type, []);\n }\n\n this.handlers.get(type)?.push(handler);\n return this;\n };\n\n process = async (event: Stripe.Event): Promise<void> => {\n const eventHandlers = this.handlers.get(event.type);\n if (eventHandlers) {\n await Promise.all(eventHandlers.map((handler) => handler(event.data.object)));\n } else {\n console.error(`No stripe event handler found for event type: ${event.type}`);\n throw new Error(`No stripe event handler found for event type: ${event.type}`);\n }\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler.cjs","names":[],"sources":["../../src/stripe/handler.ts"],"sourcesContent":["import { type Stripe } from 'stripe';\n\ntype StripeEventObject<T extends Stripe.Event.Type> = Extract<\n Stripe.Event,\n { type: T }\n>['data']['object'];\n\ntype EventHandlerFn<T extends Stripe.Event.Type = Stripe.Event.Type> = (\n object: StripeEventObject<T>\n) => Promise<void>;\n\nexport class StripeEventHandler {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private readonly handlers: Map<Stripe.Event.Type, Array<EventHandlerFn<any>>>;\n\n private constructor() {\n this.handlers = new Map();\n }\n\n static create() {\n return new StripeEventHandler();\n }\n\n on = <T extends Stripe.Event.Type>(type: T, handler: EventHandlerFn<T>) => {\n if (!this.handlers.has(type)) {\n this.handlers.set(type, []);\n }\n\n this.handlers.get(type)?.push(handler);\n return this;\n };\n\n process = async (event: Stripe.Event): Promise<void> => {\n const eventHandlers = this.handlers.get(event.type);\n if (eventHandlers) {\n await Promise.all(eventHandlers.map((handler) => handler(event.data.object)));\n } else {\n console.error(`No stripe event handler found for event type: ${event.type}`);\n throw new Error(`No stripe event handler found for event type: ${event.type}`);\n }\n };\n}\n"],"mappings":";;AAWA,IAAa,qBAAb,MAAa,mBAAmB;CAE9B;CAEA,cAAsB;EACpB,KAAK,2BAAW,IAAI,IAAI;CAC1B;CAEA,OAAO,SAAS;EACd,OAAO,IAAI,mBAAmB;CAChC;CAEA,MAAmC,MAAS,YAA+B;EACzE,IAAI,CAAC,KAAK,SAAS,IAAI,IAAI,GACzB,KAAK,SAAS,IAAI,MAAM,CAAC,CAAC;EAG5B,KAAK,SAAS,IAAI,IAAI,CAAC,EAAE,KAAK,OAAO;EACrC,OAAO;CACT;CAEA,UAAU,OAAO,UAAuC;EACtD,MAAM,gBAAgB,KAAK,SAAS,IAAI,MAAM,IAAI;EAClD,IAAI,eACF,MAAM,QAAQ,IAAI,cAAc,KAAK,YAAY,QAAQ,MAAM,KAAK,MAAM,CAAC,CAAC;OACvE;GACL,QAAQ,MAAM,iDAAiD,MAAM,MAAM;GAC3E,MAAM,IAAI,MAAM,iDAAiD,MAAM,MAAM;EAC/E;CACF;AACF"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { Stripe } from
|
|
2
|
-
|
|
1
|
+
import { Stripe } from "stripe";
|
|
2
|
+
//#region src/stripe/handler.d.ts
|
|
3
3
|
type StripeEventObject<T extends Stripe.Event.Type> = Extract<Stripe.Event, {
|
|
4
|
-
|
|
4
|
+
type: T;
|
|
5
5
|
}>['data']['object'];
|
|
6
6
|
type EventHandlerFn<T extends Stripe.Event.Type = Stripe.Event.Type> = (object: StripeEventObject<T>) => Promise<void>;
|
|
7
7
|
declare class StripeEventHandler {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
private readonly handlers;
|
|
9
|
+
private constructor();
|
|
10
|
+
static create(): StripeEventHandler;
|
|
11
|
+
on: <T extends Stripe.Event.Type>(type: T, handler: EventHandlerFn<T>) => this;
|
|
12
|
+
process: (event: Stripe.Event) => Promise<void>;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
//#endregion
|
|
15
15
|
export { StripeEventHandler };
|
|
16
|
+
//# sourceMappingURL=handler.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.cts","names":[],"sources":["../../src/stripe/handler.ts"],"mappings":";;KAEK,kBAAkB,UAAU,OAAO,MAAM,QAAQ,QACpD,OAAO;EACL,MAAM;;KAGL,eAAe,UAAU,OAAO,MAAM,OAAO,OAAO,MAAM,SAC7D,QAAQ,kBAAkB,OACvB;cAEQ;mBAEM;UAEV;SAIA,UAAM;EAIb,KAAM,UAAU,OAAO,MAAM,MAAI,MAAQ,GAAC,SAAW,eAAe;EASpE,UAAO,OAAiB,OAAO,UAAQ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Stripe } from "stripe";
|
|
2
|
+
//#region src/stripe/handler.d.ts
|
|
3
|
+
type StripeEventObject<T extends Stripe.Event.Type> = Extract<Stripe.Event, {
|
|
4
|
+
type: T;
|
|
5
|
+
}>['data']['object'];
|
|
6
|
+
type EventHandlerFn<T extends Stripe.Event.Type = Stripe.Event.Type> = (object: StripeEventObject<T>) => Promise<void>;
|
|
7
|
+
declare class StripeEventHandler {
|
|
8
|
+
private readonly handlers;
|
|
9
|
+
private constructor();
|
|
10
|
+
static create(): StripeEventHandler;
|
|
11
|
+
on: <T extends Stripe.Event.Type>(type: T, handler: EventHandlerFn<T>) => this;
|
|
12
|
+
process: (event: Stripe.Event) => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { StripeEventHandler };
|
|
16
|
+
//# sourceMappingURL=handler.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.mts","names":[],"sources":["../../src/stripe/handler.ts"],"mappings":";;KAEK,kBAAkB,UAAU,OAAO,MAAM,QAAQ,QACpD,OAAO;EACL,MAAM;;KAGL,eAAe,UAAU,OAAO,MAAM,OAAO,OAAO,MAAM,SAC7D,QAAQ,kBAAkB,OACvB;cAEQ;mBAEM;UAEV;SAIA,UAAM;EAIb,KAAM,UAAU,OAAO,MAAM,MAAI,MAAQ,GAAC,SAAW,eAAe;EASpE,UAAO,OAAiB,OAAO,UAAQ"}
|
package/dist/stripe/handler.mjs
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
var StripeEventHandler = class
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
console.error(`No stripe event handler found for event type: ${event.type}`);
|
|
24
|
-
throw new Error(`No stripe event handler found for event type: ${event.type}`);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
StripeEventHandler
|
|
1
|
+
//#region src/stripe/handler.ts
|
|
2
|
+
var StripeEventHandler = class StripeEventHandler {
|
|
3
|
+
handlers;
|
|
4
|
+
constructor() {
|
|
5
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
6
|
+
}
|
|
7
|
+
static create() {
|
|
8
|
+
return new StripeEventHandler();
|
|
9
|
+
}
|
|
10
|
+
on = (type, handler) => {
|
|
11
|
+
if (!this.handlers.has(type)) this.handlers.set(type, []);
|
|
12
|
+
this.handlers.get(type)?.push(handler);
|
|
13
|
+
return this;
|
|
14
|
+
};
|
|
15
|
+
process = async (event) => {
|
|
16
|
+
const eventHandlers = this.handlers.get(event.type);
|
|
17
|
+
if (eventHandlers) await Promise.all(eventHandlers.map((handler) => handler(event.data.object)));
|
|
18
|
+
else {
|
|
19
|
+
console.error(`No stripe event handler found for event type: ${event.type}`);
|
|
20
|
+
throw new Error(`No stripe event handler found for event type: ${event.type}`);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
30
23
|
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { StripeEventHandler };
|
|
26
|
+
|
|
31
27
|
//# sourceMappingURL=handler.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/stripe/handler.ts"],"sourcesContent":["import { type Stripe } from 'stripe';\n\ntype StripeEventObject<T extends Stripe.Event.Type> = Extract<\n Stripe.Event,\n { type: T }\n>['data']['object'];\n\ntype EventHandlerFn<T extends Stripe.Event.Type = Stripe.Event.Type> = (\n object: StripeEventObject<T>\n) => Promise<void>;\n\nexport class StripeEventHandler {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private readonly handlers: Map<Stripe.Event.Type, Array<EventHandlerFn<any>>>;\n\n private constructor() {\n this.handlers = new Map();\n }\n\n static create() {\n return new StripeEventHandler();\n }\n\n on = <T extends Stripe.Event.Type>(type: T, handler: EventHandlerFn<T>) => {\n if (!this.handlers.has(type)) {\n this.handlers.set(type, []);\n }\n\n this.handlers.get(type)?.push(handler);\n return this;\n };\n\n process = async (event: Stripe.Event): Promise<void> => {\n const eventHandlers = this.handlers.get(event.type);\n if (eventHandlers) {\n await Promise.all(eventHandlers.map((handler) => handler(event.data.object)));\n } else {\n console.error(`No stripe event handler found for event type: ${event.type}`);\n throw new Error(`No stripe event handler found for event type: ${event.type}`);\n }\n };\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"handler.mjs","names":[],"sources":["../../src/stripe/handler.ts"],"sourcesContent":["import { type Stripe } from 'stripe';\n\ntype StripeEventObject<T extends Stripe.Event.Type> = Extract<\n Stripe.Event,\n { type: T }\n>['data']['object'];\n\ntype EventHandlerFn<T extends Stripe.Event.Type = Stripe.Event.Type> = (\n object: StripeEventObject<T>\n) => Promise<void>;\n\nexport class StripeEventHandler {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private readonly handlers: Map<Stripe.Event.Type, Array<EventHandlerFn<any>>>;\n\n private constructor() {\n this.handlers = new Map();\n }\n\n static create() {\n return new StripeEventHandler();\n }\n\n on = <T extends Stripe.Event.Type>(type: T, handler: EventHandlerFn<T>) => {\n if (!this.handlers.has(type)) {\n this.handlers.set(type, []);\n }\n\n this.handlers.get(type)?.push(handler);\n return this;\n };\n\n process = async (event: Stripe.Event): Promise<void> => {\n const eventHandlers = this.handlers.get(event.type);\n if (eventHandlers) {\n await Promise.all(eventHandlers.map((handler) => handler(event.data.object)));\n } else {\n console.error(`No stripe event handler found for event type: ${event.type}`);\n throw new Error(`No stripe event handler found for event type: ${event.type}`);\n }\n };\n}\n"],"mappings":";AAWA,IAAa,qBAAb,MAAa,mBAAmB;CAE9B;CAEA,cAAsB;EACpB,KAAK,2BAAW,IAAI,IAAI;CAC1B;CAEA,OAAO,SAAS;EACd,OAAO,IAAI,mBAAmB;CAChC;CAEA,MAAmC,MAAS,YAA+B;EACzE,IAAI,CAAC,KAAK,SAAS,IAAI,IAAI,GACzB,KAAK,SAAS,IAAI,MAAM,CAAC,CAAC;EAG5B,KAAK,SAAS,IAAI,IAAI,CAAC,EAAE,KAAK,OAAO;EACrC,OAAO;CACT;CAEA,UAAU,OAAO,UAAuC;EACtD,MAAM,gBAAgB,KAAK,SAAS,IAAI,MAAM,IAAI;EAClD,IAAI,eACF,MAAM,QAAQ,IAAI,cAAc,KAAK,YAAY,QAAQ,MAAM,KAAK,MAAM,CAAC,CAAC;OACvE;GACL,QAAQ,MAAM,iDAAiD,MAAM,MAAM;GAC3E,MAAM,IAAI,MAAM,iDAAiD,MAAM,MAAM;EAC/E;CACF;AACF"}
|
package/dist/stripe/index.cjs
CHANGED
|
@@ -1,74 +1,27 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
createCheckoutSessionSchema: () => import_schema.createCheckoutSessionSchema,
|
|
29
|
-
getBeginCheckoutProperties: () => import_mapper.getBeginCheckoutProperties,
|
|
30
|
-
getPendingCheckouts: () => import_pending_checkout.getPendingCheckouts,
|
|
31
|
-
getPurchaseProperties: () => import_mapper.getPurchaseProperties,
|
|
32
|
-
mapCharge: () => import_mapper.mapCharge,
|
|
33
|
-
mapCheckoutSession: () => import_mapper.mapCheckoutSession,
|
|
34
|
-
mapInvoice: () => import_mapper.mapInvoice,
|
|
35
|
-
mapLineItem: () => import_mapper.mapLineItem,
|
|
36
|
-
mapPaymentIntent: () => import_mapper.mapPaymentIntent,
|
|
37
|
-
mapPrice: () => import_mapper.mapPrice,
|
|
38
|
-
mapSubscriptionStatus: () => import_mapper.mapSubscriptionStatus,
|
|
39
|
-
mapTime: () => import_mapper.mapTime,
|
|
40
|
-
minorUnits: () => import_mapper.minorUnits,
|
|
41
|
-
price: () => import_mapper.price,
|
|
42
|
-
removePendingCheckout: () => import_pending_checkout.removePendingCheckout
|
|
43
|
-
});
|
|
44
|
-
module.exports = __toCommonJS(stripe_exports);
|
|
45
|
-
var import_mapper = require("./mapper.cjs");
|
|
46
|
-
var import_handler = require("./handler.cjs");
|
|
47
|
-
var import_schema = require("./schema.cjs");
|
|
48
|
-
var import_metadata = require("./metadata.cjs");
|
|
49
|
-
var import_config = require("./config.cjs");
|
|
50
|
-
var import_pending_checkout = require("./pending-checkout.cjs");
|
|
51
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
-
0 && (module.exports = {
|
|
53
|
-
METADATA_KEYS,
|
|
54
|
-
StripeConfig,
|
|
55
|
-
StripeEventHandler,
|
|
56
|
-
addPendingCheckout,
|
|
57
|
-
cancellationDetailsSchema,
|
|
58
|
-
createCheckoutSessionSchema,
|
|
59
|
-
getBeginCheckoutProperties,
|
|
60
|
-
getPendingCheckouts,
|
|
61
|
-
getPurchaseProperties,
|
|
62
|
-
mapCharge,
|
|
63
|
-
mapCheckoutSession,
|
|
64
|
-
mapInvoice,
|
|
65
|
-
mapLineItem,
|
|
66
|
-
mapPaymentIntent,
|
|
67
|
-
mapPrice,
|
|
68
|
-
mapSubscriptionStatus,
|
|
69
|
-
mapTime,
|
|
70
|
-
minorUnits,
|
|
71
|
-
price,
|
|
72
|
-
removePendingCheckout
|
|
73
|
-
});
|
|
74
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_stripe_config = require("./config.cjs");
|
|
3
|
+
const require_stripe_handler = require("./handler.cjs");
|
|
4
|
+
const require_stripe_mapper = require("./mapper.cjs");
|
|
5
|
+
const require_stripe_schema = require("./schema.cjs");
|
|
6
|
+
const require_stripe_metadata = require("./metadata.cjs");
|
|
7
|
+
const require_stripe_pending_checkout = require("./pending-checkout.cjs");
|
|
8
|
+
exports.METADATA_KEYS = require_stripe_metadata.METADATA_KEYS;
|
|
9
|
+
exports.StripeConfig = require_stripe_config.StripeConfig;
|
|
10
|
+
exports.StripeEventHandler = require_stripe_handler.StripeEventHandler;
|
|
11
|
+
exports.addPendingCheckout = require_stripe_pending_checkout.addPendingCheckout;
|
|
12
|
+
exports.cancellationDetailsSchema = require_stripe_schema.cancellationDetailsSchema;
|
|
13
|
+
exports.createCheckoutSessionSchema = require_stripe_schema.createCheckoutSessionSchema;
|
|
14
|
+
exports.getBeginCheckoutProperties = require_stripe_mapper.getBeginCheckoutProperties;
|
|
15
|
+
exports.getPendingCheckouts = require_stripe_pending_checkout.getPendingCheckouts;
|
|
16
|
+
exports.getPurchaseProperties = require_stripe_mapper.getPurchaseProperties;
|
|
17
|
+
exports.mapCharge = require_stripe_mapper.mapCharge;
|
|
18
|
+
exports.mapCheckoutSession = require_stripe_mapper.mapCheckoutSession;
|
|
19
|
+
exports.mapInvoice = require_stripe_mapper.mapInvoice;
|
|
20
|
+
exports.mapLineItem = require_stripe_mapper.mapLineItem;
|
|
21
|
+
exports.mapPaymentIntent = require_stripe_mapper.mapPaymentIntent;
|
|
22
|
+
exports.mapPrice = require_stripe_mapper.mapPrice;
|
|
23
|
+
exports.mapSubscriptionStatus = require_stripe_mapper.mapSubscriptionStatus;
|
|
24
|
+
exports.mapTime = require_stripe_mapper.mapTime;
|
|
25
|
+
exports.minorUnits = require_stripe_mapper.minorUnits;
|
|
26
|
+
exports.price = require_stripe_mapper.price;
|
|
27
|
+
exports.removePendingCheckout = require_stripe_pending_checkout.removePendingCheckout;
|
package/dist/stripe/index.d.cts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import 'zod/v4/core';
|
|
10
|
-
import 'zod/mini';
|
|
11
|
-
import '../types.cjs';
|
|
12
|
-
import 'ms';
|
|
1
|
+
import { PriceId, StripeConfig } from "./config.cjs";
|
|
2
|
+
import { StripeEventHandler } from "./handler.cjs";
|
|
3
|
+
import { BeginCheckoutProperties, CheckoutSession, PaymentStatus, Price, ProductPrice, PurchaseProperties, getBeginCheckoutProperties, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price } from "./mapper.cjs";
|
|
4
|
+
import { CancellationDetails, CreateCheckoutSessionDTO, cancellationDetailsSchema, createCheckoutSessionSchema } from "./schema.cjs";
|
|
5
|
+
import { METADATA_KEYS } from "./metadata.cjs";
|
|
6
|
+
import { addPendingCheckout, getPendingCheckouts, removePendingCheckout } from "./pending-checkout.cjs";
|
|
7
|
+
import { Stripe } from "stripe";
|
|
8
|
+
export { type BeginCheckoutProperties, type CancellationDetails, type CheckoutSession, type CreateCheckoutSessionDTO, METADATA_KEYS, type PaymentStatus, type Price, type PriceId, type ProductPrice, type PurchaseProperties, type Stripe, StripeConfig, StripeEventHandler, addPendingCheckout, cancellationDetailsSchema, createCheckoutSessionSchema, getBeginCheckoutProperties, getPendingCheckouts, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price, removePendingCheckout };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PriceId, StripeConfig } from "./config.mjs";
|
|
2
|
+
import { StripeEventHandler } from "./handler.mjs";
|
|
3
|
+
import { BeginCheckoutProperties, CheckoutSession, PaymentStatus, Price, ProductPrice, PurchaseProperties, getBeginCheckoutProperties, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price } from "./mapper.mjs";
|
|
4
|
+
import { CancellationDetails, CreateCheckoutSessionDTO, cancellationDetailsSchema, createCheckoutSessionSchema } from "./schema.mjs";
|
|
5
|
+
import { METADATA_KEYS } from "./metadata.mjs";
|
|
6
|
+
import { addPendingCheckout, getPendingCheckouts, removePendingCheckout } from "./pending-checkout.mjs";
|
|
7
|
+
import { Stripe } from "stripe";
|
|
8
|
+
export { type BeginCheckoutProperties, type CancellationDetails, type CheckoutSession, type CreateCheckoutSessionDTO, METADATA_KEYS, type PaymentStatus, type Price, type PriceId, type ProductPrice, type PurchaseProperties, type Stripe, StripeConfig, StripeEventHandler, addPendingCheckout, cancellationDetailsSchema, createCheckoutSessionSchema, getBeginCheckoutProperties, getPendingCheckouts, getPurchaseProperties, mapCharge, mapCheckoutSession, mapInvoice, mapLineItem, mapPaymentIntent, mapPrice, mapSubscriptionStatus, mapTime, minorUnits, price, removePendingCheckout };
|