@meerkapp/wms-contracts 0.3.0-beta.3 → 0.3.0-beta.4
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 +2 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -29
- package/dist/index.d.ts +0 -29
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12202,8 +12202,7 @@ var ToggleCharacteristicSchema = import_zod9.z.object({
|
|
|
12202
12202
|
var CheckboxCharacteristicSchema = import_zod9.z.object({
|
|
12203
12203
|
key: import_zod9.z.string().min(1),
|
|
12204
12204
|
label: import_zod9.z.string().min(1),
|
|
12205
|
-
type: import_zod9.z.literal("checkbox")
|
|
12206
|
-
required: import_zod9.z.boolean().default(false)
|
|
12205
|
+
type: import_zod9.z.literal("checkbox")
|
|
12207
12206
|
});
|
|
12208
12207
|
var CharacteristicSchema = import_zod9.z.discriminatedUnion("type", [
|
|
12209
12208
|
NumberCharacteristicSchema,
|
|
@@ -12218,7 +12217,7 @@ var SKU_COMPATIBLE_TYPES = /* @__PURE__ */ new Set(["number", "select", "toggle"
|
|
|
12218
12217
|
function validateSkuTemplate(data) {
|
|
12219
12218
|
if (data.skuMode !== "CUSTOM" || !data.skuTemplate || !data.characteristicsScheme) return true;
|
|
12220
12219
|
const skuCompatibleKeys = new Set(
|
|
12221
|
-
data.characteristicsScheme.filter((c) => c.required &&
|
|
12220
|
+
data.characteristicsScheme.filter((c) => SKU_COMPATIBLE_TYPES.has(c.type) && "required" in c && c.required).map((c) => c.key)
|
|
12222
12221
|
);
|
|
12223
12222
|
const templateKeys = [...data.skuTemplate.matchAll(/\{([a-z_]+)(?::\d+)?\}/g)].map(([, key]) => key).filter((key) => !RESERVED_SKU_KEYS.has(key));
|
|
12224
12223
|
return templateKeys.every((key) => skuCompatibleKeys.has(key));
|