@decocms/blocks 7.26.1 → 7.26.3
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/package.json +1 -1
- package/src/cms/schema.test.ts +5 -6
- package/src/cms/schema.ts +9 -5
package/package.json
CHANGED
package/src/cms/schema.test.ts
CHANGED
|
@@ -271,19 +271,18 @@ describe("commerce SEO section schemas", () => {
|
|
|
271
271
|
expect(props.jsonLD.hide).toBe(true);
|
|
272
272
|
});
|
|
273
273
|
|
|
274
|
-
it("registers the
|
|
274
|
+
it("registers the defs + manifest blocks and offers them as page.seo options", () => {
|
|
275
|
+
// Unconditional (no commerce gate): meta.gen.json is baked at generation
|
|
276
|
+
// time when the loader registry is empty, and the runtime serves that baked
|
|
277
|
+
// meta as-is, so a registry-based gate would never bake the options.
|
|
275
278
|
const meta = composeMeta(emptySiteMeta());
|
|
276
279
|
for (const key of [
|
|
277
280
|
"commerce/sections/Seo/SeoPLPV2.tsx",
|
|
278
281
|
"commerce/sections/Seo/SeoPDPV2.tsx",
|
|
279
282
|
]) {
|
|
280
|
-
// Registered as a manifest block + def → the SEO editor can resolve a
|
|
281
|
-
// schema for a page already on this type.
|
|
282
283
|
expect(meta.manifest.blocks.sections).toHaveProperty(key);
|
|
283
284
|
expect(meta.schema.definitions).toHaveProperty(b64(key));
|
|
284
|
-
|
|
285
|
-
// (legacy commerce types have no component in start).
|
|
286
|
-
expect(meta.schema.root.sections.anyOf).not.toContainEqual(b64Ref(key));
|
|
285
|
+
expect(meta.schema.root.sections.anyOf).toContainEqual(b64Ref(key));
|
|
287
286
|
}
|
|
288
287
|
});
|
|
289
288
|
});
|
package/src/cms/schema.ts
CHANGED
|
@@ -842,11 +842,13 @@ function buildFrameworkSections(sectionAnyOf: any[]) {
|
|
|
842
842
|
// data-source block-ref set once when the page is created; it round-trips via
|
|
843
843
|
// the form (kept `hide`) rather than being re-picked in the SEO panel.
|
|
844
844
|
//
|
|
845
|
-
//
|
|
846
|
-
//
|
|
847
|
-
//
|
|
848
|
-
//
|
|
849
|
-
//
|
|
845
|
+
// Added to `extraAnyOf` (offered as a selectable page.seo type) unconditionally,
|
|
846
|
+
// like the website Seo sections above. Gating this on "is a commerce site" via
|
|
847
|
+
// the loader registry does NOT work: meta.gen.json is baked at generation time
|
|
848
|
+
// (blocks-cli), when the registry is empty, and the runtime serves that baked,
|
|
849
|
+
// already-composed meta as-is (composeMeta is idempotent on it) — so a gate
|
|
850
|
+
// would drop the options at bake and never re-add them. Non-commerce sites
|
|
851
|
+
// seeing these two extra options is a minor, acceptable cost.
|
|
850
852
|
const SEO_PLP_V2_TYPE = "commerce/sections/Seo/SeoPLPV2.tsx";
|
|
851
853
|
const seoPlpV2Key = toBase64(SEO_PLP_V2_TYPE);
|
|
852
854
|
definitions[seoPlpV2Key] = {
|
|
@@ -882,6 +884,7 @@ function buildFrameworkSections(sectionAnyOf: any[]) {
|
|
|
882
884
|
$ref: `#/definitions/${seoPlpV2Key}`,
|
|
883
885
|
namespace: "commerce",
|
|
884
886
|
};
|
|
887
|
+
extraAnyOf.push({ $ref: `#/definitions/${seoPlpV2Key}` });
|
|
885
888
|
|
|
886
889
|
// --- commerce/sections/Seo/SeoPDPV2.tsx ---
|
|
887
890
|
// Product-details SEO. Studio "pdp" mode counterpart of the PLP section above.
|
|
@@ -914,6 +917,7 @@ function buildFrameworkSections(sectionAnyOf: any[]) {
|
|
|
914
917
|
$ref: `#/definitions/${seoPdpV2Key}`,
|
|
915
918
|
namespace: "commerce",
|
|
916
919
|
};
|
|
920
|
+
extraAnyOf.push({ $ref: `#/definitions/${seoPdpV2Key}` });
|
|
917
921
|
|
|
918
922
|
// --- website/flags/multivariate/section.ts ---
|
|
919
923
|
const MV_SECTION_TYPE = "website/flags/multivariate/section.ts";
|