@t2000/sdk 10.13.1 → 10.13.2

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.cjs CHANGED
@@ -3439,7 +3439,12 @@ function requirementFieldMap(listing) {
3439
3439
  return listing;
3440
3440
  }
3441
3441
  function requirementHint(value) {
3442
- return typeof value === "string" ? value : JSON.stringify(value);
3442
+ if (typeof value === "string") return value;
3443
+ if (value && typeof value === "object" && !Array.isArray(value)) {
3444
+ const desc = value.description;
3445
+ if (typeof desc === "string" && desc.trim().length > 0) return desc;
3446
+ }
3447
+ return JSON.stringify(value);
3443
3448
  }
3444
3449
  function isPlainObject(value) {
3445
3450
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -3450,7 +3455,8 @@ function assertBuyerRequirements(listingRequirements, buyerPayload) {
3450
3455
  }
3451
3456
  if (isPlainObject(listingRequirements)) {
3452
3457
  const fields = requirementFieldMap(listingRequirements);
3453
- const keys = Object.keys(fields);
3458
+ const requiredRaw = listingRequirements.required;
3459
+ const keys = isPlainObject(listingRequirements.properties) && Array.isArray(requiredRaw) && requiredRaw.every((k) => typeof k === "string") ? requiredRaw : Object.keys(fields);
3454
3460
  if (keys.length === 0) {
3455
3461
  return;
3456
3462
  }