@magiclabs.ai/magicbook-client 0.7.28 → 0.7.29

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 CHANGED
@@ -1671,7 +1671,7 @@ function getStyleIdBySlug(slug) {
1671
1671
  return slug;
1672
1672
  }
1673
1673
 
1674
- // ../../node_modules/.pnpm/zod@3.24.1/node_modules/zod/lib/index.mjs
1674
+ // ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/index.mjs
1675
1675
  var util;
1676
1676
  (function(util2) {
1677
1677
  util2.assertEqual = (val) => val;
@@ -2520,13 +2520,14 @@ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_
2520
2520
  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])))`;
2521
2521
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
2522
2522
  function timeRegexSource(args) {
2523
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
2523
+ let secondsRegexSource = `[0-5]\\d`;
2524
2524
  if (args.precision) {
2525
- regex = `${regex}\\.\\d{${args.precision}}`;
2525
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
2526
2526
  } else if (args.precision == null) {
2527
- regex = `${regex}(\\.\\d+)?`;
2527
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
2528
2528
  }
2529
- return regex;
2529
+ const secondsQuantifier = args.precision ? "+" : "?";
2530
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
2530
2531
  }
2531
2532
  function timeRegex(args) {
2532
2533
  return new RegExp(`^${timeRegexSource(args)}$`);
@@ -5498,16 +5499,32 @@ ZodReadonly.create = (type, params) => {
5498
5499
  ...processCreateParams(params)
5499
5500
  });
5500
5501
  };
5501
- function custom(check, params = {}, fatal) {
5502
+ function cleanParams(params, data) {
5503
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
5504
+ const p2 = typeof p === "string" ? { message: p } : p;
5505
+ return p2;
5506
+ }
5507
+ function custom(check, _params = {}, fatal) {
5502
5508
  if (check)
5503
5509
  return ZodAny.create().superRefine((data, ctx) => {
5504
5510
  var _a, _b;
5505
- if (!check(data)) {
5506
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
5507
- const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
5508
- const p2 = typeof p === "string" ? { message: p } : p;
5509
- ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
5511
+ const r = check(data);
5512
+ if (r instanceof Promise) {
5513
+ return r.then((r2) => {
5514
+ var _a2, _b2;
5515
+ if (!r2) {
5516
+ const params = cleanParams(_params, data);
5517
+ const _fatal = (_b2 = (_a2 = params.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b2 !== void 0 ? _b2 : true;
5518
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
5519
+ }
5520
+ });
5521
+ }
5522
+ if (!r) {
5523
+ const params = cleanParams(_params, data);
5524
+ const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
5525
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
5510
5526
  }
5527
+ return;
5511
5528
  });
5512
5529
  return ZodAny.create();
5513
5530
  }
@@ -5954,7 +5971,7 @@ var DesignRequest = class {
5954
5971
  this.title = designRequestProps?.title || "";
5955
5972
  this.subtitle = designRequestProps?.subtitle;
5956
5973
  this.occasion = designRequestProps?.occasion || occasions[0];
5957
- this.style = designRequestProps?.style || parseInt(Object.keys(styles)[0]);
5974
+ this.style = designRequestProps?.style || (designRequestProps?.sku ? "eed1dc1510934cd3aa6ac9395d9c2d20" : parseInt(Object.keys(styles)[0]));
5958
5975
  this.sku = designRequestProps?.sku;
5959
5976
  this.bookSize = designRequestProps?.bookSize || bookSizes[0];
5960
5977
  this.coverType = designRequestProps?.coverType || coverTypes[0];