@payabli/component-contracts 0.1.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/README.md +30 -0
- package/dist/aliases.d.ts +2 -0
- package/dist/errors.d.ts +27 -0
- package/dist/generated.d.ts +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1721 -0
- package/dist/payin/definition.d.ts +81 -0
- package/dist/payin/schema.d.ts +72 -0
- package/dist/protocol/base.d.ts +164 -0
- package/dist/protocol/constants.d.ts +2 -0
- package/dist/protocol/envelope.d.ts +65 -0
- package/dist/registry.d.ts +43 -0
- package/dist/sdk.d.ts +76 -0
- package/dist/shared.d.ts +9 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @payabli/component-contracts
|
|
2
|
+
|
|
3
|
+
Wire schemas, the component registry, and the partner-facing types that the
|
|
4
|
+
Payabli embedded components SDK (`@payabli/components-web`) and the payhub
|
|
5
|
+
iframe share. One folder per component under `src/<component>/`.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @payabli/component-contracts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## What is inside
|
|
14
|
+
|
|
15
|
+
- `protocol/`: the postMessage envelope, `parseEnvelope` / `parseMessage` /
|
|
16
|
+
`parsePayload`, the base events every component emits, and the messages the
|
|
17
|
+
SDK sends to the iframe (`CONFIG_SET`, `SESSION_UPDATE`, `SUBMIT`, ...).
|
|
18
|
+
- `payin/`: the PayIn component. Its options schema, event schemas, and the
|
|
19
|
+
`PAYMENT_METHODS` / `CARD_BRANDS` vocabulary.
|
|
20
|
+
- `registry`: `register()`, `getComponentDescriptor()`, and the
|
|
21
|
+
`ComponentDefinitions` declaration-merge point.
|
|
22
|
+
- `ErrorCodes`: the error vocabulary shared by the SDK, payhub, and the API.
|
|
23
|
+
|
|
24
|
+
Schemas are zod v4 mini and the runtime is bundled. Consumers on zod 3.25 or
|
|
25
|
+
later resolve the types through `zod/v4/mini`.
|
|
26
|
+
|
|
27
|
+
## Versioning
|
|
28
|
+
|
|
29
|
+
Pre-1.0. A breaking wire change is a minor bump. `MESSAGE_VERSION` changes
|
|
30
|
+
only when old and new sides can no longer talk.
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const ErrorCodes: {
|
|
2
|
+
readonly LOAD_TIMEOUT: "LOAD_TIMEOUT";
|
|
3
|
+
readonly PROTOCOL_ERROR: "PROTOCOL_ERROR";
|
|
4
|
+
readonly INVALID_STATE: "INVALID_STATE";
|
|
5
|
+
readonly SESSION_EXPIRED: "SESSION_EXPIRED";
|
|
6
|
+
readonly SESSION_REFRESH_FAILED: "SESSION_REFRESH_FAILED";
|
|
7
|
+
/** Reported by an iframe whose call was rejected for an expired JWT. Triggers a refresh. */
|
|
8
|
+
readonly TOKEN_EXPIRED: "TOKEN_EXPIRED";
|
|
9
|
+
/**
|
|
10
|
+
* Reported by an iframe whose render token no longer renders. The SDK recreates the frame
|
|
11
|
+
* with the latest render token.
|
|
12
|
+
*/
|
|
13
|
+
readonly RENDER_TOKEN_EXPIRED: "RENDER_TOKEN_EXPIRED";
|
|
14
|
+
/** The render token failed signature, audience, or format checks. Needs a new session. */
|
|
15
|
+
readonly RENDER_TOKEN_INVALID: "RENDER_TOKEN_INVALID";
|
|
16
|
+
/** Refresh rejected: the page origin is not on the session's allowlist. Terminal. */
|
|
17
|
+
readonly ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED";
|
|
18
|
+
/** Refresh rejected: the session was revoked (token reuse included). Terminal. */
|
|
19
|
+
readonly SESSION_REVOKED: "SESSION_REVOKED";
|
|
20
|
+
/** Refresh rejected: the session reached its expiration ceiling. Terminal. */
|
|
21
|
+
readonly SESSION_LIMIT_REACHED: "SESSION_LIMIT_REACHED";
|
|
22
|
+
/** Refresh rejected: unknown session, or one that names a component this API build lacks. Terminal. */
|
|
23
|
+
readonly SESSION_INVALID: "SESSION_INVALID";
|
|
24
|
+
/** Refresh could not mint a render token: server misconfiguration. Terminal regardless of status. */
|
|
25
|
+
readonly RENDER_TOKEN_FAILED: "RENDER_TOKEN_FAILED";
|
|
26
|
+
};
|
|
27
|
+
export type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './payin/definition.js';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './protocol/constants.js';
|
|
2
|
+
export * from './protocol/envelope.js';
|
|
3
|
+
export * from './protocol/base.js';
|
|
4
|
+
export * from './generated.js';
|
|
5
|
+
export * from './aliases.js';
|
|
6
|
+
export * from './errors.js';
|
|
7
|
+
export * from './registry.js';
|
|
8
|
+
export * from './sdk.js';
|
|
9
|
+
export * from './shared.js';
|