@magiclabs.ai/magicbook-client 0.7.28 → 0.7.29-canary
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/index.cjs +29 -12
- package/index.cjs.map +1 -1
- package/index.iife.js +28 -11
- package/index.iife.min.js +1 -1
- package/index.js +29 -12
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.iife.js
CHANGED
|
@@ -2514,13 +2514,14 @@ var MagicLabs = (() => {
|
|
|
2514
2514
|
var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
2515
2515
|
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
2516
2516
|
function timeRegexSource(args) {
|
|
2517
|
-
let
|
|
2517
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
2518
2518
|
if (args.precision) {
|
|
2519
|
-
|
|
2519
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
2520
2520
|
} else if (args.precision == null) {
|
|
2521
|
-
|
|
2521
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
2522
2522
|
}
|
|
2523
|
-
|
|
2523
|
+
const secondsQuantifier = args.precision ? "+" : "?";
|
|
2524
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
2524
2525
|
}
|
|
2525
2526
|
function timeRegex(args) {
|
|
2526
2527
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
@@ -5492,16 +5493,32 @@ var MagicLabs = (() => {
|
|
|
5492
5493
|
...processCreateParams(params)
|
|
5493
5494
|
});
|
|
5494
5495
|
};
|
|
5495
|
-
function
|
|
5496
|
+
function cleanParams(params, data) {
|
|
5497
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
5498
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
5499
|
+
return p2;
|
|
5500
|
+
}
|
|
5501
|
+
function custom(check, _params = {}, fatal) {
|
|
5496
5502
|
if (check)
|
|
5497
5503
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
5498
5504
|
var _a, _b;
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5505
|
+
const r = check(data);
|
|
5506
|
+
if (r instanceof Promise) {
|
|
5507
|
+
return r.then((r2) => {
|
|
5508
|
+
var _a2, _b2;
|
|
5509
|
+
if (!r2) {
|
|
5510
|
+
const params = cleanParams(_params, data);
|
|
5511
|
+
const _fatal = (_b2 = (_a2 = params.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b2 !== void 0 ? _b2 : true;
|
|
5512
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
5513
|
+
}
|
|
5514
|
+
});
|
|
5515
|
+
}
|
|
5516
|
+
if (!r) {
|
|
5517
|
+
const params = cleanParams(_params, data);
|
|
5518
|
+
const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
|
|
5519
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
5504
5520
|
}
|
|
5521
|
+
return;
|
|
5505
5522
|
});
|
|
5506
5523
|
return ZodAny.create();
|
|
5507
5524
|
}
|
|
@@ -5940,7 +5957,7 @@ var MagicLabs = (() => {
|
|
|
5940
5957
|
this.title = designRequestProps?.title || "";
|
|
5941
5958
|
this.subtitle = designRequestProps?.subtitle;
|
|
5942
5959
|
this.occasion = designRequestProps?.occasion || occasions[0];
|
|
5943
|
-
this.style = designRequestProps?.style || parseInt(Object.keys(styles)[0]);
|
|
5960
|
+
this.style = designRequestProps?.style || (designRequestProps?.sku ? "eed1dc1510934cd3aa6ac9395d9c2d20" : parseInt(Object.keys(styles)[0]));
|
|
5944
5961
|
this.sku = designRequestProps?.sku;
|
|
5945
5962
|
this.bookSize = designRequestProps?.bookSize || bookSizes[0];
|
|
5946
5963
|
this.coverType = designRequestProps?.coverType || coverTypes[0];
|