@ai-billing/nextjs 0.0.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/LICENSE +201 -0
- package/README.md +50 -0
- package/dist/index.cjs +36 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/polar/CreditTopUpPolar.cjs +278 -0
- package/dist/polar/CreditTopUpPolar.cjs.map +1 -0
- package/dist/polar/CreditTopUpPolar.d.cts +9 -0
- package/dist/polar/CreditTopUpPolar.d.ts +9 -0
- package/dist/polar/CreditTopUpPolar.js +244 -0
- package/dist/polar/CreditTopUpPolar.js.map +1 -0
- package/dist/polar/CreditUsagePolar.cjs +133 -0
- package/dist/polar/CreditUsagePolar.cjs.map +1 -0
- package/dist/polar/CreditUsagePolar.d.cts +10 -0
- package/dist/polar/CreditUsagePolar.d.ts +10 -0
- package/dist/polar/CreditUsagePolar.js +107 -0
- package/dist/polar/CreditUsagePolar.js.map +1 -0
- package/dist/polar/createCheckout.cjs +47 -0
- package/dist/polar/createCheckout.cjs.map +1 -0
- package/dist/polar/createCheckout.d.cts +9 -0
- package/dist/polar/createCheckout.d.ts +9 -0
- package/dist/polar/createCheckout.js +23 -0
- package/dist/polar/createCheckout.js.map +1 -0
- package/dist/polar/fetchPolarConfig.cjs +52 -0
- package/dist/polar/fetchPolarConfig.cjs.map +1 -0
- package/dist/polar/fetchPolarConfig.d.cts +6 -0
- package/dist/polar/fetchPolarConfig.d.ts +6 -0
- package/dist/polar/fetchPolarConfig.js +28 -0
- package/dist/polar/fetchPolarConfig.js.map +1 -0
- package/dist/polar/fetchPolarUsage.cjs +64 -0
- package/dist/polar/fetchPolarUsage.cjs.map +1 -0
- package/dist/polar/fetchPolarUsage.d.cts +9 -0
- package/dist/polar/fetchPolarUsage.d.ts +9 -0
- package/dist/polar/fetchPolarUsage.js +40 -0
- package/dist/polar/fetchPolarUsage.js.map +1 -0
- package/dist/polar/fetchTopUpConfig.cjs +55 -0
- package/dist/polar/fetchTopUpConfig.cjs.map +1 -0
- package/dist/polar/fetchTopUpConfig.d.cts +10 -0
- package/dist/polar/fetchTopUpConfig.d.ts +10 -0
- package/dist/polar/fetchTopUpConfig.js +31 -0
- package/dist/polar/fetchTopUpConfig.js.map +1 -0
- package/dist/polar/types.cjs +17 -0
- package/dist/polar/types.cjs.map +1 -0
- package/dist/polar/types.d.cts +18 -0
- package/dist/polar/types.d.ts +18 -0
- package/dist/polar/types.js +1 -0
- package/dist/polar/types.js.map +1 -0
- package/dist/server.cjs +44 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +8 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.js +15 -0
- package/dist/server.js.map +1 -0
- package/dist/stripe/CreditUsageStripe.cjs +158 -0
- package/dist/stripe/CreditUsageStripe.cjs.map +1 -0
- package/dist/stripe/CreditUsageStripe.d.cts +11 -0
- package/dist/stripe/CreditUsageStripe.d.ts +11 -0
- package/dist/stripe/CreditUsageStripe.js +132 -0
- package/dist/stripe/CreditUsageStripe.js.map +1 -0
- package/dist/stripe/fetchStripeConfig.cjs +52 -0
- package/dist/stripe/fetchStripeConfig.cjs.map +1 -0
- package/dist/stripe/fetchStripeConfig.d.cts +6 -0
- package/dist/stripe/fetchStripeConfig.d.ts +6 -0
- package/dist/stripe/fetchStripeConfig.js +28 -0
- package/dist/stripe/fetchStripeConfig.js.map +1 -0
- package/dist/stripe/fetchStripeUsage.cjs +67 -0
- package/dist/stripe/fetchStripeUsage.cjs.map +1 -0
- package/dist/stripe/fetchStripeUsage.d.cts +9 -0
- package/dist/stripe/fetchStripeUsage.d.ts +9 -0
- package/dist/stripe/fetchStripeUsage.js +33 -0
- package/dist/stripe/fetchStripeUsage.js.map +1 -0
- package/dist/stripe/types.cjs +17 -0
- package/dist/stripe/types.cjs.map +1 -0
- package/dist/stripe/types.d.cts +9 -0
- package/dist/stripe/types.d.ts +9 -0
- package/dist/stripe/types.js +1 -0
- package/dist/stripe/types.js.map +1 -0
- package/dist/styles.cjs +83 -0
- package/dist/styles.cjs.map +1 -0
- package/dist/styles.d.cts +11 -0
- package/dist/styles.d.ts +11 -0
- package/dist/styles.js +53 -0
- package/dist/styles.js.map +1 -0
- package/dist/utils.cjs +53 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +20 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.js +26 -0
- package/dist/utils.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polar/createCheckout.ts"],"sourcesContent":["'use server';\n\nimport { Polar } from '@polar-sh/sdk';\n\n/**\n * Creates a Polar checkout session and returns the URL.\n * @param productId - the Polar product ID\n * @param userId - the external customer ID\n * @param origin - the application origin for the success URL\n */\nexport async function createCheckout(\n productId: string,\n userId: string,\n origin: string,\n) {\n const polar = new Polar({\n accessToken: process.env.POLAR_ACCESS_TOKEN,\n server: (process.env.POLAR_SERVER as 'sandbox' | 'production') ?? 'sandbox',\n });\n\n try {\n const checkout = await polar.checkouts.create({\n products: [productId],\n externalCustomerId: userId,\n successUrl: `${origin}/usage`,\n });\n return checkout.url;\n } catch (error) {\n console.error('Create checkout failed:', error);\n throw new Error('Failed to create checkout', { cause: error });\n }\n}\n"],"mappings":";AAEA,SAAS,aAAa;AAQtB,eAAsB,eACpB,WACA,QACA,QACA;AACA,QAAM,QAAQ,IAAI,MAAM;AAAA,IACtB,aAAa,QAAQ,IAAI;AAAA,IACzB,QAAS,QAAQ,IAAI,gBAA6C;AAAA,EACpE,CAAC;AAED,MAAI;AACF,UAAM,WAAW,MAAM,MAAM,UAAU,OAAO;AAAA,MAC5C,UAAU,CAAC,SAAS;AAAA,MACpB,oBAAoB;AAAA,MACpB,YAAY,GAAG,MAAM;AAAA,IACvB,CAAC;AACD,WAAO,SAAS;AAAA,EAClB,SAAS,OAAO;AACd,YAAQ,MAAM,2BAA2B,KAAK;AAC9C,UAAM,IAAI,MAAM,6BAA6B,EAAE,OAAO,MAAM,CAAC;AAAA,EAC/D;AACF;","names":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use server";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var fetchPolarConfig_exports = {};
|
|
21
|
+
__export(fetchPolarConfig_exports, {
|
|
22
|
+
fetchPolarConfig: () => fetchPolarConfig
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(fetchPolarConfig_exports);
|
|
25
|
+
async function fetchPolarConfig() {
|
|
26
|
+
try {
|
|
27
|
+
const key = process.env.NAREV_API_KEY;
|
|
28
|
+
if (!key) {
|
|
29
|
+
console.error("fetchPolarConfig: NAREV_API_KEY is not set");
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const res = await fetch("https://www.narev.ai/api/billing-target/polar", {
|
|
33
|
+
headers: { Authorization: `Bearer ${key}` }
|
|
34
|
+
});
|
|
35
|
+
if (!res.ok) {
|
|
36
|
+
console.error(
|
|
37
|
+
`fetchPolarConfig: Narev returned ${res.status} ${res.statusText}`
|
|
38
|
+
);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const json = await res.json();
|
|
42
|
+
return json.data;
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error("fetchPolarConfig:", error);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
fetchPolarConfig
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=fetchPolarConfig.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polar/fetchPolarConfig.ts"],"sourcesContent":["'use server';\n\nimport type { NarevPolarConfig } from './types.js';\n\n/** Fetches Polar billing configuration from the Narev API */\nexport async function fetchPolarConfig(): Promise<NarevPolarConfig | null> {\n try {\n const key = process.env.NAREV_API_KEY;\n if (!key) {\n console.error('fetchPolarConfig: NAREV_API_KEY is not set');\n return null;\n }\n\n const res = await fetch('https://www.narev.ai/api/billing-target/polar', {\n headers: { Authorization: `Bearer ${key}` },\n });\n if (!res.ok) {\n console.error(\n `fetchPolarConfig: Narev returned ${res.status} ${res.statusText}`,\n );\n return null;\n }\n const json = await res.json();\n return json.data as NarevPolarConfig;\n } catch (error) {\n console.error('fetchPolarConfig:', error);\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,eAAsB,mBAAqD;AACzE,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,CAAC,KAAK;AACR,cAAQ,MAAM,4CAA4C;AAC1D,aAAO;AAAA,IACT;AAEA,UAAM,MAAM,MAAM,MAAM,iDAAiD;AAAA,MACvE,SAAS,EAAE,eAAe,UAAU,GAAG,GAAG;AAAA,IAC5C,CAAC;AACD,QAAI,CAAC,IAAI,IAAI;AACX,cAAQ;AAAA,QACN,oCAAoC,IAAI,MAAM,IAAI,IAAI,UAAU;AAAA,MAClE;AACA,aAAO;AAAA,IACT;AACA,UAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,WAAO,KAAK;AAAA,EACd,SAAS,OAAO;AACd,YAAQ,MAAM,qBAAqB,KAAK;AACxC,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
async function fetchPolarConfig() {
|
|
3
|
+
try {
|
|
4
|
+
const key = process.env.NAREV_API_KEY;
|
|
5
|
+
if (!key) {
|
|
6
|
+
console.error("fetchPolarConfig: NAREV_API_KEY is not set");
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const res = await fetch("https://www.narev.ai/api/billing-target/polar", {
|
|
10
|
+
headers: { Authorization: `Bearer ${key}` }
|
|
11
|
+
});
|
|
12
|
+
if (!res.ok) {
|
|
13
|
+
console.error(
|
|
14
|
+
`fetchPolarConfig: Narev returned ${res.status} ${res.statusText}`
|
|
15
|
+
);
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const json = await res.json();
|
|
19
|
+
return json.data;
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.error("fetchPolarConfig:", error);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
fetchPolarConfig
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=fetchPolarConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polar/fetchPolarConfig.ts"],"sourcesContent":["'use server';\n\nimport type { NarevPolarConfig } from './types.js';\n\n/** Fetches Polar billing configuration from the Narev API */\nexport async function fetchPolarConfig(): Promise<NarevPolarConfig | null> {\n try {\n const key = process.env.NAREV_API_KEY;\n if (!key) {\n console.error('fetchPolarConfig: NAREV_API_KEY is not set');\n return null;\n }\n\n const res = await fetch('https://www.narev.ai/api/billing-target/polar', {\n headers: { Authorization: `Bearer ${key}` },\n });\n if (!res.ok) {\n console.error(\n `fetchPolarConfig: Narev returned ${res.status} ${res.statusText}`,\n );\n return null;\n }\n const json = await res.json();\n return json.data as NarevPolarConfig;\n } catch (error) {\n console.error('fetchPolarConfig:', error);\n return null;\n }\n}\n"],"mappings":";AAKA,eAAsB,mBAAqD;AACzE,MAAI;AACF,UAAM,MAAM,QAAQ,IAAI;AACxB,QAAI,CAAC,KAAK;AACR,cAAQ,MAAM,4CAA4C;AAC1D,aAAO;AAAA,IACT;AAEA,UAAM,MAAM,MAAM,MAAM,iDAAiD;AAAA,MACvE,SAAS,EAAE,eAAe,UAAU,GAAG,GAAG;AAAA,IAC5C,CAAC;AACD,QAAI,CAAC,IAAI,IAAI;AACX,cAAQ;AAAA,QACN,oCAAoC,IAAI,MAAM,IAAI,IAAI,UAAU;AAAA,MAClE;AACA,aAAO;AAAA,IACT;AACA,UAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,WAAO,KAAK;AAAA,EACd,SAAS,OAAO;AACd,YAAQ,MAAM,qBAAqB,KAAK;AACxC,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use server";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var fetchPolarUsage_exports = {};
|
|
21
|
+
__export(fetchPolarUsage_exports, {
|
|
22
|
+
fetchPolarUsage: () => fetchPolarUsage
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(fetchPolarUsage_exports);
|
|
25
|
+
var import_sdk = require("@polar-sh/sdk");
|
|
26
|
+
var import_fetchPolarConfig = require("./fetchPolarConfig.js");
|
|
27
|
+
async function fetchPolarUsage(userId) {
|
|
28
|
+
const empty = {
|
|
29
|
+
consumedUnits: 0,
|
|
30
|
+
creditedUnits: 0,
|
|
31
|
+
meterName: "Usage",
|
|
32
|
+
found: false
|
|
33
|
+
};
|
|
34
|
+
const config = await (0, import_fetchPolarConfig.fetchPolarConfig)();
|
|
35
|
+
if (!config || !config.meterId) return empty;
|
|
36
|
+
const polar = new import_sdk.Polar({
|
|
37
|
+
accessToken: process.env.POLAR_ACCESS_TOKEN,
|
|
38
|
+
server: config.environment
|
|
39
|
+
});
|
|
40
|
+
try {
|
|
41
|
+
const page = await polar.customerMeters.list({
|
|
42
|
+
externalCustomerId: userId,
|
|
43
|
+
meterId: config.meterId,
|
|
44
|
+
limit: 1
|
|
45
|
+
});
|
|
46
|
+
const item = page.result.items[0];
|
|
47
|
+
if (item) {
|
|
48
|
+
return {
|
|
49
|
+
consumedUnits: item.consumedUnits,
|
|
50
|
+
creditedUnits: item.creditedUnits,
|
|
51
|
+
meterName: item.meter.name,
|
|
52
|
+
found: true
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error("fetchPolarUsage:", error);
|
|
57
|
+
}
|
|
58
|
+
return empty;
|
|
59
|
+
}
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
fetchPolarUsage
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=fetchPolarUsage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polar/fetchPolarUsage.ts"],"sourcesContent":["'use server';\n\nimport { Polar } from '@polar-sh/sdk';\nimport { fetchPolarConfig } from './fetchPolarConfig.js';\nimport type { PolarUsageData } from './types.js';\n\n/**\n * Fetches usage data from Polar for a given customer meter.\n * @param userId - the external customer ID in Polar\n */\nexport async function fetchPolarUsage(userId: string): Promise<PolarUsageData> {\n const empty = {\n consumedUnits: 0,\n creditedUnits: 0,\n meterName: 'Usage',\n found: false,\n };\n\n const config = await fetchPolarConfig();\n if (!config || !config.meterId) return empty;\n\n const polar = new Polar({\n accessToken: process.env.POLAR_ACCESS_TOKEN,\n server: config.environment,\n });\n\n try {\n const page = await polar.customerMeters.list({\n externalCustomerId: userId,\n meterId: config.meterId,\n limit: 1,\n });\n const item = page.result.items[0];\n if (item) {\n return {\n consumedUnits: item.consumedUnits,\n creditedUnits: item.creditedUnits,\n meterName: item.meter.name,\n found: true,\n };\n }\n } catch (error) {\n console.error('fetchPolarUsage:', error);\n }\n\n return empty;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAsB;AACtB,8BAAiC;AAOjC,eAAsB,gBAAgB,QAAyC;AAC7E,QAAM,QAAQ;AAAA,IACZ,eAAe;AAAA,IACf,eAAe;AAAA,IACf,WAAW;AAAA,IACX,OAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAM,0CAAiB;AACtC,MAAI,CAAC,UAAU,CAAC,OAAO,QAAS,QAAO;AAEvC,QAAM,QAAQ,IAAI,iBAAM;AAAA,IACtB,aAAa,QAAQ,IAAI;AAAA,IACzB,QAAQ,OAAO;AAAA,EACjB,CAAC;AAED,MAAI;AACF,UAAM,OAAO,MAAM,MAAM,eAAe,KAAK;AAAA,MAC3C,oBAAoB;AAAA,MACpB,SAAS,OAAO;AAAA,MAChB,OAAO;AAAA,IACT,CAAC;AACD,UAAM,OAAO,KAAK,OAAO,MAAM,CAAC;AAChC,QAAI,MAAM;AACR,aAAO;AAAA,QACL,eAAe,KAAK;AAAA,QACpB,eAAe,KAAK;AAAA,QACpB,WAAW,KAAK,MAAM;AAAA,QACtB,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,oBAAoB,KAAK;AAAA,EACzC;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PolarUsageData } from './types.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fetches usage data from Polar for a given customer meter.
|
|
5
|
+
* @param userId - the external customer ID in Polar
|
|
6
|
+
*/
|
|
7
|
+
declare function fetchPolarUsage(userId: string): Promise<PolarUsageData>;
|
|
8
|
+
|
|
9
|
+
export { fetchPolarUsage };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PolarUsageData } from './types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fetches usage data from Polar for a given customer meter.
|
|
5
|
+
* @param userId - the external customer ID in Polar
|
|
6
|
+
*/
|
|
7
|
+
declare function fetchPolarUsage(userId: string): Promise<PolarUsageData>;
|
|
8
|
+
|
|
9
|
+
export { fetchPolarUsage };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { Polar } from "@polar-sh/sdk";
|
|
3
|
+
import { fetchPolarConfig } from "./fetchPolarConfig.js";
|
|
4
|
+
async function fetchPolarUsage(userId) {
|
|
5
|
+
const empty = {
|
|
6
|
+
consumedUnits: 0,
|
|
7
|
+
creditedUnits: 0,
|
|
8
|
+
meterName: "Usage",
|
|
9
|
+
found: false
|
|
10
|
+
};
|
|
11
|
+
const config = await fetchPolarConfig();
|
|
12
|
+
if (!config || !config.meterId) return empty;
|
|
13
|
+
const polar = new Polar({
|
|
14
|
+
accessToken: process.env.POLAR_ACCESS_TOKEN,
|
|
15
|
+
server: config.environment
|
|
16
|
+
});
|
|
17
|
+
try {
|
|
18
|
+
const page = await polar.customerMeters.list({
|
|
19
|
+
externalCustomerId: userId,
|
|
20
|
+
meterId: config.meterId,
|
|
21
|
+
limit: 1
|
|
22
|
+
});
|
|
23
|
+
const item = page.result.items[0];
|
|
24
|
+
if (item) {
|
|
25
|
+
return {
|
|
26
|
+
consumedUnits: item.consumedUnits,
|
|
27
|
+
creditedUnits: item.creditedUnits,
|
|
28
|
+
meterName: item.meter.name,
|
|
29
|
+
found: true
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error("fetchPolarUsage:", error);
|
|
34
|
+
}
|
|
35
|
+
return empty;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
fetchPolarUsage
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=fetchPolarUsage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polar/fetchPolarUsage.ts"],"sourcesContent":["'use server';\n\nimport { Polar } from '@polar-sh/sdk';\nimport { fetchPolarConfig } from './fetchPolarConfig.js';\nimport type { PolarUsageData } from './types.js';\n\n/**\n * Fetches usage data from Polar for a given customer meter.\n * @param userId - the external customer ID in Polar\n */\nexport async function fetchPolarUsage(userId: string): Promise<PolarUsageData> {\n const empty = {\n consumedUnits: 0,\n creditedUnits: 0,\n meterName: 'Usage',\n found: false,\n };\n\n const config = await fetchPolarConfig();\n if (!config || !config.meterId) return empty;\n\n const polar = new Polar({\n accessToken: process.env.POLAR_ACCESS_TOKEN,\n server: config.environment,\n });\n\n try {\n const page = await polar.customerMeters.list({\n externalCustomerId: userId,\n meterId: config.meterId,\n limit: 1,\n });\n const item = page.result.items[0];\n if (item) {\n return {\n consumedUnits: item.consumedUnits,\n creditedUnits: item.creditedUnits,\n meterName: item.meter.name,\n found: true,\n };\n }\n } catch (error) {\n console.error('fetchPolarUsage:', error);\n }\n\n return empty;\n}\n"],"mappings":";AAEA,SAAS,aAAa;AACtB,SAAS,wBAAwB;AAOjC,eAAsB,gBAAgB,QAAyC;AAC7E,QAAM,QAAQ;AAAA,IACZ,eAAe;AAAA,IACf,eAAe;AAAA,IACf,WAAW;AAAA,IACX,OAAO;AAAA,EACT;AAEA,QAAM,SAAS,MAAM,iBAAiB;AACtC,MAAI,CAAC,UAAU,CAAC,OAAO,QAAS,QAAO;AAEvC,QAAM,QAAQ,IAAI,MAAM;AAAA,IACtB,aAAa,QAAQ,IAAI;AAAA,IACzB,QAAQ,OAAO;AAAA,EACjB,CAAC;AAED,MAAI;AACF,UAAM,OAAO,MAAM,MAAM,eAAe,KAAK;AAAA,MAC3C,oBAAoB;AAAA,MACpB,SAAS,OAAO;AAAA,MAChB,OAAO;AAAA,IACT,CAAC;AACD,UAAM,OAAO,KAAK,OAAO,MAAM,CAAC;AAChC,QAAI,MAAM;AACR,aAAO;AAAA,QACL,eAAe,KAAK;AAAA,QACpB,eAAe,KAAK;AAAA,QACpB,WAAW,KAAK,MAAM;AAAA,QACtB,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,SAAS,OAAO;AACd,YAAQ,MAAM,oBAAoB,KAAK;AAAA,EACzC;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use server";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var fetchTopUpConfig_exports = {};
|
|
21
|
+
__export(fetchTopUpConfig_exports, {
|
|
22
|
+
fetchTopUpConfig: () => fetchTopUpConfig
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(fetchTopUpConfig_exports);
|
|
25
|
+
var import_sdk = require("@polar-sh/sdk");
|
|
26
|
+
var import_fetchPolarConfig = require("./fetchPolarConfig.js");
|
|
27
|
+
async function fetchTopUpConfig() {
|
|
28
|
+
const config = { packages: [] };
|
|
29
|
+
try {
|
|
30
|
+
const polarConfig = await (0, import_fetchPolarConfig.fetchPolarConfig)();
|
|
31
|
+
if (!polarConfig) return config;
|
|
32
|
+
config.packages = polarConfig.topup ?? [];
|
|
33
|
+
const env = polarConfig.environment ?? "sandbox";
|
|
34
|
+
try {
|
|
35
|
+
const polar = new import_sdk.Polar({
|
|
36
|
+
accessToken: process.env.POLAR_ACCESS_TOKEN,
|
|
37
|
+
server: env
|
|
38
|
+
});
|
|
39
|
+
const orgs = await polar.organizations.list({ limit: 1 });
|
|
40
|
+
const org = orgs.result?.items?.[0];
|
|
41
|
+
const tb = org?.defaultTaxBehavior;
|
|
42
|
+
if (tb === "inclusive" || tb === "exclusive" || tb === "location") {
|
|
43
|
+
config.taxBehavior = tb;
|
|
44
|
+
}
|
|
45
|
+
} catch {
|
|
46
|
+
}
|
|
47
|
+
} catch {
|
|
48
|
+
}
|
|
49
|
+
return config;
|
|
50
|
+
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
fetchTopUpConfig
|
|
54
|
+
});
|
|
55
|
+
//# sourceMappingURL=fetchTopUpConfig.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polar/fetchTopUpConfig.ts"],"sourcesContent":["'use server';\n\nimport { Polar } from '@polar-sh/sdk';\nimport { fetchPolarConfig } from './fetchPolarConfig.js';\nimport type { CreditPackage } from './types.js';\n\ninterface TopUpConfig {\n packages: CreditPackage[];\n taxBehavior?: 'inclusive' | 'exclusive' | 'location';\n}\n\n/** Fetches available top-up packages and optional tax behavior from Polar */\nexport async function fetchTopUpConfig(): Promise<TopUpConfig> {\n const config: TopUpConfig = { packages: [] };\n\n try {\n const polarConfig = await fetchPolarConfig();\n if (!polarConfig) return config;\n\n config.packages = polarConfig.topup ?? [];\n\n const env = polarConfig.environment ?? 'sandbox';\n try {\n const polar = new Polar({\n accessToken: process.env.POLAR_ACCESS_TOKEN,\n server: env,\n });\n const orgs = await polar.organizations.list({ limit: 1 });\n const org = orgs.result?.items?.[0];\n const tb = org?.defaultTaxBehavior;\n if (tb === 'inclusive' || tb === 'exclusive' || tb === 'location') {\n config.taxBehavior = tb as typeof config.taxBehavior;\n }\n } catch {\n /* no tax */\n }\n } catch {\n /* no config */\n }\n\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAsB;AACtB,8BAAiC;AASjC,eAAsB,mBAAyC;AAC7D,QAAM,SAAsB,EAAE,UAAU,CAAC,EAAE;AAE3C,MAAI;AACF,UAAM,cAAc,UAAM,0CAAiB;AAC3C,QAAI,CAAC,YAAa,QAAO;AAEzB,WAAO,WAAW,YAAY,SAAS,CAAC;AAExC,UAAM,MAAM,YAAY,eAAe;AACvC,QAAI;AACF,YAAM,QAAQ,IAAI,iBAAM;AAAA,QACtB,aAAa,QAAQ,IAAI;AAAA,QACzB,QAAQ;AAAA,MACV,CAAC;AACD,YAAM,OAAO,MAAM,MAAM,cAAc,KAAK,EAAE,OAAO,EAAE,CAAC;AACxD,YAAM,MAAM,KAAK,QAAQ,QAAQ,CAAC;AAClC,YAAM,KAAK,KAAK;AAChB,UAAI,OAAO,eAAe,OAAO,eAAe,OAAO,YAAY;AACjE,eAAO,cAAc;AAAA,MACvB;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACF,QAAQ;AAAA,EAER;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CreditPackage } from './types.cjs';
|
|
2
|
+
|
|
3
|
+
interface TopUpConfig {
|
|
4
|
+
packages: CreditPackage[];
|
|
5
|
+
taxBehavior?: 'inclusive' | 'exclusive' | 'location';
|
|
6
|
+
}
|
|
7
|
+
/** Fetches available top-up packages and optional tax behavior from Polar */
|
|
8
|
+
declare function fetchTopUpConfig(): Promise<TopUpConfig>;
|
|
9
|
+
|
|
10
|
+
export { fetchTopUpConfig };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CreditPackage } from './types.js';
|
|
2
|
+
|
|
3
|
+
interface TopUpConfig {
|
|
4
|
+
packages: CreditPackage[];
|
|
5
|
+
taxBehavior?: 'inclusive' | 'exclusive' | 'location';
|
|
6
|
+
}
|
|
7
|
+
/** Fetches available top-up packages and optional tax behavior from Polar */
|
|
8
|
+
declare function fetchTopUpConfig(): Promise<TopUpConfig>;
|
|
9
|
+
|
|
10
|
+
export { fetchTopUpConfig };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use server";
|
|
2
|
+
import { Polar } from "@polar-sh/sdk";
|
|
3
|
+
import { fetchPolarConfig } from "./fetchPolarConfig.js";
|
|
4
|
+
async function fetchTopUpConfig() {
|
|
5
|
+
const config = { packages: [] };
|
|
6
|
+
try {
|
|
7
|
+
const polarConfig = await fetchPolarConfig();
|
|
8
|
+
if (!polarConfig) return config;
|
|
9
|
+
config.packages = polarConfig.topup ?? [];
|
|
10
|
+
const env = polarConfig.environment ?? "sandbox";
|
|
11
|
+
try {
|
|
12
|
+
const polar = new Polar({
|
|
13
|
+
accessToken: process.env.POLAR_ACCESS_TOKEN,
|
|
14
|
+
server: env
|
|
15
|
+
});
|
|
16
|
+
const orgs = await polar.organizations.list({ limit: 1 });
|
|
17
|
+
const org = orgs.result?.items?.[0];
|
|
18
|
+
const tb = org?.defaultTaxBehavior;
|
|
19
|
+
if (tb === "inclusive" || tb === "exclusive" || tb === "location") {
|
|
20
|
+
config.taxBehavior = tb;
|
|
21
|
+
}
|
|
22
|
+
} catch {
|
|
23
|
+
}
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
return config;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
fetchTopUpConfig
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=fetchTopUpConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polar/fetchTopUpConfig.ts"],"sourcesContent":["'use server';\n\nimport { Polar } from '@polar-sh/sdk';\nimport { fetchPolarConfig } from './fetchPolarConfig.js';\nimport type { CreditPackage } from './types.js';\n\ninterface TopUpConfig {\n packages: CreditPackage[];\n taxBehavior?: 'inclusive' | 'exclusive' | 'location';\n}\n\n/** Fetches available top-up packages and optional tax behavior from Polar */\nexport async function fetchTopUpConfig(): Promise<TopUpConfig> {\n const config: TopUpConfig = { packages: [] };\n\n try {\n const polarConfig = await fetchPolarConfig();\n if (!polarConfig) return config;\n\n config.packages = polarConfig.topup ?? [];\n\n const env = polarConfig.environment ?? 'sandbox';\n try {\n const polar = new Polar({\n accessToken: process.env.POLAR_ACCESS_TOKEN,\n server: env,\n });\n const orgs = await polar.organizations.list({ limit: 1 });\n const org = orgs.result?.items?.[0];\n const tb = org?.defaultTaxBehavior;\n if (tb === 'inclusive' || tb === 'exclusive' || tb === 'location') {\n config.taxBehavior = tb as typeof config.taxBehavior;\n }\n } catch {\n /* no tax */\n }\n } catch {\n /* no config */\n }\n\n return config;\n}\n"],"mappings":";AAEA,SAAS,aAAa;AACtB,SAAS,wBAAwB;AASjC,eAAsB,mBAAyC;AAC7D,QAAM,SAAsB,EAAE,UAAU,CAAC,EAAE;AAE3C,MAAI;AACF,UAAM,cAAc,MAAM,iBAAiB;AAC3C,QAAI,CAAC,YAAa,QAAO;AAEzB,WAAO,WAAW,YAAY,SAAS,CAAC;AAExC,UAAM,MAAM,YAAY,eAAe;AACvC,QAAI;AACF,YAAM,QAAQ,IAAI,MAAM;AAAA,QACtB,aAAa,QAAQ,IAAI;AAAA,QACzB,QAAQ;AAAA,MACV,CAAC;AACD,YAAM,OAAO,MAAM,MAAM,cAAc,KAAK,EAAE,OAAO,EAAE,CAAC;AACxD,YAAM,MAAM,KAAK,QAAQ,QAAQ,CAAC;AAClC,YAAM,KAAK,KAAK;AAChB,UAAI,OAAO,eAAe,OAAO,eAAe,OAAO,YAAY;AACjE,eAAO,cAAc;AAAA,MACvB;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACF,QAAQ;AAAA,EAER;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/polar/types.ts"],"sourcesContent":["export interface CreditPackage {\n id: string;\n credits: number;\n priceCents: number;\n}\n\nexport interface NarevPolarConfig {\n meterId: string;\n environment: 'sandbox' | 'production';\n topup: CreditPackage[];\n}\n\nexport interface PolarUsageData {\n consumedUnits: number;\n creditedUnits: number;\n meterName: string;\n found: boolean;\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface CreditPackage {
|
|
2
|
+
id: string;
|
|
3
|
+
credits: number;
|
|
4
|
+
priceCents: number;
|
|
5
|
+
}
|
|
6
|
+
interface NarevPolarConfig {
|
|
7
|
+
meterId: string;
|
|
8
|
+
environment: 'sandbox' | 'production';
|
|
9
|
+
topup: CreditPackage[];
|
|
10
|
+
}
|
|
11
|
+
interface PolarUsageData {
|
|
12
|
+
consumedUnits: number;
|
|
13
|
+
creditedUnits: number;
|
|
14
|
+
meterName: string;
|
|
15
|
+
found: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type { CreditPackage, NarevPolarConfig, PolarUsageData };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface CreditPackage {
|
|
2
|
+
id: string;
|
|
3
|
+
credits: number;
|
|
4
|
+
priceCents: number;
|
|
5
|
+
}
|
|
6
|
+
interface NarevPolarConfig {
|
|
7
|
+
meterId: string;
|
|
8
|
+
environment: 'sandbox' | 'production';
|
|
9
|
+
topup: CreditPackage[];
|
|
10
|
+
}
|
|
11
|
+
interface PolarUsageData {
|
|
12
|
+
consumedUnits: number;
|
|
13
|
+
creditedUnits: number;
|
|
14
|
+
meterName: string;
|
|
15
|
+
found: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type { CreditPackage, NarevPolarConfig, PolarUsageData };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/server.cjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
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);
|
|
19
|
+
var server_exports = {};
|
|
20
|
+
__export(server_exports, {
|
|
21
|
+
createCheckout: () => import_createCheckout.createCheckout,
|
|
22
|
+
fetchPolarConfig: () => import_fetchPolarConfig.fetchPolarConfig,
|
|
23
|
+
fetchPolarUsage: () => import_fetchPolarUsage.fetchPolarUsage,
|
|
24
|
+
fetchStripeConfig: () => import_fetchStripeConfig.fetchStripeConfig,
|
|
25
|
+
fetchStripeUsage: () => import_fetchStripeUsage.fetchStripeUsage,
|
|
26
|
+
fetchTopUpConfig: () => import_fetchTopUpConfig.fetchTopUpConfig
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(server_exports);
|
|
29
|
+
var import_fetchPolarUsage = require("./polar/fetchPolarUsage.js");
|
|
30
|
+
var import_fetchPolarConfig = require("./polar/fetchPolarConfig.js");
|
|
31
|
+
var import_fetchTopUpConfig = require("./polar/fetchTopUpConfig.js");
|
|
32
|
+
var import_createCheckout = require("./polar/createCheckout.js");
|
|
33
|
+
var import_fetchStripeUsage = require("./stripe/fetchStripeUsage.js");
|
|
34
|
+
var import_fetchStripeConfig = require("./stripe/fetchStripeConfig.js");
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
createCheckout,
|
|
38
|
+
fetchPolarConfig,
|
|
39
|
+
fetchPolarUsage,
|
|
40
|
+
fetchStripeConfig,
|
|
41
|
+
fetchStripeUsage,
|
|
42
|
+
fetchTopUpConfig
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=server.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["export { fetchPolarUsage } from './polar/fetchPolarUsage.js';\nexport { fetchPolarConfig } from './polar/fetchPolarConfig.js';\nexport { fetchTopUpConfig } from './polar/fetchTopUpConfig.js';\nexport { createCheckout } from './polar/createCheckout.js';\nexport { fetchStripeUsage } from './stripe/fetchStripeUsage.js';\nexport { fetchStripeConfig } from './stripe/fetchStripeConfig.js';\nexport type {\n CreditPackage,\n NarevPolarConfig,\n PolarUsageData,\n} from './polar/types.js';\nexport type { StripeConfig, StripeUsageData } from './stripe/types.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAgC;AAChC,8BAAiC;AACjC,8BAAiC;AACjC,4BAA+B;AAC/B,8BAAiC;AACjC,+BAAkC;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { fetchPolarUsage } from './polar/fetchPolarUsage.cjs';
|
|
2
|
+
export { fetchPolarConfig } from './polar/fetchPolarConfig.cjs';
|
|
3
|
+
export { fetchTopUpConfig } from './polar/fetchTopUpConfig.cjs';
|
|
4
|
+
export { createCheckout } from './polar/createCheckout.cjs';
|
|
5
|
+
export { fetchStripeUsage } from './stripe/fetchStripeUsage.cjs';
|
|
6
|
+
export { fetchStripeConfig } from './stripe/fetchStripeConfig.cjs';
|
|
7
|
+
export { CreditPackage, NarevPolarConfig, PolarUsageData } from './polar/types.cjs';
|
|
8
|
+
export { StripeConfig, StripeUsageData } from './stripe/types.cjs';
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { fetchPolarUsage } from './polar/fetchPolarUsage.js';
|
|
2
|
+
export { fetchPolarConfig } from './polar/fetchPolarConfig.js';
|
|
3
|
+
export { fetchTopUpConfig } from './polar/fetchTopUpConfig.js';
|
|
4
|
+
export { createCheckout } from './polar/createCheckout.js';
|
|
5
|
+
export { fetchStripeUsage } from './stripe/fetchStripeUsage.js';
|
|
6
|
+
export { fetchStripeConfig } from './stripe/fetchStripeConfig.js';
|
|
7
|
+
export { CreditPackage, NarevPolarConfig, PolarUsageData } from './polar/types.js';
|
|
8
|
+
export { StripeConfig, StripeUsageData } from './stripe/types.js';
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fetchPolarUsage } from "./polar/fetchPolarUsage.js";
|
|
2
|
+
import { fetchPolarConfig } from "./polar/fetchPolarConfig.js";
|
|
3
|
+
import { fetchTopUpConfig } from "./polar/fetchTopUpConfig.js";
|
|
4
|
+
import { createCheckout } from "./polar/createCheckout.js";
|
|
5
|
+
import { fetchStripeUsage } from "./stripe/fetchStripeUsage.js";
|
|
6
|
+
import { fetchStripeConfig } from "./stripe/fetchStripeConfig.js";
|
|
7
|
+
export {
|
|
8
|
+
createCheckout,
|
|
9
|
+
fetchPolarConfig,
|
|
10
|
+
fetchPolarUsage,
|
|
11
|
+
fetchStripeConfig,
|
|
12
|
+
fetchStripeUsage,
|
|
13
|
+
fetchTopUpConfig
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server.ts"],"sourcesContent":["export { fetchPolarUsage } from './polar/fetchPolarUsage.js';\nexport { fetchPolarConfig } from './polar/fetchPolarConfig.js';\nexport { fetchTopUpConfig } from './polar/fetchTopUpConfig.js';\nexport { createCheckout } from './polar/createCheckout.js';\nexport { fetchStripeUsage } from './stripe/fetchStripeUsage.js';\nexport { fetchStripeConfig } from './stripe/fetchStripeConfig.js';\nexport type {\n CreditPackage,\n NarevPolarConfig,\n PolarUsageData,\n} from './polar/types.js';\nexport type { StripeConfig, StripeUsageData } from './stripe/types.js';\n"],"mappings":"AAAA,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;","names":[]}
|