@payabli/component-contracts 0.1.0 → 0.1.1
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/index.js +88 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const MESSAGE_SOURCE = 'payabli';
|
|
2
2
|
const MESSAGE_VERSION = 1;
|
|
3
3
|
|
|
4
|
-
var _a;
|
|
4
|
+
var _a$1;
|
|
5
5
|
function $constructor(name, initializer, params) {
|
|
6
6
|
function init(inst, def) {
|
|
7
7
|
if (!inst._zod) {
|
|
@@ -60,7 +60,7 @@ class $ZodAsyncError extends Error {
|
|
|
60
60
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
|
|
63
|
+
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
64
64
|
const globalConfig = globalThis.__zod_globalConfig;
|
|
65
65
|
function config(newConfig) {
|
|
66
66
|
return globalConfig;
|
|
@@ -337,6 +337,14 @@ const string$1 = (params) => {
|
|
|
337
337
|
const number$1 = /^-?\d+(?:\.\d+)?$/;
|
|
338
338
|
const boolean$1 = /^(?:true|false)$/i;
|
|
339
339
|
|
|
340
|
+
// import { $ZodType } from "./schemas.js";
|
|
341
|
+
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
342
|
+
var _a;
|
|
343
|
+
inst._zod ?? (inst._zod = {});
|
|
344
|
+
inst._zod.def = def;
|
|
345
|
+
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
346
|
+
});
|
|
347
|
+
|
|
340
348
|
const version = {
|
|
341
349
|
major: 4,
|
|
342
350
|
minor: 4,
|
|
@@ -1201,6 +1209,56 @@ function en () {
|
|
|
1201
1209
|
};
|
|
1202
1210
|
}
|
|
1203
1211
|
|
|
1212
|
+
var _a;
|
|
1213
|
+
class $ZodRegistry {
|
|
1214
|
+
constructor() {
|
|
1215
|
+
this._map = new WeakMap();
|
|
1216
|
+
this._idmap = new Map();
|
|
1217
|
+
}
|
|
1218
|
+
add(schema, ..._meta) {
|
|
1219
|
+
const meta = _meta[0];
|
|
1220
|
+
this._map.set(schema, meta);
|
|
1221
|
+
if (meta && typeof meta === "object" && "id" in meta) {
|
|
1222
|
+
this._idmap.set(meta.id, schema);
|
|
1223
|
+
}
|
|
1224
|
+
return this;
|
|
1225
|
+
}
|
|
1226
|
+
clear() {
|
|
1227
|
+
this._map = new WeakMap();
|
|
1228
|
+
this._idmap = new Map();
|
|
1229
|
+
return this;
|
|
1230
|
+
}
|
|
1231
|
+
remove(schema) {
|
|
1232
|
+
const meta = this._map.get(schema);
|
|
1233
|
+
if (meta && typeof meta === "object" && "id" in meta) {
|
|
1234
|
+
this._idmap.delete(meta.id);
|
|
1235
|
+
}
|
|
1236
|
+
this._map.delete(schema);
|
|
1237
|
+
return this;
|
|
1238
|
+
}
|
|
1239
|
+
get(schema) {
|
|
1240
|
+
// return this._map.get(schema) as any;
|
|
1241
|
+
// inherit metadata
|
|
1242
|
+
const p = schema._zod.parent;
|
|
1243
|
+
if (p) {
|
|
1244
|
+
const pm = { ...(this.get(p) ?? {}) };
|
|
1245
|
+
delete pm.id; // do not inherit id
|
|
1246
|
+
const f = { ...pm, ...this._map.get(schema) };
|
|
1247
|
+
return Object.keys(f).length ? f : undefined;
|
|
1248
|
+
}
|
|
1249
|
+
return this._map.get(schema);
|
|
1250
|
+
}
|
|
1251
|
+
has(schema) {
|
|
1252
|
+
return this._map.has(schema);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
// registries
|
|
1256
|
+
function registry() {
|
|
1257
|
+
return new $ZodRegistry();
|
|
1258
|
+
}
|
|
1259
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
1260
|
+
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
1261
|
+
|
|
1204
1262
|
// @__NO_SIDE_EFFECTS__
|
|
1205
1263
|
function _string(Class, params) {
|
|
1206
1264
|
return new Class({
|
|
@@ -1229,6 +1287,18 @@ function _unknown(Class) {
|
|
|
1229
1287
|
type: "unknown",
|
|
1230
1288
|
});
|
|
1231
1289
|
}
|
|
1290
|
+
// @__NO_SIDE_EFFECTS__
|
|
1291
|
+
function describe$1(description) {
|
|
1292
|
+
const ch = new $ZodCheck({ check: "describe" });
|
|
1293
|
+
ch._zod.onattach = [
|
|
1294
|
+
(inst) => {
|
|
1295
|
+
const existing = globalRegistry.get(inst) ?? {};
|
|
1296
|
+
globalRegistry.add(inst, { ...existing, description });
|
|
1297
|
+
},
|
|
1298
|
+
];
|
|
1299
|
+
ch._zod.check = () => { }; // no-op check
|
|
1300
|
+
return ch;
|
|
1301
|
+
}
|
|
1232
1302
|
|
|
1233
1303
|
const ZodMiniType = /*@__PURE__*/ $constructor("ZodMiniType", (inst, def) => {
|
|
1234
1304
|
if (!inst._zod)
|
|
@@ -1392,6 +1462,8 @@ function optional(innerType) {
|
|
|
1392
1462
|
innerType: innerType,
|
|
1393
1463
|
});
|
|
1394
1464
|
}
|
|
1465
|
+
// Re-export describe and meta from core
|
|
1466
|
+
const describe = describe$1;
|
|
1395
1467
|
|
|
1396
1468
|
// zod/mini ships with a minimal error map ("Invalid input"). The English
|
|
1397
1469
|
// locale restores messages like "expected number, received string", which is
|
|
@@ -1506,9 +1578,11 @@ const appearanceSchema = object({
|
|
|
1506
1578
|
* Independent of `layoutVariant`, which controls density.
|
|
1507
1579
|
* Defaults to `tabs`. A single-method session renders the bare form.
|
|
1508
1580
|
*/
|
|
1509
|
-
layout: optional(_enum(['tabs', 'accordion', 'stacked', 'minimal'])
|
|
1581
|
+
layout: optional(_enum(['tabs', 'accordion', 'stacked', 'minimal'])
|
|
1582
|
+
.check(describe('How the buyer moves between payment methods. Defaults to tabs. A single-method session renders the bare form.'))),
|
|
1510
1583
|
/** Density: how much room the component takes. */
|
|
1511
|
-
layoutVariant: optional(_enum(['compact', 'standard', 'wide'])
|
|
1584
|
+
layoutVariant: optional(_enum(['compact', 'standard', 'wide'])
|
|
1585
|
+
.check(describe('Density: how much room the component takes.'))),
|
|
1512
1586
|
/**
|
|
1513
1587
|
* Field appearance: where a field's label sits.
|
|
1514
1588
|
* `above` puts the label over the input. The other two start it inside the
|
|
@@ -1516,10 +1590,14 @@ const appearanceSchema = object({
|
|
|
1516
1590
|
* has focus or a value: `floating` to the top of the box, `outlined` onto
|
|
1517
1591
|
* the border, cutting a notch in the line. Defaults to `above`.
|
|
1518
1592
|
*/
|
|
1519
|
-
labelStyle: optional(_enum(['above', 'floating', 'outlined'])
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1593
|
+
labelStyle: optional(_enum(['above', 'floating', 'outlined'])
|
|
1594
|
+
.check(describe('Where a field label sits. above: over the input. floating: inside the field, lifts to the top of the box. outlined: inside the field, lifts onto the border. Defaults to above.'))),
|
|
1595
|
+
mode: optional(_enum(['light', 'dark', 'system'])
|
|
1596
|
+
.check(describe('Color scheme. system follows the buyer device setting.'))),
|
|
1597
|
+
tokens: optional(record$1(string(), string())
|
|
1598
|
+
.check(describe('CSS custom properties the component honors, for example --primary and --background.'))),
|
|
1599
|
+
labels: optional(record$1(string(), string())
|
|
1600
|
+
.check(describe('Text overrides keyed by label id.'))),
|
|
1523
1601
|
});
|
|
1524
1602
|
/**
|
|
1525
1603
|
* Inbound wire messages: iframe → parent SDK. One schema per wire type, and
|
|
@@ -1629,7 +1707,8 @@ const CARD_BRANDS = [
|
|
|
1629
1707
|
* object (via the descriptor's `optionsSchema`).
|
|
1630
1708
|
*/
|
|
1631
1709
|
const payinOptionsSchema = object({
|
|
1632
|
-
showSubmitButton: optional(boolean()
|
|
1710
|
+
showSubmitButton: optional(boolean()
|
|
1711
|
+
.check(describe('Render the submit button inside the component. Set false when the host page owns the button and calls submit().'))),
|
|
1633
1712
|
});
|
|
1634
1713
|
/** PayIn's own inbound events, beyond the base set every component shares. */
|
|
1635
1714
|
const payinEvents = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payabli/component-contracts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Wire schemas, component registry, and partner-facing types shared by the Payabli embedded components SDK and payhub.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "UNLICENSED",
|