@stripe/extensibility-sdk 0.22.4
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.md +19 -0
- package/dist/config-values/generate.cjs +262 -0
- package/dist/config-values/generate.d.ts +38 -0
- package/dist/config-values/generate.d.ts.map +1 -0
- package/dist/config-values/generate.js +232 -0
- package/dist/config-values/parse.d.ts +87 -0
- package/dist/config-values/parse.d.ts.map +1 -0
- package/dist/extensibility-sdk-alpha.d.ts +542 -0
- package/dist/extensibility-sdk-beta.d.ts +542 -0
- package/dist/extensibility-sdk-config-values-alpha.d.ts +27 -0
- package/dist/extensibility-sdk-config-values-beta.d.ts +27 -0
- package/dist/extensibility-sdk-config-values-internal.d.ts +118 -0
- package/dist/extensibility-sdk-config-values-public.d.ts +27 -0
- package/dist/extensibility-sdk-extensions-alpha.d.ts +1592 -0
- package/dist/extensibility-sdk-extensions-beta.d.ts +1592 -0
- package/dist/extensibility-sdk-extensions-internal.d.ts +1655 -0
- package/dist/extensibility-sdk-extensions-public.d.ts +1592 -0
- package/dist/extensibility-sdk-internal-alpha.d.ts +9 -0
- package/dist/extensibility-sdk-internal-beta.d.ts +9 -0
- package/dist/extensibility-sdk-internal-internal.d.ts +23 -0
- package/dist/extensibility-sdk-internal-public.d.ts +9 -0
- package/dist/extensibility-sdk-internal.d.ts +915 -0
- package/dist/extensibility-sdk-jsonschema-alpha.d.ts +3 -0
- package/dist/extensibility-sdk-jsonschema-beta.d.ts +3 -0
- package/dist/extensibility-sdk-jsonschema-internal.d.ts +15 -0
- package/dist/extensibility-sdk-jsonschema-public.d.ts +3 -0
- package/dist/extensibility-sdk-public.d.ts +542 -0
- package/dist/extensibility-sdk-stdlib-alpha.d.ts +531 -0
- package/dist/extensibility-sdk-stdlib-beta.d.ts +531 -0
- package/dist/extensibility-sdk-stdlib-internal.d.ts +904 -0
- package/dist/extensibility-sdk-stdlib-public.d.ts +531 -0
- package/dist/extensions/billing/bill/discount_calculation.d.ts +226 -0
- package/dist/extensions/billing/bill/discount_calculation.d.ts.map +1 -0
- package/dist/extensions/billing/bill/index.d.ts +2 -0
- package/dist/extensions/billing/bill/index.d.ts.map +1 -0
- package/dist/extensions/billing/customer_balance_application.d.ts +82 -0
- package/dist/extensions/billing/customer_balance_application.d.ts.map +1 -0
- package/dist/extensions/billing/index.d.ts +8 -0
- package/dist/extensions/billing/index.d.ts.map +1 -0
- package/dist/extensions/billing/invoice_collection_setting.d.ts +117 -0
- package/dist/extensions/billing/invoice_collection_setting.d.ts.map +1 -0
- package/dist/extensions/billing/prorations.d.ts +222 -0
- package/dist/extensions/billing/prorations.d.ts.map +1 -0
- package/dist/extensions/billing/recurring_billing_item_handling.d.ts +326 -0
- package/dist/extensions/billing/recurring_billing_item_handling.d.ts.map +1 -0
- package/dist/extensions/billing/types.d.ts +33 -0
- package/dist/extensions/billing/types.d.ts.map +1 -0
- package/dist/extensions/context.d.ts +9 -0
- package/dist/extensions/context.d.ts.map +1 -0
- package/dist/extensions/core/index.d.ts +3 -0
- package/dist/extensions/core/index.d.ts.map +1 -0
- package/dist/extensions/core/workflows/custom_action.d.ts +142 -0
- package/dist/extensions/core/workflows/custom_action.d.ts.map +1 -0
- package/dist/extensions/core/workflows/index.d.ts +2 -0
- package/dist/extensions/core/workflows/index.d.ts.map +1 -0
- package/dist/extensions/extend/index.d.ts +3 -0
- package/dist/extensions/extend/index.d.ts.map +1 -0
- package/dist/extensions/extend/workflows/custom_action.d.ts +142 -0
- package/dist/extensions/extend/workflows/custom_action.d.ts.map +1 -0
- package/dist/extensions/extend/workflows/index.d.ts +2 -0
- package/dist/extensions/extend/workflows/index.d.ts.map +1 -0
- package/dist/extensions/index.cjs +2356 -0
- package/dist/extensions/index.d.ts +9 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +2435 -0
- package/dist/extensions/registry.d.ts +19 -0
- package/dist/extensions/registry.d.ts.map +1 -0
- package/dist/extensions/types.d.ts +10 -0
- package/dist/extensions/types.d.ts.map +1 -0
- package/dist/index.cjs +1519 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1460 -0
- package/dist/internal.cjs +156 -0
- package/dist/internal.d.ts +3 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +128 -0
- package/dist/jsonschema.cjs +18 -0
- package/dist/jsonschema.d.ts +2 -0
- package/dist/jsonschema.d.ts.map +1 -0
- package/dist/jsonschema.js +0 -0
- package/dist/stdlib/brand.d.ts +27 -0
- package/dist/stdlib/brand.d.ts.map +1 -0
- package/dist/stdlib/decimal.d.ts +324 -0
- package/dist/stdlib/decimal.d.ts.map +1 -0
- package/dist/stdlib/extension-method.d.ts +27 -0
- package/dist/stdlib/extension-method.d.ts.map +1 -0
- package/dist/stdlib/generated.d.ts +15 -0
- package/dist/stdlib/generated.d.ts.map +1 -0
- package/dist/stdlib/index.cjs +1519 -0
- package/dist/stdlib/index.d.ts +18 -0
- package/dist/stdlib/index.d.ts.map +1 -0
- package/dist/stdlib/index.js +1460 -0
- package/dist/stdlib/refs.d.ts +62 -0
- package/dist/stdlib/refs.d.ts.map +1 -0
- package/dist/stdlib/scalars.d.ts +141 -0
- package/dist/stdlib/scalars.d.ts.map +1 -0
- package/dist/stdlib/transform-strategies.d.ts +74 -0
- package/dist/stdlib/transform-strategies.d.ts.map +1 -0
- package/dist/stdlib/transforms.d.ts +97 -0
- package/dist/stdlib/transforms.d.ts.map +1 -0
- package/dist/stdlib/type-utils.d.ts +9 -0
- package/dist/stdlib/type-utils.d.ts.map +1 -0
- package/dist/stdlib/types.d.ts +281 -0
- package/dist/stdlib/types.d.ts.map +1 -0
- package/dist/stdlib/utils.d.ts +7 -0
- package/dist/stdlib/utils.d.ts.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +111 -0
- package/tslibs/5.9.3/lib.es2022.egress.d.ts +4328 -0
- package/tslibs/5.9.3/lib.es2022.restricted.d.ts +4067 -0
- package/tslibs/lib.egress.globals.d.ts +112 -0
- package/tslibs/lib.restricted.globals.d.ts +1 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { Context } from '../../context.js';
|
|
2
|
+
import type { _ConfigApplicationContext } from '../../../stdlib/index.js';
|
|
3
|
+
/** @public */
|
|
4
|
+
export declare namespace CustomAction {
|
|
5
|
+
/**
|
|
6
|
+
* Response payload for GetFormState.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
interface GetFormStateResponse {
|
|
10
|
+
/** 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. */
|
|
11
|
+
values: Record<string, unknown>;
|
|
12
|
+
/** Per-field configuration keyed by field name. */
|
|
13
|
+
config: Record<string, FormStateFieldConfig>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Configuration for a single form field, returned by GetFormState.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
interface FormStateFieldConfig {
|
|
20
|
+
/** Dropdown options for `dynamic_select` fields. */
|
|
21
|
+
options: SelectOption[];
|
|
22
|
+
/** 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. */
|
|
23
|
+
schema: Record<string, unknown>;
|
|
24
|
+
/** Whether the field is disabled (non-interactive). */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Whether the field is hidden from the form. */
|
|
27
|
+
hidden?: boolean;
|
|
28
|
+
/** Warning message displayed on the field. You can still save the workflow. */
|
|
29
|
+
warning?: string;
|
|
30
|
+
/** Error message displayed on the field. Blocks saving the workflow. */
|
|
31
|
+
error?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* An option in a dynamic_select dropdown.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
interface SelectOption {
|
|
38
|
+
value: string;
|
|
39
|
+
label: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Request payload for GetFormState, sent at configuration time.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
interface GetFormStateRequest {
|
|
46
|
+
/** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
|
|
47
|
+
values: Record<string, unknown>;
|
|
48
|
+
/** 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. */
|
|
49
|
+
changedField?: string;
|
|
50
|
+
}
|
|
51
|
+
/** @public */
|
|
52
|
+
type ExecuteCustomActionResponse = Record<string, never>;
|
|
53
|
+
/**
|
|
54
|
+
* **************************************************************************** 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.
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
interface ExecuteCustomActionRequest {
|
|
58
|
+
/** 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. */
|
|
59
|
+
customInput: Record<string, unknown>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @public
|
|
63
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
64
|
+
*/
|
|
65
|
+
function prepareArgsExecute(proto: unknown): ExecuteCustomActionRequest;
|
|
66
|
+
/**
|
|
67
|
+
* @public
|
|
68
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
69
|
+
*/
|
|
70
|
+
function prepareResultExecute(result: ExecuteCustomActionResponse): ExecuteCustomActionResponse;
|
|
71
|
+
/** @internal */
|
|
72
|
+
function $platformWrapExecute(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
|
|
73
|
+
execute(...a: unknown[]): unknown;
|
|
74
|
+
}, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
|
|
75
|
+
/**
|
|
76
|
+
* @public
|
|
77
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
78
|
+
*/
|
|
79
|
+
function prepareArgsGetFormState(proto: unknown): GetFormStateRequest;
|
|
80
|
+
/**
|
|
81
|
+
* @public
|
|
82
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
83
|
+
*/
|
|
84
|
+
function prepareResultGetFormState(result: GetFormStateResponse): GetFormStateResponse;
|
|
85
|
+
/** @internal */
|
|
86
|
+
function $platformWrapGetFormState(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
|
|
87
|
+
getFormState(...a: unknown[]): unknown;
|
|
88
|
+
}, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
|
|
89
|
+
/**
|
|
90
|
+
* Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
type ExecuteFunction<Config extends Record<string, unknown>> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
|
|
94
|
+
/**
|
|
95
|
+
* 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.
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
type GetFormStateFunction<Config extends Record<string, unknown>> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* import type { Core } from '@stripe/extensibility-sdk/extensions';
|
|
104
|
+
* import type { Context } from '@stripe/extensibility-sdk/extensions';
|
|
105
|
+
*
|
|
106
|
+
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
107
|
+
* interface MyCustomActionConfig extends Record<string, unknown> {}
|
|
108
|
+
*
|
|
109
|
+
* export default class MyCustomAction implements Core.Workflows
|
|
110
|
+
* .CustomAction<MyCustomActionConfig> {
|
|
111
|
+
* execute(
|
|
112
|
+
* _request: Core.Workflows.CustomAction.ExecuteCustomActionRequest,
|
|
113
|
+
* _config: MyCustomActionConfig,
|
|
114
|
+
* _context: Context
|
|
115
|
+
* ) {
|
|
116
|
+
* // TODO: implement your action logic here
|
|
117
|
+
*
|
|
118
|
+
* return {};
|
|
119
|
+
* }
|
|
120
|
+
*
|
|
121
|
+
* getFormState(
|
|
122
|
+
* _request: Core.Workflows.CustomAction.GetFormStateRequest,
|
|
123
|
+
* _config: MyCustomActionConfig,
|
|
124
|
+
* _context: Context
|
|
125
|
+
* ) {
|
|
126
|
+
* // TODO: implement your logic here
|
|
127
|
+
*
|
|
128
|
+
* return {
|
|
129
|
+
* values: {},
|
|
130
|
+
* config: {},
|
|
131
|
+
* };
|
|
132
|
+
* }
|
|
133
|
+
* }
|
|
134
|
+
*
|
|
135
|
+
* ```
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
export interface CustomAction<Config extends Record<string, unknown>> {
|
|
139
|
+
execute: CustomAction.ExecuteFunction<Config>;
|
|
140
|
+
getFormState?: CustomAction.GetFormStateFunction<Config>;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=custom_action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom_action.d.ts","sourceRoot":"","sources":["../../../../src/extensions/core/workflows/custom_action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAEV,yBAAyB,EAI1B,MAAM,0BAA0B,CAAC;AAwBlC,cAAc;AACd,yBAAiB,YAAY,CAAC;IAC5B;;;OAGG;IACH,UAAiB,oBAAoB;QACnC,6OAA6O;QAC7O,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChC,mDAAmD;QACnD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC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CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/core/workflows/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/extend/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { Context } from '../../context.js';
|
|
2
|
+
import type { _ConfigApplicationContext } from '../../../stdlib/index.js';
|
|
3
|
+
/** @public */
|
|
4
|
+
export declare namespace CustomAction {
|
|
5
|
+
/**
|
|
6
|
+
* Response payload for GetFormState.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
interface GetFormStateResponse {
|
|
10
|
+
/** 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. */
|
|
11
|
+
values: Record<string, unknown>;
|
|
12
|
+
/** Per-field configuration keyed by field name. */
|
|
13
|
+
config: Record<string, FormStateFieldConfig>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Configuration for a single form field, returned by GetFormState.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
interface FormStateFieldConfig {
|
|
20
|
+
/** Dropdown options for `dynamic_select` fields. */
|
|
21
|
+
options: SelectOption[];
|
|
22
|
+
/** 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. */
|
|
23
|
+
schema: Record<string, unknown>;
|
|
24
|
+
/** Whether the field is disabled (non-interactive). */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Whether the field is hidden from the form. */
|
|
27
|
+
hidden?: boolean;
|
|
28
|
+
/** Warning message displayed on the field. You can still save the workflow. */
|
|
29
|
+
warning?: string;
|
|
30
|
+
/** Error message displayed on the field. Blocks saving the workflow. */
|
|
31
|
+
error?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* An option in a dynamic_select dropdown.
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
interface SelectOption {
|
|
38
|
+
value: string;
|
|
39
|
+
label: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Request payload for GetFormState, sent at configuration time.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
interface GetFormStateRequest {
|
|
46
|
+
/** Current form field values. Contains all field values in the form, including fields the user has not yet interacted with (which might be null). */
|
|
47
|
+
values: Record<string, unknown>;
|
|
48
|
+
/** 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. */
|
|
49
|
+
changedField?: string;
|
|
50
|
+
}
|
|
51
|
+
/** @public */
|
|
52
|
+
type ExecuteCustomActionResponse = Record<string, never>;
|
|
53
|
+
/**
|
|
54
|
+
* Request payload for executing a custom action, provided at workflow runtime.
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
interface ExecuteCustomActionRequest {
|
|
58
|
+
/** 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. */
|
|
59
|
+
customInput: Record<string, unknown>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @public
|
|
63
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
64
|
+
*/
|
|
65
|
+
function prepareArgsExecute(proto: unknown): ExecuteCustomActionRequest;
|
|
66
|
+
/**
|
|
67
|
+
* @public
|
|
68
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
69
|
+
*/
|
|
70
|
+
function prepareResultExecute(result: ExecuteCustomActionResponse): ExecuteCustomActionResponse;
|
|
71
|
+
/** @internal */
|
|
72
|
+
function $platformWrapExecute(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
|
|
73
|
+
execute(...a: unknown[]): unknown;
|
|
74
|
+
}, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
|
|
75
|
+
/**
|
|
76
|
+
* @public
|
|
77
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
78
|
+
*/
|
|
79
|
+
function prepareArgsGetFormState(proto: unknown): GetFormStateRequest;
|
|
80
|
+
/**
|
|
81
|
+
* @public
|
|
82
|
+
* @deprecated Platform dispatch handles wire/SDK conversion.
|
|
83
|
+
*/
|
|
84
|
+
function prepareResultGetFormState(result: GetFormStateResponse): GetFormStateResponse;
|
|
85
|
+
/** @internal */
|
|
86
|
+
function $platformWrapGetFormState(configTransformer?: (wireConfig: unknown, appCtx: _ConfigApplicationContext) => unknown): (cls: new () => {
|
|
87
|
+
getFormState(...a: unknown[]): unknown;
|
|
88
|
+
}, wireArgs: unknown, wireConfig: unknown, ctx: unknown) => unknown;
|
|
89
|
+
/**
|
|
90
|
+
* Executes the custom action at workflow runtime. Called when a workflow triggers this action, with the configured input values.
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
type ExecuteFunction<Config extends Record<string, unknown>> = (request: ExecuteCustomActionRequest, config: Config, context: Context) => ExecuteCustomActionResponse | PromiseLike<ExecuteCustomActionResponse>;
|
|
94
|
+
/**
|
|
95
|
+
* 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.
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
type GetFormStateFunction<Config extends Record<string, unknown>> = (request: GetFormStateRequest, config: Config, context: Context) => GetFormStateResponse | PromiseLike<GetFormStateResponse>;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* import type { Extend } from '@stripe/extensibility-sdk/extensions';
|
|
104
|
+
* import type { Context } from '@stripe/extensibility-sdk/extensions';
|
|
105
|
+
*
|
|
106
|
+
* // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
107
|
+
* interface MyCustomActionConfig extends Record<string, unknown> {}
|
|
108
|
+
*
|
|
109
|
+
* export default class MyCustomAction implements Extend.Workflows
|
|
110
|
+
* .CustomAction<MyCustomActionConfig> {
|
|
111
|
+
* execute(
|
|
112
|
+
* _request: Extend.Workflows.CustomAction.ExecuteCustomActionRequest,
|
|
113
|
+
* _config: MyCustomActionConfig,
|
|
114
|
+
* _context: Context
|
|
115
|
+
* ) {
|
|
116
|
+
* // TODO: implement your action logic here
|
|
117
|
+
*
|
|
118
|
+
* return {};
|
|
119
|
+
* }
|
|
120
|
+
*
|
|
121
|
+
* getFormState(
|
|
122
|
+
* _request: Extend.Workflows.CustomAction.GetFormStateRequest,
|
|
123
|
+
* _config: MyCustomActionConfig,
|
|
124
|
+
* _context: Context
|
|
125
|
+
* ) {
|
|
126
|
+
* // TODO: implement your logic here
|
|
127
|
+
*
|
|
128
|
+
* return {
|
|
129
|
+
* values: {},
|
|
130
|
+
* config: {},
|
|
131
|
+
* };
|
|
132
|
+
* }
|
|
133
|
+
* }
|
|
134
|
+
*
|
|
135
|
+
* ```
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
export interface CustomAction<Config extends Record<string, unknown>> {
|
|
139
|
+
execute: CustomAction.ExecuteFunction<Config>;
|
|
140
|
+
getFormState?: CustomAction.GetFormStateFunction<Config>;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=custom_action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom_action.d.ts","sourceRoot":"","sources":["../../../../src/extensions/extend/workflows/custom_action.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAEV,yBAAyB,EAI1B,M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