@payabli/component-contracts 0.5.0 → 0.6.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.
- package/dist/aliases.d.ts +1 -0
- package/dist/generated.d.ts +1 -0
- package/dist/index.js +63 -6
- package/dist/payin/definition.d.ts +0 -6
- package/dist/payin/schema.d.ts +0 -3
- package/dist/payout/definition.d.ts +29 -0
- package/dist/payout/schema.d.ts +79 -0
- package/dist/sdk.d.ts +2 -2
- package/package.json +1 -1
package/dist/aliases.d.ts
CHANGED
package/dist/generated.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1792,7 +1792,6 @@ const payinEvents = {
|
|
|
1792
1792
|
status: _enum(['verified', 'pending', 'failed', 'warning']),
|
|
1793
1793
|
message: optional(string()),
|
|
1794
1794
|
}),
|
|
1795
|
-
VENDOR_CREATED: object({ vendorId: string() }),
|
|
1796
1795
|
};
|
|
1797
1796
|
|
|
1798
1797
|
/**
|
|
@@ -1817,10 +1816,6 @@ const payInEventSchemas = {
|
|
|
1817
1816
|
event: 'validationStatus',
|
|
1818
1817
|
schema: payinEvents.VALIDATION_STATUS,
|
|
1819
1818
|
},
|
|
1820
|
-
VENDOR_CREATED: {
|
|
1821
|
-
event: 'vendorCreated',
|
|
1822
|
-
schema: payinEvents.VENDOR_CREATED,
|
|
1823
|
-
},
|
|
1824
1819
|
};
|
|
1825
1820
|
const payInDescriptor = register({
|
|
1826
1821
|
type: 'payin',
|
|
@@ -1832,6 +1827,68 @@ const payInDescriptor = register({
|
|
|
1832
1827
|
eventSchemas: payInEventSchemas,
|
|
1833
1828
|
});
|
|
1834
1829
|
|
|
1830
|
+
/**
|
|
1831
|
+
* Payout's wire contract: its event schemas, options schema, and vocabulary.
|
|
1832
|
+
* Payout has its own methods. They do not share names with PayIn's.
|
|
1833
|
+
*/
|
|
1834
|
+
const PAYOUT_METHODS = [
|
|
1835
|
+
'ach',
|
|
1836
|
+
'check',
|
|
1837
|
+
'vcard',
|
|
1838
|
+
'wire',
|
|
1839
|
+
'rtp',
|
|
1840
|
+
];
|
|
1841
|
+
/** Payout text keys. The iframe drops other keys, trims values, and limits text to 120 characters. */
|
|
1842
|
+
const PAYOUT_LABEL_KEYS = [
|
|
1843
|
+
'submit',
|
|
1844
|
+
'method-ach',
|
|
1845
|
+
'method-check',
|
|
1846
|
+
'method-vcard',
|
|
1847
|
+
'method-wire',
|
|
1848
|
+
'method-rtp',
|
|
1849
|
+
'label.ach.holderName',
|
|
1850
|
+
'placeholder.ach.holderName',
|
|
1851
|
+
'label.ach.holderType',
|
|
1852
|
+
'label.ach.accountType',
|
|
1853
|
+
'label.ach.routingNumber',
|
|
1854
|
+
'placeholder.ach.routingNumber',
|
|
1855
|
+
'label.ach.accountNumber',
|
|
1856
|
+
'placeholder.ach.accountNumber',
|
|
1857
|
+
'label.vcard.code',
|
|
1858
|
+
];
|
|
1859
|
+
/**
|
|
1860
|
+
* Client-side UI behavior only. The partner server sets operation, methods,
|
|
1861
|
+
* vendorData, paymentDetails, invoiceData, and saveIfSuccess through
|
|
1862
|
+
* `Session/init`. The SDK sends this in CONFIG_SET.options and payhub parses
|
|
1863
|
+
* with this same object.
|
|
1864
|
+
*/
|
|
1865
|
+
const payoutOptionsSchema = object({
|
|
1866
|
+
initialMethod: optional(_enum(PAYOUT_METHODS)
|
|
1867
|
+
.check(describe('Select this method first when session-allowed. Otherwise, use the first method in the effective order.'))),
|
|
1868
|
+
methodOrder: optional(array(_enum(PAYOUT_METHODS))
|
|
1869
|
+
.check(describe('Order session-allowed methods only. Ignore disallowed entries and duplicates after the first occurrence. Append unlisted allowed methods in the PAYOUT_METHODS order.'))),
|
|
1870
|
+
showSubmitButton: optional(boolean()
|
|
1871
|
+
.check(describe('Render the submit button inside the component. Set false when the host page owns the button and calls submit().'))),
|
|
1872
|
+
});
|
|
1873
|
+
/** Payout's own inbound events, beyond the base set every component shares. */
|
|
1874
|
+
const payoutEvents = {
|
|
1875
|
+
METHOD_CHANGE: object({ method: _enum(PAYOUT_METHODS) }),
|
|
1876
|
+
};
|
|
1877
|
+
|
|
1878
|
+
/** Wire type → emitter event, with the shared schema from `./schema.js` as the only validator. */
|
|
1879
|
+
const payoutEventSchemas = {
|
|
1880
|
+
METHOD_CHANGE: { event: 'methodChange', schema: payoutEvents.METHOD_CHANGE },
|
|
1881
|
+
};
|
|
1882
|
+
const payoutDescriptor = register({
|
|
1883
|
+
type: 'payout',
|
|
1884
|
+
displayName: 'Payout',
|
|
1885
|
+
frameLabel: 'Payout form',
|
|
1886
|
+
embedPath: '/embed/payout',
|
|
1887
|
+
endsOnSuccess: false,
|
|
1888
|
+
optionsSchema: payoutOptionsSchema,
|
|
1889
|
+
eventSchemas: payoutEventSchemas,
|
|
1890
|
+
});
|
|
1891
|
+
|
|
1835
1892
|
const ErrorCodes = {
|
|
1836
1893
|
LOAD_TIMEOUT: 'LOAD_TIMEOUT',
|
|
1837
1894
|
PROTOCOL_ERROR: 'PROTOCOL_ERROR',
|
|
@@ -1873,4 +1930,4 @@ const BASE_COMPONENT_EVENT_NAMES = [
|
|
|
1873
1930
|
'resize',
|
|
1874
1931
|
];
|
|
1875
1932
|
|
|
1876
|
-
export { BASE_COMPONENT_EVENT_NAMES, CARD_BRANDS, ErrorCodes, FORM_METHODS, MESSAGE_SOURCE, MESSAGE_VERSION, PAYIN_LABEL_KEYS, PAYMENT_METHODS, appearanceSchema, baseInboundEvents, componentDescriptors, componentErrorSchema, componentTypes, eventEnvelopeSchema, getComponentDescriptor, onboardingDescriptor, onboardingEventSchemas, onboardingEvents, onboardingOptionsSchema, outboundMessages, parseEnvelope, parseMessage, parsePayload, payInDescriptor, payInEventSchemas, payinEvents, payinOptionsSchema, register };
|
|
1933
|
+
export { BASE_COMPONENT_EVENT_NAMES, CARD_BRANDS, ErrorCodes, FORM_METHODS, MESSAGE_SOURCE, MESSAGE_VERSION, PAYIN_LABEL_KEYS, PAYMENT_METHODS, PAYOUT_LABEL_KEYS, PAYOUT_METHODS, appearanceSchema, baseInboundEvents, componentDescriptors, componentErrorSchema, componentTypes, eventEnvelopeSchema, getComponentDescriptor, onboardingDescriptor, onboardingEventSchemas, onboardingEvents, onboardingOptionsSchema, outboundMessages, parseEnvelope, parseMessage, parsePayload, payInDescriptor, payInEventSchemas, payinEvents, payinOptionsSchema, payoutDescriptor, payoutEventSchemas, payoutEvents, payoutOptionsSchema, register };
|
|
@@ -80,11 +80,5 @@ export declare const payInEventSchemas: {
|
|
|
80
80
|
message: import("zod/v4/mini").ZodMiniOptional<import("zod/v4/mini").ZodMiniString<string>>;
|
|
81
81
|
}, import("zod/v4/core").$strip>;
|
|
82
82
|
};
|
|
83
|
-
VENDOR_CREATED: {
|
|
84
|
-
event: "vendorCreated";
|
|
85
|
-
schema: import("zod/v4/mini").ZodMiniObject<{
|
|
86
|
-
vendorId: import("zod/v4/mini").ZodMiniString<string>;
|
|
87
|
-
}, import("zod/v4/core").$strip>;
|
|
88
|
-
};
|
|
89
83
|
};
|
|
90
84
|
export declare const payInDescriptor: import("../registry.js").ComponentDescriptor<"payin">;
|
package/dist/payin/schema.d.ts
CHANGED
|
@@ -88,9 +88,6 @@ export declare const payinEvents: {
|
|
|
88
88
|
}>;
|
|
89
89
|
message: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
90
90
|
}, z.core.$strip>;
|
|
91
|
-
readonly VENDOR_CREATED: z.ZodMiniObject<{
|
|
92
|
-
vendorId: z.ZodMiniString<string>;
|
|
93
|
-
}, z.core.$strip>;
|
|
94
91
|
};
|
|
95
92
|
/** The session operation the payload reports on. */
|
|
96
93
|
export type PayInOperation = 'pay' | 'auth' | 'tokenize';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Infer, InferEvents } from '../protocol/envelope.js';
|
|
2
|
+
import { payoutEvents, payoutOptionsSchema } from './schema.js';
|
|
3
|
+
import type { PayoutSuccessPayload } from './schema.js';
|
|
4
|
+
export * from './schema.js';
|
|
5
|
+
/** The partner-facing options type is the wire schema's type. */
|
|
6
|
+
export type PayoutOptions = Infer<typeof payoutOptionsSchema>;
|
|
7
|
+
declare module '../registry.js' {
|
|
8
|
+
interface ComponentDefinitions {
|
|
9
|
+
payout: ComponentDefinition<PayoutOptions, InferEvents<typeof payoutEvents> & {
|
|
10
|
+
success: PayoutSuccessPayload;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** Wire type → emitter event, with the shared schema from `./schema.js` as the only validator. */
|
|
15
|
+
export declare const payoutEventSchemas: {
|
|
16
|
+
METHOD_CHANGE: {
|
|
17
|
+
event: "methodChange";
|
|
18
|
+
schema: import("zod/v4/mini").ZodMiniObject<{
|
|
19
|
+
method: import("zod/v4/mini").ZodMiniEnum<{
|
|
20
|
+
ach: "ach";
|
|
21
|
+
check: "check";
|
|
22
|
+
vcard: "vcard";
|
|
23
|
+
wire: "wire";
|
|
24
|
+
rtp: "rtp";
|
|
25
|
+
}>;
|
|
26
|
+
}, import("zod/v4/core").$strip>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare const payoutDescriptor: import("../registry.js").ComponentDescriptor<"payout">;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as z from 'zod/v4/mini';
|
|
2
|
+
/**
|
|
3
|
+
* Payout's wire contract: its event schemas, options schema, and vocabulary.
|
|
4
|
+
* Payout has its own methods. They do not share names with PayIn's.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PAYOUT_METHODS: readonly ["ach", "check", "vcard", "wire", "rtp"];
|
|
7
|
+
export type PayoutMethodName = (typeof PAYOUT_METHODS)[number];
|
|
8
|
+
/** Payout text keys. The iframe drops other keys, trims values, and limits text to 120 characters. */
|
|
9
|
+
export declare const PAYOUT_LABEL_KEYS: readonly ["submit", "method-ach", "method-check", "method-vcard", "method-wire", "method-rtp", "label.ach.holderName", "placeholder.ach.holderName", "label.ach.holderType", "label.ach.accountType", "label.ach.routingNumber", "placeholder.ach.routingNumber", "label.ach.accountNumber", "placeholder.ach.accountNumber", "label.vcard.code"];
|
|
10
|
+
export type PayoutLabelKey = (typeof PAYOUT_LABEL_KEYS)[number];
|
|
11
|
+
/**
|
|
12
|
+
* Client-side UI behavior only. The partner server sets operation, methods,
|
|
13
|
+
* vendorData, paymentDetails, invoiceData, and saveIfSuccess through
|
|
14
|
+
* `Session/init`. The SDK sends this in CONFIG_SET.options and payhub parses
|
|
15
|
+
* with this same object.
|
|
16
|
+
*/
|
|
17
|
+
export declare const payoutOptionsSchema: z.ZodMiniObject<{
|
|
18
|
+
initialMethod: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
19
|
+
ach: "ach";
|
|
20
|
+
check: "check";
|
|
21
|
+
vcard: "vcard";
|
|
22
|
+
wire: "wire";
|
|
23
|
+
rtp: "rtp";
|
|
24
|
+
}>>;
|
|
25
|
+
methodOrder: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniEnum<{
|
|
26
|
+
ach: "ach";
|
|
27
|
+
check: "check";
|
|
28
|
+
vcard: "vcard";
|
|
29
|
+
wire: "wire";
|
|
30
|
+
rtp: "rtp";
|
|
31
|
+
}>>>;
|
|
32
|
+
showSubmitButton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
/** Payout's own inbound events, beyond the base set every component shares. */
|
|
35
|
+
export declare const payoutEvents: {
|
|
36
|
+
readonly METHOD_CHANGE: z.ZodMiniObject<{
|
|
37
|
+
method: z.ZodMiniEnum<{
|
|
38
|
+
ach: "ach";
|
|
39
|
+
check: "check";
|
|
40
|
+
vcard: "vcard";
|
|
41
|
+
wire: "wire";
|
|
42
|
+
rtp: "rtp";
|
|
43
|
+
}>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
};
|
|
46
|
+
/** The session operation the payload reports on. Same names as PayIn. */
|
|
47
|
+
export type PayoutOperation = 'pay' | 'auth' | 'tokenize';
|
|
48
|
+
/**
|
|
49
|
+
* SUBMIT_RESULT.data for Payout: the `success` event payload and the
|
|
50
|
+
* `submit()` result. One closed shape for every operation, like PayIn. payhub
|
|
51
|
+
* builds it from the API result. Card data, account numbers, and addresses
|
|
52
|
+
* never go in it.
|
|
53
|
+
*/
|
|
54
|
+
export type PayoutSuccessPayload = {
|
|
55
|
+
operation: PayoutOperation;
|
|
56
|
+
/** The method the vendor used. */
|
|
57
|
+
method: PayoutMethodName;
|
|
58
|
+
/** The vendor from the session config. */
|
|
59
|
+
vendorId: number;
|
|
60
|
+
/** The MoneyOut transaction id. Present for `pay` and `auth`. */
|
|
61
|
+
transactionId?: string;
|
|
62
|
+
/**
|
|
63
|
+
* The saved vendor payment method id. Present for `tokenize`, and for `pay`
|
|
64
|
+
* or `auth` when the session saved the method.
|
|
65
|
+
*/
|
|
66
|
+
storedMethodId?: string;
|
|
67
|
+
paymentMethod?: {
|
|
68
|
+
/** The account with every digit but the last four hidden. */
|
|
69
|
+
maskedAccount?: string;
|
|
70
|
+
accountType?: 'checking' | 'savings';
|
|
71
|
+
holderName?: string;
|
|
72
|
+
};
|
|
73
|
+
/** The paid or authorized amount. Present for `pay` and `auth`. */
|
|
74
|
+
amount?: {
|
|
75
|
+
total: number;
|
|
76
|
+
serviceFee?: number;
|
|
77
|
+
currency?: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
package/dist/sdk.d.ts
CHANGED
|
@@ -41,8 +41,8 @@ export interface CreateOptions<T extends ComponentType = ComponentType> {
|
|
|
41
41
|
key?: string;
|
|
42
42
|
appearance?: AppearanceOptions;
|
|
43
43
|
options?: ComponentOptions<T>;
|
|
44
|
-
/** Not supported by PayIn or
|
|
45
|
-
prefill?: T extends 'payin' | 'onboarding' ? never : Record<string, string>;
|
|
44
|
+
/** Not supported by PayIn, Onboarding, or Payout: the server session owns their data. */
|
|
45
|
+
prefill?: T extends 'payin' | 'onboarding' | 'payout' ? never : Record<string, string>;
|
|
46
46
|
locale?: string;
|
|
47
47
|
timeout?: number;
|
|
48
48
|
}
|
package/package.json
CHANGED