@stripe/extensibility-sdk 1.1.0 → 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,126 @@
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 CustomAction {
14
+ /**
15
+ * Response payload for GetFormState.
16
+ * @public
17
+ */
18
+ export interface GetFormStateResponse {
19
+ /** Updated form field values. Use this to set defaults, clear dependent fields when a parent changes, or preserve matching values across schema changes. Only fields included here are updated. Omitted fields keep their current values. */
20
+ values?: Record<string, unknown>;
21
+ /** Per-field configuration keyed by field name. */
22
+ config: Record<string, FormStateFieldConfig>;
23
+ }
24
+ /**
25
+ * Configuration for a single form field, returned by GetFormState.
26
+ * @public
27
+ */
28
+ export interface FormStateFieldConfig {
29
+ /** Dropdown options for `dynamic_select` fields. */
30
+ options: SelectOption[];
31
+ /** JSON Schema for dynamic_schema fields. Defines the structure of a dynamic object field (for example, template merge variables). V0 limitation: must be a flat object with string properties only. */
32
+ schema: Record<string, unknown>;
33
+ /** Whether the field is disabled (non-interactive). */
34
+ disabled?: boolean;
35
+ /** Whether the field is hidden from the form. */
36
+ hidden?: boolean;
37
+ /** Warning message displayed on the field. You can still save the workflow. */
38
+ warning?: string;
39
+ /** Error message displayed on the field. Blocks saving the workflow. */
40
+ error?: string;
41
+ }
42
+ /**
43
+ * An option in a dynamic_select dropdown.
44
+ * @public
45
+ */
46
+ export interface SelectOption {
47
+ value: string;
48
+ label: string;
49
+ }
50
+ /**
51
+ * Request payload for GetFormState, sent at configuration time.
52
+ * @public
53
+ */
54
+ export interface GetFormStateRequest {
55
+ /** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
56
+ values: Record<string, unknown>;
57
+ /** The name of the field that just changed, triggering this request. Empty on initial form load; set to the field name (for example, `audience_id`) when a user changes a value. */
58
+ changedField?: string;
59
+ }
60
+ /** @public */
61
+ export type ExecuteCustomActionResponse = Record<string, never>;
62
+ /**
63
+ * **************************************************************************** DEPRECATED: This proto is deprecated and should no longer be used. Please use the following proto instead: ***************************************************************************** / /** Request payload for executing a custom action, provided at workflow runtime.
64
+ * @public
65
+ */
66
+ export interface ExecuteCustomActionRequest {
67
+ /** Custom input data for the action, validated against the app's input_schema. Contains the field values configured by the user in the workflow builder. */
68
+ customInput: Record<string, unknown>;
69
+ }
70
+ /* Excluded from this release type: $platformWrapExecute */
71
+ /* Excluded from this release type: $platformWrapGetFormState */
72
+ /**
73
+ * Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
74
+ * @public
75
+ */
76
+ export type ExecuteFunction<Config> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
77
+ /**
78
+ * Returns the current form state for the action's configuration UI. Called at configuration time (not runtime) to power dynamic form behavior, including dropdown options, dynamic JSON schemas, field visibility, and validation.
79
+ * @public
80
+ */
81
+ export type GetFormStateFunction<Config> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
82
+ }
83
+
84
+ /**
85
+ * @example
86
+ * ```ts
87
+ * import type { Core, Context } from '@stripe/extensibility-sdk';
88
+ *
89
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
90
+ * interface MyCustomActionConfig {}
91
+ *
92
+ * export default class MyCustomAction implements Core.Workflows
93
+ * .CustomAction<MyCustomActionConfig> {
94
+ * execute(
95
+ * _request: Core.Workflows.CustomAction.ExecuteCustomActionRequest,
96
+ * _config: MyCustomActionConfig,
97
+ * _context: Context
98
+ * ) {
99
+ * // TODO: implement your action logic here
100
+ *
101
+ * return {};
102
+ * }
103
+ *
104
+ * getFormState(
105
+ * _request: Core.Workflows.CustomAction.GetFormStateRequest,
106
+ * _config: MyCustomActionConfig,
107
+ * _context: Context
108
+ * ) {
109
+ * // TODO: implement your logic here
110
+ *
111
+ * return {
112
+ * values: {},
113
+ * config: {},
114
+ * };
115
+ * }
116
+ * }
117
+ *
118
+ * ```
119
+ * @public
120
+ */
121
+ export declare interface CustomAction<Config> {
122
+ execute: CustomAction.ExecuteFunction<Config>;
123
+ getFormState?: CustomAction.GetFormStateFunction<Config>;
124
+ }
125
+
126
+ export { }
@@ -0,0 +1,126 @@
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 CustomAction {
14
+ /**
15
+ * Response payload for GetFormState.
16
+ * @public
17
+ */
18
+ export interface GetFormStateResponse {
19
+ /** Updated form field values. Use this to set defaults, clear dependent fields when a parent changes, or preserve matching values across schema changes. Only fields included here are updated. Omitted fields keep their current values. */
20
+ values?: Record<string, unknown>;
21
+ /** Per-field configuration keyed by field name. */
22
+ config: Record<string, FormStateFieldConfig>;
23
+ }
24
+ /**
25
+ * Configuration for a single form field, returned by GetFormState.
26
+ * @public
27
+ */
28
+ export interface FormStateFieldConfig {
29
+ /** Dropdown options for `dynamic_select` fields. */
30
+ options: SelectOption[];
31
+ /** JSON Schema for dynamic_schema fields. Defines the structure of a dynamic object field (for example, template merge variables). V0 limitation: must be a flat object with string properties only. */
32
+ schema: Record<string, unknown>;
33
+ /** Whether the field is disabled (non-interactive). */
34
+ disabled?: boolean;
35
+ /** Whether the field is hidden from the form. */
36
+ hidden?: boolean;
37
+ /** Warning message displayed on the field. You can still save the workflow. */
38
+ warning?: string;
39
+ /** Error message displayed on the field. Blocks saving the workflow. */
40
+ error?: string;
41
+ }
42
+ /**
43
+ * An option in a dynamic_select dropdown.
44
+ * @public
45
+ */
46
+ export interface SelectOption {
47
+ value: string;
48
+ label: string;
49
+ }
50
+ /**
51
+ * Request payload for GetFormState, sent at configuration time.
52
+ * @public
53
+ */
54
+ export interface GetFormStateRequest {
55
+ /** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
56
+ values: Record<string, unknown>;
57
+ /** The name of the field that just changed, triggering this request. Empty on initial form load; set to the field name (for example, `audience_id`) when a user changes a value. */
58
+ changedField?: string;
59
+ }
60
+ /** @public */
61
+ export type ExecuteCustomActionResponse = Record<string, never>;
62
+ /**
63
+ * **************************************************************************** DEPRECATED: This proto is deprecated and should no longer be used. Please use the following proto instead: ***************************************************************************** / /** Request payload for executing a custom action, provided at workflow runtime.
64
+ * @public
65
+ */
66
+ export interface ExecuteCustomActionRequest {
67
+ /** Custom input data for the action, validated against the app's input_schema. Contains the field values configured by the user in the workflow builder. */
68
+ customInput: Record<string, unknown>;
69
+ }
70
+ /* Excluded from this release type: $platformWrapExecute */
71
+ /* Excluded from this release type: $platformWrapGetFormState */
72
+ /**
73
+ * Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
74
+ * @public
75
+ */
76
+ export type ExecuteFunction<Config> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
77
+ /**
78
+ * Returns the current form state for the action's configuration UI. Called at configuration time (not runtime) to power dynamic form behavior, including dropdown options, dynamic JSON schemas, field visibility, and validation.
79
+ * @public
80
+ */
81
+ export type GetFormStateFunction<Config> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
82
+ }
83
+
84
+ /**
85
+ * @example
86
+ * ```ts
87
+ * import type { Core, Context } from '@stripe/extensibility-sdk';
88
+ *
89
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
90
+ * interface MyCustomActionConfig {}
91
+ *
92
+ * export default class MyCustomAction implements Core.Workflows
93
+ * .CustomAction<MyCustomActionConfig> {
94
+ * execute(
95
+ * _request: Core.Workflows.CustomAction.ExecuteCustomActionRequest,
96
+ * _config: MyCustomActionConfig,
97
+ * _context: Context
98
+ * ) {
99
+ * // TODO: implement your action logic here
100
+ *
101
+ * return {};
102
+ * }
103
+ *
104
+ * getFormState(
105
+ * _request: Core.Workflows.CustomAction.GetFormStateRequest,
106
+ * _config: MyCustomActionConfig,
107
+ * _context: Context
108
+ * ) {
109
+ * // TODO: implement your logic here
110
+ *
111
+ * return {
112
+ * values: {},
113
+ * config: {},
114
+ * };
115
+ * }
116
+ * }
117
+ *
118
+ * ```
119
+ * @public
120
+ */
121
+ export declare interface CustomAction<Config> {
122
+ execute: CustomAction.ExecuteFunction<Config>;
123
+ getFormState?: CustomAction.GetFormStateFunction<Config>;
124
+ }
125
+
126
+ export { }
@@ -0,0 +1,140 @@
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 CustomAction {
26
+ /**
27
+ * Response payload for GetFormState.
28
+ * @public
29
+ */
30
+ export interface GetFormStateResponse {
31
+ /** Updated form field values. Use this to set defaults, clear dependent fields when a parent changes, or preserve matching values across schema changes. Only fields included here are updated. Omitted fields keep their current values. */
32
+ values?: Record<string, unknown>;
33
+ /** Per-field configuration keyed by field name. */
34
+ config: Record<string, FormStateFieldConfig>;
35
+ }
36
+ /**
37
+ * Configuration for a single form field, returned by GetFormState.
38
+ * @public
39
+ */
40
+ export interface FormStateFieldConfig {
41
+ /** Dropdown options for `dynamic_select` fields. */
42
+ options: SelectOption[];
43
+ /** JSON Schema for dynamic_schema fields. Defines the structure of a dynamic object field (for example, template merge variables). V0 limitation: must be a flat object with string properties only. */
44
+ schema: Record<string, unknown>;
45
+ /** Whether the field is disabled (non-interactive). */
46
+ disabled?: boolean;
47
+ /** Whether the field is hidden from the form. */
48
+ hidden?: boolean;
49
+ /** Warning message displayed on the field. You can still save the workflow. */
50
+ warning?: string;
51
+ /** Error message displayed on the field. Blocks saving the workflow. */
52
+ error?: string;
53
+ }
54
+ /**
55
+ * An option in a dynamic_select dropdown.
56
+ * @public
57
+ */
58
+ export interface SelectOption {
59
+ value: string;
60
+ label: string;
61
+ }
62
+ /**
63
+ * Request payload for GetFormState, sent at configuration time.
64
+ * @public
65
+ */
66
+ export interface GetFormStateRequest {
67
+ /** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
68
+ values: Record<string, unknown>;
69
+ /** The name of the field that just changed, triggering this request. Empty on initial form load; set to the field name (for example, `audience_id`) when a user changes a value. */
70
+ changedField?: string;
71
+ }
72
+ /** @public */
73
+ export type ExecuteCustomActionResponse = Record<string, never>;
74
+ /**
75
+ * **************************************************************************** DEPRECATED: This proto is deprecated and should no longer be used. Please use the following proto instead: ***************************************************************************** / /** Request payload for executing a custom action, provided at workflow runtime.
76
+ * @public
77
+ */
78
+ export interface ExecuteCustomActionRequest {
79
+ /** Custom input data for the action, validated against the app's input_schema. Contains the field values configured by the user in the workflow builder. */
80
+ customInput: Record<string, unknown>;
81
+ }
82
+ /** @internal */
83
+ export function $platformWrapExecute(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => { execute(...a: unknown[]): unknown }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
84
+ /** @internal */
85
+ export function $platformWrapGetFormState(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => { getFormState(...a: unknown[]): unknown }, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
86
+ /**
87
+ * Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
88
+ * @public
89
+ */
90
+ export type ExecuteFunction<Config> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
91
+ /**
92
+ * Returns the current form state for the action's configuration UI. Called at configuration time (not runtime) to power dynamic form behavior, including dropdown options, dynamic JSON schemas, field visibility, and validation.
93
+ * @public
94
+ */
95
+ export type GetFormStateFunction<Config> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
96
+ }
97
+
98
+ /**
99
+ * @example
100
+ * ```ts
101
+ * import type { Core, Context } from '@stripe/extensibility-sdk';
102
+ *
103
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
104
+ * interface MyCustomActionConfig {}
105
+ *
106
+ * export default class MyCustomAction implements Core.Workflows
107
+ * .CustomAction<MyCustomActionConfig> {
108
+ * execute(
109
+ * _request: Core.Workflows.CustomAction.ExecuteCustomActionRequest,
110
+ * _config: MyCustomActionConfig,
111
+ * _context: Context
112
+ * ) {
113
+ * // TODO: implement your action logic here
114
+ *
115
+ * return {};
116
+ * }
117
+ *
118
+ * getFormState(
119
+ * _request: Core.Workflows.CustomAction.GetFormStateRequest,
120
+ * _config: MyCustomActionConfig,
121
+ * _context: Context
122
+ * ) {
123
+ * // TODO: implement your logic here
124
+ *
125
+ * return {
126
+ * values: {},
127
+ * config: {},
128
+ * };
129
+ * }
130
+ * }
131
+ *
132
+ * ```
133
+ * @public
134
+ */
135
+ export declare interface CustomAction<Config> {
136
+ execute: CustomAction.ExecuteFunction<Config>;
137
+ getFormState?: CustomAction.GetFormStateFunction<Config>;
138
+ }
139
+
140
+ export { }
@@ -0,0 +1,126 @@
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 CustomAction {
14
+ /**
15
+ * Response payload for GetFormState.
16
+ * @public
17
+ */
18
+ export interface GetFormStateResponse {
19
+ /** Updated form field values. Use this to set defaults, clear dependent fields when a parent changes, or preserve matching values across schema changes. Only fields included here are updated. Omitted fields keep their current values. */
20
+ values?: Record<string, unknown>;
21
+ /** Per-field configuration keyed by field name. */
22
+ config: Record<string, FormStateFieldConfig>;
23
+ }
24
+ /**
25
+ * Configuration for a single form field, returned by GetFormState.
26
+ * @public
27
+ */
28
+ export interface FormStateFieldConfig {
29
+ /** Dropdown options for `dynamic_select` fields. */
30
+ options: SelectOption[];
31
+ /** JSON Schema for dynamic_schema fields. Defines the structure of a dynamic object field (for example, template merge variables). V0 limitation: must be a flat object with string properties only. */
32
+ schema: Record<string, unknown>;
33
+ /** Whether the field is disabled (non-interactive). */
34
+ disabled?: boolean;
35
+ /** Whether the field is hidden from the form. */
36
+ hidden?: boolean;
37
+ /** Warning message displayed on the field. You can still save the workflow. */
38
+ warning?: string;
39
+ /** Error message displayed on the field. Blocks saving the workflow. */
40
+ error?: string;
41
+ }
42
+ /**
43
+ * An option in a dynamic_select dropdown.
44
+ * @public
45
+ */
46
+ export interface SelectOption {
47
+ value: string;
48
+ label: string;
49
+ }
50
+ /**
51
+ * Request payload for GetFormState, sent at configuration time.
52
+ * @public
53
+ */
54
+ export interface GetFormStateRequest {
55
+ /** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
56
+ values: Record<string, unknown>;
57
+ /** The name of the field that just changed, triggering this request. Empty on initial form load; set to the field name (for example, `audience_id`) when a user changes a value. */
58
+ changedField?: string;
59
+ }
60
+ /** @public */
61
+ export type ExecuteCustomActionResponse = Record<string, never>;
62
+ /**
63
+ * **************************************************************************** DEPRECATED: This proto is deprecated and should no longer be used. Please use the following proto instead: ***************************************************************************** / /** Request payload for executing a custom action, provided at workflow runtime.
64
+ * @public
65
+ */
66
+ export interface ExecuteCustomActionRequest {
67
+ /** Custom input data for the action, validated against the app's input_schema. Contains the field values configured by the user in the workflow builder. */
68
+ customInput: Record<string, unknown>;
69
+ }
70
+ /* Excluded from this release type: $platformWrapExecute */
71
+ /* Excluded from this release type: $platformWrapGetFormState */
72
+ /**
73
+ * Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
74
+ * @public
75
+ */
76
+ export type ExecuteFunction<Config> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
77
+ /**
78
+ * Returns the current form state for the action's configuration UI. Called at configuration time (not runtime) to power dynamic form behavior, including dropdown options, dynamic JSON schemas, field visibility, and validation.
79
+ * @public
80
+ */
81
+ export type GetFormStateFunction<Config> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
82
+ }
83
+
84
+ /**
85
+ * @example
86
+ * ```ts
87
+ * import type { Core, Context } from '@stripe/extensibility-sdk';
88
+ *
89
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
90
+ * interface MyCustomActionConfig {}
91
+ *
92
+ * export default class MyCustomAction implements Core.Workflows
93
+ * .CustomAction<MyCustomActionConfig> {
94
+ * execute(
95
+ * _request: Core.Workflows.CustomAction.ExecuteCustomActionRequest,
96
+ * _config: MyCustomActionConfig,
97
+ * _context: Context
98
+ * ) {
99
+ * // TODO: implement your action logic here
100
+ *
101
+ * return {};
102
+ * }
103
+ *
104
+ * getFormState(
105
+ * _request: Core.Workflows.CustomAction.GetFormStateRequest,
106
+ * _config: MyCustomActionConfig,
107
+ * _context: Context
108
+ * ) {
109
+ * // TODO: implement your logic here
110
+ *
111
+ * return {
112
+ * values: {},
113
+ * config: {},
114
+ * };
115
+ * }
116
+ * }
117
+ *
118
+ * ```
119
+ * @public
120
+ */
121
+ export declare interface CustomAction<Config> {
122
+ execute: CustomAction.ExecuteFunction<Config>;
123
+ getFormState?: CustomAction.GetFormStateFunction<Config>;
124
+ }
125
+
126
+ export { }
@@ -0,0 +1,126 @@
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 CustomAction {
14
+ /**
15
+ * Response payload for GetFormState.
16
+ * @public
17
+ */
18
+ export interface GetFormStateResponse {
19
+ /** Updated form field values. Use this to set defaults, clear dependent fields when a parent changes, or preserve matching values across schema changes. Only fields included here are updated. Omitted fields keep their current values. */
20
+ values?: Record<string, unknown>;
21
+ /** Per-field configuration keyed by field name. */
22
+ config: Record<string, FormStateFieldConfig>;
23
+ }
24
+ /**
25
+ * Configuration for a single form field, returned by GetFormState.
26
+ * @public
27
+ */
28
+ export interface FormStateFieldConfig {
29
+ /** Dropdown options for `dynamic_select` fields. */
30
+ options: SelectOption[];
31
+ /** JSON Schema for dynamic_schema fields. Defines the structure of a dynamic object field (for example, template merge variables). V0 limitation: must be a flat object with string properties only. */
32
+ schema: Record<string, unknown>;
33
+ /** Whether the field is disabled (non-interactive). */
34
+ disabled?: boolean;
35
+ /** Whether the field is hidden from the form. */
36
+ hidden?: boolean;
37
+ /** Warning message displayed on the field. You can still save the workflow. */
38
+ warning?: string;
39
+ /** Error message displayed on the field. Blocks saving the workflow. */
40
+ error?: string;
41
+ }
42
+ /**
43
+ * An option in a dynamic_select dropdown.
44
+ * @public
45
+ */
46
+ export interface SelectOption {
47
+ value: string;
48
+ label: string;
49
+ }
50
+ /**
51
+ * Request payload for GetFormState, sent at configuration time.
52
+ * @public
53
+ */
54
+ export interface GetFormStateRequest {
55
+ /** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
56
+ values: Record<string, unknown>;
57
+ /** The name of the field that just changed, triggering this request. Empty on initial form load; set to the field name (for example, `audience_id`) when a user changes a value. */
58
+ changedField?: string;
59
+ }
60
+ /** @public */
61
+ export type ExecuteCustomActionResponse = Record<string, never>;
62
+ /**
63
+ * Request payload for executing a custom action, provided at workflow runtime.
64
+ * @public
65
+ */
66
+ export interface ExecuteCustomActionRequest {
67
+ /** Custom input data for the action, validated against the app's input_schema. Contains the field values configured by the user in the workflow builder. */
68
+ customInput: Record<string, unknown>;
69
+ }
70
+ /* Excluded from this release type: $platformWrapExecute */
71
+ /* Excluded from this release type: $platformWrapGetFormState */
72
+ /**
73
+ * Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
74
+ * @public
75
+ */
76
+ export type ExecuteFunction<Config> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
77
+ /**
78
+ * Returns the current form state for the action's configuration UI. Called at configuration time (not runtime) to power dynamic form behavior, including dropdown options, dynamic JSON schemas, field visibility, and validation.
79
+ * @public
80
+ */
81
+ export type GetFormStateFunction<Config> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
82
+ }
83
+
84
+ /**
85
+ * @example
86
+ * ```ts
87
+ * import type { Extend, Context } from '@stripe/extensibility-sdk';
88
+ *
89
+ * // eslint-disable-next-line @typescript-eslint/no-empty-object-type
90
+ * interface MyCustomActionConfig {}
91
+ *
92
+ * export default class MyCustomAction implements Extend.Workflows
93
+ * .CustomAction<MyCustomActionConfig> {
94
+ * execute(
95
+ * _request: Extend.Workflows.CustomAction.ExecuteCustomActionRequest,
96
+ * _config: MyCustomActionConfig,
97
+ * _context: Context
98
+ * ) {
99
+ * // TODO: implement your action logic here
100
+ *
101
+ * return {};
102
+ * }
103
+ *
104
+ * getFormState(
105
+ * _request: Extend.Workflows.CustomAction.GetFormStateRequest,
106
+ * _config: MyCustomActionConfig,
107
+ * _context: Context
108
+ * ) {
109
+ * // TODO: implement your logic here
110
+ *
111
+ * return {
112
+ * values: {},
113
+ * config: {},
114
+ * };
115
+ * }
116
+ * }
117
+ *
118
+ * ```
119
+ * @public
120
+ */
121
+ export declare interface CustomAction<Config> {
122
+ execute: CustomAction.ExecuteFunction<Config>;
123
+ getFormState?: CustomAction.GetFormStateFunction<Config>;
124
+ }
125
+
126
+ export { }