@digilogiclabs/saas-factory-payments 1.2.7 → 1.2.9
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/{events-CMenJqgf.d.mts → events-Ba-jqIgC.d.mts} +1 -1
- package/dist/{events-CMenJqgf.d.ts → events-Ba-jqIgC.d.ts} +1 -1
- package/dist/index.d.mts +79 -5
- package/dist/index.d.ts +79 -5
- package/dist/index.js +1501 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1405 -1
- package/dist/index.mjs.map +1 -1
- package/dist/native.d.mts +1 -1
- package/dist/native.d.ts +1 -1
- package/dist/native.js +3008 -1
- package/dist/native.js.map +1 -1
- package/dist/native.mjs +3006 -1
- package/dist/native.mjs.map +1 -1
- package/dist/{provider-C7F6btFU.d.mts → provider-CrxmH4d_.d.mts} +1 -1
- package/dist/{provider-DlAIraLE.d.ts → provider-CsOkAYe8.d.ts} +1 -1
- package/dist/server.js +687 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +639 -1
- package/dist/server.mjs.map +1 -1
- package/dist/web.d.mts +2 -2
- package/dist/web.d.ts +2 -2
- package/dist/web.js +4554 -9
- package/dist/web.js.map +1 -1
- package/dist/web.mjs +4497 -9
- package/dist/web.mjs.map +1 -1
- package/package.json +16 -10
|
@@ -517,4 +517,4 @@ type PaymentEvent = {
|
|
|
517
517
|
error: PaymentError;
|
|
518
518
|
};
|
|
519
519
|
|
|
520
|
-
export { type ActiveSubscriptionStatus as A, type BillingAddress as B, type CheckoutParams as C, type StripeError as D, type Invoice as E, type
|
|
520
|
+
export { type ActiveSubscriptionStatus as A, type BillingAddress as B, type CheckoutParams as C, type StripeError as D, type Invoice as E, type PaymentEvent as F, type PaymentError as G, type InactiveSubscriptionStatus as I, type PricingPlan as P, SubscriptionStatus as S, type WebhookEvent as W, type PaymentsConfig as a, type PaymentProviderType as b, type CheckoutSession as c, type CustomerCreateParams as d, type Customer as e, type SubscriptionCreateParams as f, type Subscription as g, type SubscriptionUpdateParams as h, PaymentErrorType as i, PaymentsError as j, type PaymentMethod as k, type SubscriptionItem as l, type ProblematicSubscriptionStatus as m, type IncompleteSubscriptionStatus as n, ACTIVE_STATUSES as o, INACTIVE_STATUSES as p, PROBLEMATIC_STATUSES as q, INCOMPLETE_STATUSES as r, isActiveSubscription as s, isInactiveSubscription as t, isProblematicSubscription as u, isIncompleteSubscription as v, type CustomerUpdateParams as w, type StripeConfig as x, type CheckoutSessionParams as y, type PaymentIntentParams as z };
|
|
@@ -517,4 +517,4 @@ type PaymentEvent = {
|
|
|
517
517
|
error: PaymentError;
|
|
518
518
|
};
|
|
519
519
|
|
|
520
|
-
export { type ActiveSubscriptionStatus as A, type BillingAddress as B, type CheckoutParams as C, type StripeError as D, type Invoice as E, type
|
|
520
|
+
export { type ActiveSubscriptionStatus as A, type BillingAddress as B, type CheckoutParams as C, type StripeError as D, type Invoice as E, type PaymentEvent as F, type PaymentError as G, type InactiveSubscriptionStatus as I, type PricingPlan as P, SubscriptionStatus as S, type WebhookEvent as W, type PaymentsConfig as a, type PaymentProviderType as b, type CheckoutSession as c, type CustomerCreateParams as d, type Customer as e, type SubscriptionCreateParams as f, type Subscription as g, type SubscriptionUpdateParams as h, PaymentErrorType as i, PaymentsError as j, type PaymentMethod as k, type SubscriptionItem as l, type ProblematicSubscriptionStatus as m, type IncompleteSubscriptionStatus as n, ACTIVE_STATUSES as o, INACTIVE_STATUSES as p, PROBLEMATIC_STATUSES as q, INCOMPLETE_STATUSES as r, isActiveSubscription as s, isInactiveSubscription as t, isProblematicSubscription as u, isIncompleteSubscription as v, type CustomerUpdateParams as w, type StripeConfig as x, type CheckoutSessionParams as y, type PaymentIntentParams as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { P as
|
|
4
|
-
export {
|
|
1
|
+
import { ILogger, IMetrics, ICache } from '@digilogiclabs/platform-core';
|
|
2
|
+
export { AccountCapabilities, AccountLink, AccountType, Address, Balance, BalanceAmount, BankAccountDetails, BillingDetails, BusinessProfile, CapturePaymentIntentOptions, CardBrand, CardDetails, ConfirmPaymentIntentOptions, ConnectedAccount, ConnectedAccountStatus, CreateAccountLinkOptions, CreateConnectedAccountOptions, CreateCustomerOptions, CreatePaymentIntentOptions, CreatePayoutOptions, CreateRefundOptions, CreateTransferOptions, Customer, IPayment, MemoryPayment, PaymentConfig, PaymentError, PaymentErrorCode, PaymentErrorMessages, PaymentEventType, PaymentIntent, PaymentMethod, PaymentMethodType, PaymentStatus, PaymentWebhookEvent, Payout, PayoutStatus, Refund, RefundReason, RefundStatus, StripePayment, StripePaymentConfig, TosAcceptance, Transfer, TransferStatus, UpdateCustomerOptions, UpdatePaymentIntentOptions, VerifyWebhookOptions, createPaymentError, formatAmount, generatePaymentId, isPaymentError } from '@digilogiclabs/platform-core';
|
|
3
|
+
import { P as PricingPlan, a as PaymentsConfig, S as SubscriptionStatus, b as PaymentProviderType, C as CheckoutParams, c as CheckoutSession, d as CustomerCreateParams, e as Customer, f as SubscriptionCreateParams, g as Subscription, h as SubscriptionUpdateParams, i as PaymentErrorType, j as PaymentsError, k as PaymentMethod } from './events-Ba-jqIgC.mjs';
|
|
4
|
+
export { o as ACTIVE_STATUSES, A as ActiveSubscriptionStatus, B as BillingAddress, y as CheckoutSessionParams, w as CustomerUpdateParams, p as INACTIVE_STATUSES, r as INCOMPLETE_STATUSES, I as InactiveSubscriptionStatus, n as IncompleteSubscriptionStatus, E as Invoice, q as PROBLEMATIC_STATUSES, F as PaymentEvent, z as PaymentIntentParams, m as ProblematicSubscriptionStatus, x as StripeConfig, D as StripeError, l as SubscriptionItem, W as WebhookEvent, s as isActiveSubscription, t as isInactiveSubscription, v as isIncompleteSubscription, u as isProblematicSubscription } from './events-Ba-jqIgC.mjs';
|
|
5
|
+
import { P as PaymentProvider } from './provider-CrxmH4d_.mjs';
|
|
6
|
+
export { b as PaymentsProviderActions, a as PaymentsProviderState, c as PaymentsStore } from './provider-CrxmH4d_.mjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Platform Core Integration
|
|
10
|
+
*
|
|
11
|
+
* Optional integration with @digilogiclabs/platform-core for:
|
|
12
|
+
* - Logging (payment events, webhook processing)
|
|
13
|
+
* - Metrics (payment success/failure tracking, revenue metrics)
|
|
14
|
+
* - Cache (subscription status caching)
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
interface PlatformServices {
|
|
18
|
+
logger?: ILogger;
|
|
19
|
+
metrics?: IMetrics;
|
|
20
|
+
cache?: ICache;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Set the platform services for payments package to use
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { createPlatform } from '@digilogiclabs/platform-core';
|
|
28
|
+
* import { setPlatform } from '@digilogiclabs/saas-factory-payments';
|
|
29
|
+
*
|
|
30
|
+
* const platform = createPlatform();
|
|
31
|
+
* setPlatform({
|
|
32
|
+
* logger: platform.logger,
|
|
33
|
+
* metrics: platform.metrics,
|
|
34
|
+
* cache: platform.cache,
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function setPlatform(services: PlatformServices): void;
|
|
39
|
+
/**
|
|
40
|
+
* Clear platform services (useful for testing)
|
|
41
|
+
*/
|
|
42
|
+
declare function clearPlatform(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Check if platform services are configured
|
|
45
|
+
*/
|
|
46
|
+
declare function hasPlatform(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Log a payment event if logger is configured
|
|
49
|
+
*/
|
|
50
|
+
declare function logPaymentEvent(level: 'debug' | 'info' | 'warn' | 'error', message: string, meta?: Record<string, unknown>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Track a payment metric if metrics are configured
|
|
53
|
+
*/
|
|
54
|
+
declare function trackPaymentMetric(name: string, value?: number, tags?: Record<string, string | number | boolean>): void;
|
|
55
|
+
/**
|
|
56
|
+
* Track payment revenue
|
|
57
|
+
*/
|
|
58
|
+
declare function trackRevenue(amount: number, currency: string, tags?: Record<string, string | number | boolean>): void;
|
|
59
|
+
/**
|
|
60
|
+
* Cache subscription status
|
|
61
|
+
*/
|
|
62
|
+
declare function cacheSubscriptionStatus(customerId: string, status: string, ttl?: number): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Get cached subscription status
|
|
65
|
+
*/
|
|
66
|
+
declare function getCachedSubscriptionStatus(customerId: string): Promise<string | null>;
|
|
67
|
+
/**
|
|
68
|
+
* Track webhook processing
|
|
69
|
+
*/
|
|
70
|
+
declare function trackWebhookEvent(eventType: string, success: boolean, duration?: number): void;
|
|
71
|
+
/**
|
|
72
|
+
* Track checkout session
|
|
73
|
+
*/
|
|
74
|
+
declare function trackCheckoutSession(success: boolean, tags?: Record<string, string | number | boolean>): void;
|
|
75
|
+
/**
|
|
76
|
+
* Track subscription events
|
|
77
|
+
*/
|
|
78
|
+
declare function trackSubscriptionEvent(event: 'created' | 'updated' | 'canceled' | 'renewed', tags?: Record<string, string | number | boolean>): void;
|
|
5
79
|
|
|
6
80
|
declare const STRIPE_API_VERSION = "2023-10-16";
|
|
7
81
|
declare const PAYMENT_METHODS: {
|
|
@@ -241,4 +315,4 @@ declare class MockPaymentProvider extends BasePaymentProvider implements Payment
|
|
|
241
315
|
listSubscriptions(customerId: string, status?: SubscriptionStatus): Promise<Subscription[]>;
|
|
242
316
|
}
|
|
243
317
|
|
|
244
|
-
export { BILLING_INTERVALS, CHECKOUT_MODE, CURRENCY_SYMBOLS, CheckoutParams, CheckoutSession,
|
|
318
|
+
export { BILLING_INTERVALS, CHECKOUT_MODE, CURRENCY_SYMBOLS, CheckoutParams, CheckoutSession, CustomerCreateParams, DEFAULT_CURRENCY, ERROR_MESSAGES, type EnvironmentConfig, INVOICE_STATUS, MockPaymentProvider, PAYMENT_METHODS, PaymentErrorType, PaymentProvider, PaymentProviderFactory, PaymentProviderType, PaymentsConfig, PaymentsError, PricingPlan, STRIPE_API_VERSION, SUBSCRIPTION_STATUS, StripePaymentProvider, Subscription, SubscriptionCreateParams, SubscriptionStatus, SubscriptionUpdateParams, WEBHOOK_EVENTS, cacheSubscriptionStatus, calculateTax, clearPlatform, formatAmountWithTax, formatBillingInterval, formatCardBrand, formatCurrency, formatDate, formatPaymentMethodDisplay, formatPricingPlan, formatRelativeTime, formatSubscriptionStatus, formatTaxRate, formatTrialPeriod, getCachedSubscriptionStatus, getEnvironmentConfig, hasPlatform, isClient, isDevelopment, isProduction, isServer, logPaymentEvent, setPlatform, trackCheckoutSession, trackPaymentMetric, trackRevenue, trackSubscriptionEvent, trackWebhookEvent, truncateText, validateAmount, validateCard, validateCurrentEnvironment, validateEmail, validateEnvironment, validatePaymentsConfig, validatePhoneNumber, validatePricingPlan, validateStripeId };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { P as
|
|
4
|
-
export {
|
|
1
|
+
import { ILogger, IMetrics, ICache } from '@digilogiclabs/platform-core';
|
|
2
|
+
export { AccountCapabilities, AccountLink, AccountType, Address, Balance, BalanceAmount, BankAccountDetails, BillingDetails, BusinessProfile, CapturePaymentIntentOptions, CardBrand, CardDetails, ConfirmPaymentIntentOptions, ConnectedAccount, ConnectedAccountStatus, CreateAccountLinkOptions, CreateConnectedAccountOptions, CreateCustomerOptions, CreatePaymentIntentOptions, CreatePayoutOptions, CreateRefundOptions, CreateTransferOptions, Customer, IPayment, MemoryPayment, PaymentConfig, PaymentError, PaymentErrorCode, PaymentErrorMessages, PaymentEventType, PaymentIntent, PaymentMethod, PaymentMethodType, PaymentStatus, PaymentWebhookEvent, Payout, PayoutStatus, Refund, RefundReason, RefundStatus, StripePayment, StripePaymentConfig, TosAcceptance, Transfer, TransferStatus, UpdateCustomerOptions, UpdatePaymentIntentOptions, VerifyWebhookOptions, createPaymentError, formatAmount, generatePaymentId, isPaymentError } from '@digilogiclabs/platform-core';
|
|
3
|
+
import { P as PricingPlan, a as PaymentsConfig, S as SubscriptionStatus, b as PaymentProviderType, C as CheckoutParams, c as CheckoutSession, d as CustomerCreateParams, e as Customer, f as SubscriptionCreateParams, g as Subscription, h as SubscriptionUpdateParams, i as PaymentErrorType, j as PaymentsError, k as PaymentMethod } from './events-Ba-jqIgC.js';
|
|
4
|
+
export { o as ACTIVE_STATUSES, A as ActiveSubscriptionStatus, B as BillingAddress, y as CheckoutSessionParams, w as CustomerUpdateParams, p as INACTIVE_STATUSES, r as INCOMPLETE_STATUSES, I as InactiveSubscriptionStatus, n as IncompleteSubscriptionStatus, E as Invoice, q as PROBLEMATIC_STATUSES, F as PaymentEvent, z as PaymentIntentParams, m as ProblematicSubscriptionStatus, x as StripeConfig, D as StripeError, l as SubscriptionItem, W as WebhookEvent, s as isActiveSubscription, t as isInactiveSubscription, v as isIncompleteSubscription, u as isProblematicSubscription } from './events-Ba-jqIgC.js';
|
|
5
|
+
import { P as PaymentProvider } from './provider-CsOkAYe8.js';
|
|
6
|
+
export { b as PaymentsProviderActions, a as PaymentsProviderState, c as PaymentsStore } from './provider-CsOkAYe8.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Platform Core Integration
|
|
10
|
+
*
|
|
11
|
+
* Optional integration with @digilogiclabs/platform-core for:
|
|
12
|
+
* - Logging (payment events, webhook processing)
|
|
13
|
+
* - Metrics (payment success/failure tracking, revenue metrics)
|
|
14
|
+
* - Cache (subscription status caching)
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
interface PlatformServices {
|
|
18
|
+
logger?: ILogger;
|
|
19
|
+
metrics?: IMetrics;
|
|
20
|
+
cache?: ICache;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Set the platform services for payments package to use
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { createPlatform } from '@digilogiclabs/platform-core';
|
|
28
|
+
* import { setPlatform } from '@digilogiclabs/saas-factory-payments';
|
|
29
|
+
*
|
|
30
|
+
* const platform = createPlatform();
|
|
31
|
+
* setPlatform({
|
|
32
|
+
* logger: platform.logger,
|
|
33
|
+
* metrics: platform.metrics,
|
|
34
|
+
* cache: platform.cache,
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function setPlatform(services: PlatformServices): void;
|
|
39
|
+
/**
|
|
40
|
+
* Clear platform services (useful for testing)
|
|
41
|
+
*/
|
|
42
|
+
declare function clearPlatform(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Check if platform services are configured
|
|
45
|
+
*/
|
|
46
|
+
declare function hasPlatform(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Log a payment event if logger is configured
|
|
49
|
+
*/
|
|
50
|
+
declare function logPaymentEvent(level: 'debug' | 'info' | 'warn' | 'error', message: string, meta?: Record<string, unknown>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Track a payment metric if metrics are configured
|
|
53
|
+
*/
|
|
54
|
+
declare function trackPaymentMetric(name: string, value?: number, tags?: Record<string, string | number | boolean>): void;
|
|
55
|
+
/**
|
|
56
|
+
* Track payment revenue
|
|
57
|
+
*/
|
|
58
|
+
declare function trackRevenue(amount: number, currency: string, tags?: Record<string, string | number | boolean>): void;
|
|
59
|
+
/**
|
|
60
|
+
* Cache subscription status
|
|
61
|
+
*/
|
|
62
|
+
declare function cacheSubscriptionStatus(customerId: string, status: string, ttl?: number): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Get cached subscription status
|
|
65
|
+
*/
|
|
66
|
+
declare function getCachedSubscriptionStatus(customerId: string): Promise<string | null>;
|
|
67
|
+
/**
|
|
68
|
+
* Track webhook processing
|
|
69
|
+
*/
|
|
70
|
+
declare function trackWebhookEvent(eventType: string, success: boolean, duration?: number): void;
|
|
71
|
+
/**
|
|
72
|
+
* Track checkout session
|
|
73
|
+
*/
|
|
74
|
+
declare function trackCheckoutSession(success: boolean, tags?: Record<string, string | number | boolean>): void;
|
|
75
|
+
/**
|
|
76
|
+
* Track subscription events
|
|
77
|
+
*/
|
|
78
|
+
declare function trackSubscriptionEvent(event: 'created' | 'updated' | 'canceled' | 'renewed', tags?: Record<string, string | number | boolean>): void;
|
|
5
79
|
|
|
6
80
|
declare const STRIPE_API_VERSION = "2023-10-16";
|
|
7
81
|
declare const PAYMENT_METHODS: {
|
|
@@ -241,4 +315,4 @@ declare class MockPaymentProvider extends BasePaymentProvider implements Payment
|
|
|
241
315
|
listSubscriptions(customerId: string, status?: SubscriptionStatus): Promise<Subscription[]>;
|
|
242
316
|
}
|
|
243
317
|
|
|
244
|
-
export { BILLING_INTERVALS, CHECKOUT_MODE, CURRENCY_SYMBOLS, CheckoutParams, CheckoutSession,
|
|
318
|
+
export { BILLING_INTERVALS, CHECKOUT_MODE, CURRENCY_SYMBOLS, CheckoutParams, CheckoutSession, CustomerCreateParams, DEFAULT_CURRENCY, ERROR_MESSAGES, type EnvironmentConfig, INVOICE_STATUS, MockPaymentProvider, PAYMENT_METHODS, PaymentErrorType, PaymentProvider, PaymentProviderFactory, PaymentProviderType, PaymentsConfig, PaymentsError, PricingPlan, STRIPE_API_VERSION, SUBSCRIPTION_STATUS, StripePaymentProvider, Subscription, SubscriptionCreateParams, SubscriptionStatus, SubscriptionUpdateParams, WEBHOOK_EVENTS, cacheSubscriptionStatus, calculateTax, clearPlatform, formatAmountWithTax, formatBillingInterval, formatCardBrand, formatCurrency, formatDate, formatPaymentMethodDisplay, formatPricingPlan, formatRelativeTime, formatSubscriptionStatus, formatTaxRate, formatTrialPeriod, getCachedSubscriptionStatus, getEnvironmentConfig, hasPlatform, isClient, isDevelopment, isProduction, isServer, logPaymentEvent, setPlatform, trackCheckoutSession, trackPaymentMetric, trackRevenue, trackSubscriptionEvent, trackWebhookEvent, truncateText, validateAmount, validateCard, validateCurrentEnvironment, validateEmail, validateEnvironment, validatePaymentsConfig, validatePhoneNumber, validatePricingPlan, validateStripeId };
|