@stripe/extensibility-sdk 1.0.1 → 1.3.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.
Files changed (97) hide show
  1. package/README.md +17 -15
  2. package/dist/config-values/generate.cjs +1 -1
  3. package/dist/config-values/generate.d.ts +1 -1
  4. package/dist/config-values/generate.d.ts.map +1 -1
  5. package/dist/config-values/generate.js +1 -1
  6. package/dist/extensibility-sdk-alpha.d.ts +29 -157
  7. package/dist/extensibility-sdk-beta.d.ts +29 -157
  8. package/dist/extensibility-sdk-config-values-internal.d.ts +1 -1
  9. package/dist/extensibility-sdk-extensions-alpha.d.ts +7 -157
  10. package/dist/extensibility-sdk-extensions-beta.d.ts +7 -157
  11. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-alpha.d.ts +631 -0
  12. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-beta.d.ts +631 -0
  13. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-internal.d.ts +666 -0
  14. package/dist/extensibility-sdk-extensions-billing-bill-discount_calculation-public.d.ts +631 -0
  15. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-alpha.d.ts +475 -0
  16. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-beta.d.ts +475 -0
  17. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-internal.d.ts +510 -0
  18. package/dist/extensibility-sdk-extensions-billing-customer_balance_application-public.d.ts +475 -0
  19. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-alpha.d.ts +110 -0
  20. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-beta.d.ts +110 -0
  21. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-internal.d.ts +123 -0
  22. package/dist/extensibility-sdk-extensions-billing-invoice_collection_options-public.d.ts +110 -0
  23. package/dist/extensibility-sdk-extensions-billing-prorations-alpha.d.ts +607 -0
  24. package/dist/extensibility-sdk-extensions-billing-prorations-beta.d.ts +607 -0
  25. package/dist/extensibility-sdk-extensions-billing-prorations-internal.d.ts +642 -0
  26. package/dist/extensibility-sdk-extensions-billing-prorations-public.d.ts +607 -0
  27. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-alpha.d.ts +735 -0
  28. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-beta.d.ts +735 -0
  29. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-internal.d.ts +772 -0
  30. package/dist/extensibility-sdk-extensions-billing-recurring_billing_item_handling-public.d.ts +735 -0
  31. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-alpha.d.ts +126 -0
  32. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-beta.d.ts +126 -0
  33. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-internal.d.ts +140 -0
  34. package/dist/extensibility-sdk-extensions-core-workflows-custom_action-public.d.ts +126 -0
  35. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-alpha.d.ts +126 -0
  36. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-beta.d.ts +126 -0
  37. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-internal.d.ts +140 -0
  38. package/dist/extensibility-sdk-extensions-extend-workflows-custom_action-public.d.ts +126 -0
  39. package/dist/extensibility-sdk-extensions-internal.d.ts +7 -157
  40. package/dist/extensibility-sdk-extensions-public.d.ts +7 -157
  41. package/dist/extensibility-sdk-internal-internal.d.ts +2 -2
  42. package/dist/extensibility-sdk-internal.d.ts +145 -162
  43. package/dist/extensibility-sdk-public.d.ts +29 -157
  44. package/dist/extensibility-sdk-stdlib-alpha.d.ts +593 -0
  45. package/dist/extensibility-sdk-stdlib-beta.d.ts +593 -0
  46. package/dist/extensibility-sdk-stdlib-internal.d.ts +1096 -0
  47. package/dist/extensibility-sdk-stdlib-public.d.ts +593 -0
  48. package/dist/extensions/billing/bill/discount_calculation.cjs +437 -0
  49. package/dist/extensions/billing/bill/discount_calculation.d.ts +0 -20
  50. package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -1
  51. package/dist/extensions/billing/bill/discount_calculation.js +430 -0
  52. package/dist/extensions/billing/customer_balance_application.cjs +297 -0
  53. package/dist/extensions/billing/customer_balance_application.d.ts +0 -20
  54. package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -1
  55. package/dist/extensions/billing/customer_balance_application.js +284 -0
  56. package/dist/extensions/billing/invoice_collection_options.cjs +166 -0
  57. package/dist/extensions/billing/invoice_collection_options.d.ts +4 -24
  58. package/dist/extensions/billing/invoice_collection_options.d.ts.map +1 -1
  59. package/dist/extensions/billing/invoice_collection_options.js +155 -0
  60. package/dist/extensions/billing/prorations.cjs +501 -0
  61. package/dist/extensions/billing/prorations.d.ts +0 -20
  62. package/dist/extensions/billing/prorations.d.ts.map +1 -1
  63. package/dist/extensions/billing/prorations.js +492 -0
  64. package/dist/extensions/billing/recurring_billing_item_handling.cjs +639 -0
  65. package/dist/extensions/billing/recurring_billing_item_handling.d.ts +0 -30
  66. package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -1
  67. package/dist/extensions/billing/recurring_billing_item_handling.js +632 -0
  68. package/dist/extensions/core/workflows/custom_action.cjs +124 -0
  69. package/dist/extensions/core/workflows/custom_action.d.ts +1 -21
  70. package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -1
  71. package/dist/extensions/core/workflows/custom_action.js +111 -0
  72. package/dist/extensions/extend/workflows/custom_action.cjs +124 -0
  73. package/dist/extensions/extend/workflows/custom_action.d.ts +1 -21
  74. package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -1
  75. package/dist/extensions/extend/workflows/custom_action.js +111 -0
  76. package/dist/extensions/index.cjs +27 -265
  77. package/dist/extensions/index.js +27 -265
  78. package/dist/extensions/registry.d.ts +2 -2
  79. package/dist/extensions/registry.d.ts.map +1 -1
  80. package/dist/index.cjs +452 -2390
  81. package/dist/index.js +479 -2286
  82. package/dist/internal.cjs +22 -54
  83. package/dist/internal.js +22 -54
  84. package/dist/stdlib/generated.d.ts +1 -1
  85. package/dist/stdlib/generated.d.ts.map +1 -1
  86. package/dist/stdlib/index.cjs +2003 -0
  87. package/dist/stdlib/index.d.ts +2 -2
  88. package/dist/stdlib/index.d.ts.map +1 -1
  89. package/dist/stdlib/index.js +1943 -0
  90. package/dist/stdlib/transform-strategies.d.ts +46 -6
  91. package/dist/stdlib/transform-strategies.d.ts.map +1 -1
  92. package/dist/stdlib/types.d.ts +82 -0
  93. package/dist/stdlib/types.d.ts.map +1 -1
  94. package/dist/tsconfig.build.tsbuildinfo +1 -1
  95. package/package.json +65 -1
  96. package/dist/stdlib/extension-method.d.ts +0 -27
  97. package/dist/stdlib/extension-method.d.ts.map +0 -1
@@ -0,0 +1,110 @@
1
+ /* Excluded from this release type: _ConfigApplicationContext */
2
+
3
+ /** @public */
4
+ declare interface Context {
5
+ type: string;
6
+ id: string;
7
+ livemode: boolean;
8
+ stripeContext?: string;
9
+ clockTime?: string;
10
+ }
11
+
12
+ /** @public */
13
+ export declare namespace InvoiceCollectionOptions {
14
+ /** @public */
15
+ export type PaymentMethodType = 'ach_credit_transfer' | 'ach_debit' | 'affirm' | 'afterpay_clearpay' | 'alipay' | 'au_becs_debit' | 'bacs_debit' | 'bancontact' | 'blik' | 'boleto' | 'card' | 'cashapp' | 'eps' | 'fpx' | 'giropay' | 'grabpay' | 'ideal' | 'klarna' | 'konbini' | 'link' | 'multibanco' | 'oxxo' | 'p24' | 'paynow' | 'paypal' | 'promptpay' | 'sepa_credit_transfer' | 'sepa_debit' | 'sofort' | 'us_bank_account' | 'wechat_pay';
16
+ /** @public */
17
+ export type CollectionMethod = 'charge_automatically' | 'send_invoice';
18
+ /**
19
+ * The result of the invoice collection options override extension.
20
+ * @public
21
+ */
22
+ export interface InvoiceCollectionOptionsResult {
23
+ /** Override the auto-advancement setting. Set to false to keep the invoice in draft. */
24
+ autoAdvance: boolean;
25
+ }
26
+ /** @public */
27
+ export type InvoiceCollectionOptionsInput = ({
28
+ customer: Customer;
29
+ payer: 'customer';
30
+ } | {
31
+ otherPayer: string;
32
+ payer: 'other';
33
+ } | { payer?: never }) & ({
34
+ invoiceParentType: 'other';
35
+ otherInvoiceParentType: string;
36
+ } | {
37
+ invoiceParentType: 'subscription';
38
+ subscription: SubscriptionParent;
39
+ } | { invoiceParentType: 'cadence' } | { invoiceParentType: 'contract' } | { invoiceParentType: 'quote' } | { invoiceParentType: 'schedule' } | { invoiceParentType?: never }) & { collectionOptions: CollectionOptions };
40
+ /** @public */
41
+ export interface Customer {
42
+ id: string;
43
+ metadata: Record<string, string>;
44
+ }
45
+ /** @public */
46
+ export type ContractParent = Record<string, never>;
47
+ /**
48
+ * The Subscription that triggered the invoice creation.
49
+ * @public
50
+ */
51
+ export interface SubscriptionParent {
52
+ /** The unique identifier for the subscription. */
53
+ id: string;
54
+ /** The metadata of the subscription. */
55
+ metadata: Record<string, string>;
56
+ }
57
+ /** @public */
58
+ export type ScheduleParent = Record<string, never>;
59
+ /** @public */
60
+ export type QuoteParent = Record<string, never>;
61
+ /** @public */
62
+ export type CadenceParent = Record<string, never>;
63
+ /**
64
+ * The collection options for an invoice.
65
+ * @public
66
+ */
67
+ export interface CollectionOptions {
68
+ /** Whether the invoice automatically advances through its lifecycle. */
69
+ autoAdvance: boolean;
70
+ /** The payment collection method: charge_automatically or send_invoice. */
71
+ collectionMethod: CollectionMethod;
72
+ /** The payment methods configured for this invoice. */
73
+ paymentMethods: PaymentMethodType[];
74
+ }
75
+ /* Excluded from this release type: $platformWrapOverrideOptions */
76
+ /**
77
+ * Overrides invoice collection options before a draft invoice is created.
78
+ * @public
79
+ */
80
+ export type OverrideOptionsFunction<Config> = (request: InvoiceCollectionOptionsInput, config: Config, context: Context) => InvoiceCollectionOptionsResult;
81
+ }
82
+
83
+ /**
84
+ * @example
85
+ * ```ts
86
+ * import type { Billing, Context } from '@stripe/extensibility-sdk';
87
+ *
88
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
89
+ * interface MyInvoiceCollectionOptionsConfig {}
90
+ *
91
+ * export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
92
+ * overrideOptions(
93
+ * request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
94
+ * _config: MyInvoiceCollectionOptionsConfig,
95
+ * _context: Context
96
+ * ) {
97
+ * // TODO: implement your collection setting logic here
98
+ *
99
+ * return { autoAdvance: request.collectionOptions.autoAdvance };
100
+ * }
101
+ * }
102
+ *
103
+ * ```
104
+ * @public
105
+ */
106
+ export declare interface InvoiceCollectionOptions<Config> {
107
+ overrideOptions: InvoiceCollectionOptions.OverrideOptionsFunction<Config>;
108
+ }
109
+
110
+ export { }
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Context values threaded into config application at runtime.
3
+ *
4
+ * The platform dispatch layer builds this from the extension context
5
+ * (`_configAppContextFromContext`) and passes it through the config
6
+ * transformer into `_applyConfig`.
7
+ *
8
+ * @internal
9
+ */
10
+ declare interface _ConfigApplicationContext {
11
+ /** ISO 8601 clock time for Billing test clocks. */
12
+ clockTime?: string;
13
+ }
14
+
15
+ /** @public */
16
+ declare interface Context {
17
+ type: string;
18
+ id: string;
19
+ livemode: boolean;
20
+ stripeContext?: string;
21
+ clockTime?: string;
22
+ }
23
+
24
+ /** @public */
25
+ export declare namespace InvoiceCollectionOptions {
26
+ /** @public */
27
+ export type PaymentMethodType = 'ach_credit_transfer' | 'ach_debit' | 'affirm' | 'afterpay_clearpay' | 'alipay' | 'au_becs_debit' | 'bacs_debit' | 'bancontact' | 'blik' | 'boleto' | 'card' | 'cashapp' | 'eps' | 'fpx' | 'giropay' | 'grabpay' | 'ideal' | 'klarna' | 'konbini' | 'link' | 'multibanco' | 'oxxo' | 'p24' | 'paynow' | 'paypal' | 'promptpay' | 'sepa_credit_transfer' | 'sepa_debit' | 'sofort' | 'us_bank_account' | 'wechat_pay';
28
+ /** @public */
29
+ export type CollectionMethod = 'charge_automatically' | 'send_invoice';
30
+ /**
31
+ * The result of the invoice collection options override extension.
32
+ * @public
33
+ */
34
+ export interface InvoiceCollectionOptionsResult {
35
+ /** Override the auto-advancement setting. Set to false to keep the invoice in draft. */
36
+ autoAdvance: boolean;
37
+ }
38
+ /** @public */
39
+ export type InvoiceCollectionOptionsInput = ({
40
+ customer: Customer;
41
+ payer: 'customer';
42
+ } | {
43
+ otherPayer: string;
44
+ payer: 'other';
45
+ } | { payer?: never }) & ({
46
+ invoiceParentType: 'other';
47
+ otherInvoiceParentType: string;
48
+ } | {
49
+ invoiceParentType: 'subscription';
50
+ subscription: SubscriptionParent;
51
+ } | { invoiceParentType: 'cadence' } | { invoiceParentType: 'contract' } | { invoiceParentType: 'quote' } | { invoiceParentType: 'schedule' } | { invoiceParentType?: never }) & { collectionOptions: CollectionOptions };
52
+ /** @public */
53
+ export interface Customer {
54
+ id: string;
55
+ metadata: Record<string, string>;
56
+ }
57
+ /** @public */
58
+ export type ContractParent = Record<string, never>;
59
+ /**
60
+ * The Subscription that triggered the invoice creation.
61
+ * @public
62
+ */
63
+ export interface SubscriptionParent {
64
+ /** The unique identifier for the subscription. */
65
+ id: string;
66
+ /** The metadata of the subscription. */
67
+ metadata: Record<string, string>;
68
+ }
69
+ /** @public */
70
+ export type ScheduleParent = Record<string, never>;
71
+ /** @public */
72
+ export type QuoteParent = Record<string, never>;
73
+ /** @public */
74
+ export type CadenceParent = Record<string, never>;
75
+ /**
76
+ * The collection options for an invoice.
77
+ * @public
78
+ */
79
+ export interface CollectionOptions {
80
+ /** Whether the invoice automatically advances through its lifecycle. */
81
+ autoAdvance: boolean;
82
+ /** The payment collection method: charge_automatically or send_invoice. */
83
+ collectionMethod: CollectionMethod;
84
+ /** The payment methods configured for this invoice. */
85
+ paymentMethods: PaymentMethodType[];
86
+ }
87
+ /** @internal */
88
+ export function $platformWrapOverrideOptions(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => { overrideOptions(...a: unknown[]): unknown }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
89
+ /**
90
+ * Overrides invoice collection options before a draft invoice is created.
91
+ * @public
92
+ */
93
+ export type OverrideOptionsFunction<Config> = (request: InvoiceCollectionOptionsInput, config: Config, context: Context) => InvoiceCollectionOptionsResult;
94
+ }
95
+
96
+ /**
97
+ * @example
98
+ * ```ts
99
+ * import type { Billing, Context } from '@stripe/extensibility-sdk';
100
+ *
101
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
102
+ * interface MyInvoiceCollectionOptionsConfig {}
103
+ *
104
+ * export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
105
+ * overrideOptions(
106
+ * request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
107
+ * _config: MyInvoiceCollectionOptionsConfig,
108
+ * _context: Context
109
+ * ) {
110
+ * // TODO: implement your collection setting logic here
111
+ *
112
+ * return { autoAdvance: request.collectionOptions.autoAdvance };
113
+ * }
114
+ * }
115
+ *
116
+ * ```
117
+ * @public
118
+ */
119
+ export declare interface InvoiceCollectionOptions<Config> {
120
+ overrideOptions: InvoiceCollectionOptions.OverrideOptionsFunction<Config>;
121
+ }
122
+
123
+ export { }
@@ -0,0 +1,110 @@
1
+ /* Excluded from this release type: _ConfigApplicationContext */
2
+
3
+ /** @public */
4
+ declare interface Context {
5
+ type: string;
6
+ id: string;
7
+ livemode: boolean;
8
+ stripeContext?: string;
9
+ clockTime?: string;
10
+ }
11
+
12
+ /** @public */
13
+ export declare namespace InvoiceCollectionOptions {
14
+ /** @public */
15
+ export type PaymentMethodType = 'ach_credit_transfer' | 'ach_debit' | 'affirm' | 'afterpay_clearpay' | 'alipay' | 'au_becs_debit' | 'bacs_debit' | 'bancontact' | 'blik' | 'boleto' | 'card' | 'cashapp' | 'eps' | 'fpx' | 'giropay' | 'grabpay' | 'ideal' | 'klarna' | 'konbini' | 'link' | 'multibanco' | 'oxxo' | 'p24' | 'paynow' | 'paypal' | 'promptpay' | 'sepa_credit_transfer' | 'sepa_debit' | 'sofort' | 'us_bank_account' | 'wechat_pay';
16
+ /** @public */
17
+ export type CollectionMethod = 'charge_automatically' | 'send_invoice';
18
+ /**
19
+ * The result of the invoice collection options override extension.
20
+ * @public
21
+ */
22
+ export interface InvoiceCollectionOptionsResult {
23
+ /** Override the auto-advancement setting. Set to false to keep the invoice in draft. */
24
+ autoAdvance: boolean;
25
+ }
26
+ /** @public */
27
+ export type InvoiceCollectionOptionsInput = ({
28
+ customer: Customer;
29
+ payer: 'customer';
30
+ } | {
31
+ otherPayer: string;
32
+ payer: 'other';
33
+ } | { payer?: never }) & ({
34
+ invoiceParentType: 'other';
35
+ otherInvoiceParentType: string;
36
+ } | {
37
+ invoiceParentType: 'subscription';
38
+ subscription: SubscriptionParent;
39
+ } | { invoiceParentType: 'cadence' } | { invoiceParentType: 'contract' } | { invoiceParentType: 'quote' } | { invoiceParentType: 'schedule' } | { invoiceParentType?: never }) & { collectionOptions: CollectionOptions };
40
+ /** @public */
41
+ export interface Customer {
42
+ id: string;
43
+ metadata: Record<string, string>;
44
+ }
45
+ /** @public */
46
+ export type ContractParent = Record<string, never>;
47
+ /**
48
+ * The Subscription that triggered the invoice creation.
49
+ * @public
50
+ */
51
+ export interface SubscriptionParent {
52
+ /** The unique identifier for the subscription. */
53
+ id: string;
54
+ /** The metadata of the subscription. */
55
+ metadata: Record<string, string>;
56
+ }
57
+ /** @public */
58
+ export type ScheduleParent = Record<string, never>;
59
+ /** @public */
60
+ export type QuoteParent = Record<string, never>;
61
+ /** @public */
62
+ export type CadenceParent = Record<string, never>;
63
+ /**
64
+ * The collection options for an invoice.
65
+ * @public
66
+ */
67
+ export interface CollectionOptions {
68
+ /** Whether the invoice automatically advances through its lifecycle. */
69
+ autoAdvance: boolean;
70
+ /** The payment collection method: charge_automatically or send_invoice. */
71
+ collectionMethod: CollectionMethod;
72
+ /** The payment methods configured for this invoice. */
73
+ paymentMethods: PaymentMethodType[];
74
+ }
75
+ /* Excluded from this release type: $platformWrapOverrideOptions */
76
+ /**
77
+ * Overrides invoice collection options before a draft invoice is created.
78
+ * @public
79
+ */
80
+ export type OverrideOptionsFunction<Config> = (request: InvoiceCollectionOptionsInput, config: Config, context: Context) => InvoiceCollectionOptionsResult;
81
+ }
82
+
83
+ /**
84
+ * @example
85
+ * ```ts
86
+ * import type { Billing, Context } from '@stripe/extensibility-sdk';
87
+ *
88
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
89
+ * interface MyInvoiceCollectionOptionsConfig {}
90
+ *
91
+ * export default class MyInvoiceCollectionOptions implements Billing.InvoiceCollectionOptions<MyInvoiceCollectionOptionsConfig> {
92
+ * overrideOptions(
93
+ * request: Billing.InvoiceCollectionOptions.InvoiceCollectionOptionsInput,
94
+ * _config: MyInvoiceCollectionOptionsConfig,
95
+ * _context: Context
96
+ * ) {
97
+ * // TODO: implement your collection setting logic here
98
+ *
99
+ * return { autoAdvance: request.collectionOptions.autoAdvance };
100
+ * }
101
+ * }
102
+ *
103
+ * ```
104
+ * @public
105
+ */
106
+ export declare interface InvoiceCollectionOptions<Config> {
107
+ overrideOptions: InvoiceCollectionOptions.OverrideOptionsFunction<Config>;
108
+ }
109
+
110
+ export { }