@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.js CHANGED
@@ -1597,7 +1597,7 @@ function getStyleIdBySlug(slug) {
1597
1597
  return slug;
1598
1598
  }
1599
1599
 
1600
- // ../../node_modules/.pnpm/zod@3.24.1/node_modules/zod/lib/index.mjs
1600
+ // ../../node_modules/.pnpm/zod@3.24.4/node_modules/zod/lib/index.mjs
1601
1601
  var util;
1602
1602
  (function(util2) {
1603
1603
  util2.assertEqual = (val) => val;
@@ -2446,13 +2446,14 @@ var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_
2446
2446
  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])))`;
2447
2447
  var dateRegex = new RegExp(`^${dateRegexSource}$`);
2448
2448
  function timeRegexSource(args) {
2449
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
2449
+ let secondsRegexSource = `[0-5]\\d`;
2450
2450
  if (args.precision) {
2451
- regex = `${regex}\\.\\d{${args.precision}}`;
2451
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
2452
2452
  } else if (args.precision == null) {
2453
- regex = `${regex}(\\.\\d+)?`;
2453
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
2454
2454
  }
2455
- return regex;
2455
+ const secondsQuantifier = args.precision ? "+" : "?";
2456
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
2456
2457
  }
2457
2458
  function timeRegex(args) {
2458
2459
  return new RegExp(`^${timeRegexSource(args)}$`);
@@ -5424,16 +5425,32 @@ ZodReadonly.create = (type, params) => {
5424
5425
  ...processCreateParams(params)
5425
5426
  });
5426
5427
  };
5427
- function custom(check, params = {}, fatal) {
5428
+ function cleanParams(params, data) {
5429
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
5430
+ const p2 = typeof p === "string" ? { message: p } : p;
5431
+ return p2;
5432
+ }
5433
+ function custom(check, _params = {}, fatal) {
5428
5434
  if (check)
5429
5435
  return ZodAny.create().superRefine((data, ctx) => {
5430
5436
  var _a, _b;
5431
- if (!check(data)) {
5432
- const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
5433
- const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
5434
- const p2 = typeof p === "string" ? { message: p } : p;
5435
- ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
5437
+ const r = check(data);
5438
+ if (r instanceof Promise) {
5439
+ return r.then((r2) => {
5440
+ var _a2, _b2;
5441
+ if (!r2) {
5442
+ const params = cleanParams(_params, data);
5443
+ const _fatal = (_b2 = (_a2 = params.fatal) !== null && _a2 !== void 0 ? _a2 : fatal) !== null && _b2 !== void 0 ? _b2 : true;
5444
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
5445
+ }
5446
+ });
5447
+ }
5448
+ if (!r) {
5449
+ const params = cleanParams(_params, data);
5450
+ const _fatal = (_b = (_a = params.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
5451
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
5436
5452
  }
5453
+ return;
5437
5454
  });
5438
5455
  return ZodAny.create();
5439
5456
  }
@@ -5880,7 +5897,7 @@ var DesignRequest = class {
5880
5897
  this.title = designRequestProps?.title || "";
5881
5898
  this.subtitle = designRequestProps?.subtitle;
5882
5899
  this.occasion = designRequestProps?.occasion || occasions[0];
5883
- this.style = designRequestProps?.style || parseInt(Object.keys(styles)[0]);
5900
+ this.style = designRequestProps?.style || (designRequestProps?.sku ? "eed1dc1510934cd3aa6ac9395d9c2d20" : parseInt(Object.keys(styles)[0]));
5884
5901
  this.sku = designRequestProps?.sku;
5885
5902
  this.bookSize = designRequestProps?.bookSize || bookSizes[0];
5886
5903
  this.coverType = designRequestProps?.coverType || coverTypes[0];