@kodice.one/stripefirebase-shared 1.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.
@@ -0,0 +1,51 @@
1
+ export type PaymentMode = "payment" | "subscription";
2
+ export type CheckoutStatus = "pending" | "processing" | "succeeded" | "failed" | "expired" | "canceled";
3
+ export interface LineItem {
4
+ /** Stripe Price ID, e.g. "price_1OqX…" */
5
+ priceId: string;
6
+ quantity: number;
7
+ }
8
+ export interface CreateCheckoutRequest {
9
+ lineItems: LineItem[];
10
+ /**
11
+ * "payment" → one-time checkout
12
+ * "subscription" → recurring subscription
13
+ */
14
+ mode: PaymentMode;
15
+ /**
16
+ * Absolute URL Stripe redirects to after success.
17
+ * Use the literal `{CHECKOUT_SESSION_ID}` placeholder — Stripe replaces it.
18
+ */
19
+ successUrl: string;
20
+ /** Absolute URL for the "Back" / cancel button on the Checkout page. */
21
+ cancelUrl: string;
22
+ /** Optional arbitrary metadata stored on the Firestore document. */
23
+ metadata?: Record<string, string>;
24
+ }
25
+ export interface CreateCheckoutResponse {
26
+ /** Stripe Checkout Session ID — use to subscribe to status updates. */
27
+ sessionId: string;
28
+ /** Redirect the user here to complete payment. */
29
+ checkoutUrl: string;
30
+ }
31
+ export interface CheckoutDocument {
32
+ /** Firebase Auth UID of the paying user. */
33
+ userId: string;
34
+ /** Stripe Checkout Session ID. */
35
+ sessionId: string;
36
+ /** Stripe Customer ID — populated by the webhook after first payment. */
37
+ stripeCustomerId?: string;
38
+ /** Stripe Subscription ID — subscriptions only. */
39
+ subscriptionId?: string;
40
+ /** Stripe PaymentIntent ID — one-time payments only. */
41
+ paymentIntentId?: string;
42
+ mode: PaymentMode;
43
+ status: CheckoutStatus;
44
+ lineItems: LineItem[];
45
+ metadata: Record<string, string>;
46
+ /** ISO 8601 timestamp of document creation. */
47
+ createdAt: string;
48
+ /** ISO 8601 timestamp of last status update. */
49
+ updatedAt: string;
50
+ }
51
+ //# sourceMappingURL=index.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B,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;CACnB"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ // ─────────────────────────────────────────────────────────────────────────────
3
+ // @kodice.one/stripefirebase-shared
4
+ // Single source of truth for types used by both Functions and the client lib.
5
+ // ─────────────────────────────────────────────────────────────────────────────
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oCAAoC;AACpC,8EAA8E;AAC9E,gFAAgF"}
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@kodice.one/stripefirebase-shared",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "description": "Shared TypeScript types for Firebase-Stripe integration",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "build:watch": "tsc --watch",
11
+ "clean": "rm -rf dist"
12
+ },
13
+ "engines": {
14
+ "node": ">=24.0.0"
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "^24.0.0",
18
+ "typescript": "^5.4.0"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ]
23
+ }