@@ -20172,6 +20172,9 @@ class CollectorRequest {
2017220172 section.setItemCustomization(itemKey, customization);
2017320173 }
2017420174 }
20175+ if (Array.isArray(sectionData.customFieldKeys)) {
20176+ section.setCustomFieldKeys(sectionData.customFieldKeys);
20177+ }
2017520178 }
2017620179 delete futureContent.sections;
2017720180 }
@@ -20438,11 +20441,13 @@ class CollectorRequestSection {
2043820441 #key;
2043920442 #itemKeys;
2044020443 #itemCustomizations;
20444+ #customFieldKeys;
2044120445 constructor(key, type) {
2044220446 this.#key = key;
2044320447 this.#type = type;
2044420448 this.#itemKeys = [];
2044520449 this.#itemCustomizations = {};
20450+ this.#customFieldKeys = [];
2044620451 this.#name = {
2044720452 en: ''
2044820453 };
@@ -20488,6 +20493,20 @@ class CollectorRequestSection {
2048820493 getItemCustomization(key) {
2048920494 return this.#itemCustomizations[key];
2049020495 }
20496+ // Plan 45 — section's reference into request.customFields[]
20497+ get customFieldKeys() { return this.#customFieldKeys; }
20498+ setCustomFieldKeys(keys) {
20499+ if (!Array.isArray(keys))
20500+ throw new errors_ts_1.HDSLibError('customFieldKeys must be an array', keys);
20501+ this.#customFieldKeys = keys.slice();
20502+ }
20503+ addCustomFieldKey(key) {
20504+ if (typeof key !== 'string' || key.length === 0)
20505+ throw new errors_ts_1.HDSLibError('customFieldKey must be a non-empty string', key);
20506+ if (this.#customFieldKeys.includes(key))
20507+ return;
20508+ this.#customFieldKeys.push(key);
20509+ }
2049120510 getData() {
2049220511 const data = {
2049320512 key: this.key,
@@ -20498,6 +20517,9 @@ class CollectorRequestSection {
2049820517 if (Object.keys(this.#itemCustomizations).length > 0) {
2049920518 data.itemCustomizations = this.#itemCustomizations;
2050020519 }
20520+ if (this.#customFieldKeys.length > 0) {
20521+ data.customFieldKeys = this.#customFieldKeys;
20522+ }
2050120523 return data;
2050220524 }
2050320525}
@@ -21259,6 +21281,39 @@ function collectItemLabels(itemKey, contacts, opts = {}) {
2125921281 * const tpl = loadTemplate(jsonObject); // synchronous; throws on any failure
2126021282 * const tpl = await loadTemplateFromUrl(url); // fetches then validates
2126121283 */
21284+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21285+ if (k2 === undefined) k2 = k;
21286+ var desc = Object.getOwnPropertyDescriptor(m, k);
21287+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21288+ desc = { enumerable: true, get: function() { return m[k]; } };
21289+ }
21290+ Object.defineProperty(o, k2, desc);
21291+ }) : (function(o, m, k, k2) {
21292+ if (k2 === undefined) k2 = k;
21293+ o[k2] = m[k];
21294+ }));
21295+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21296+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21297+ }) : function(o, v) {
21298+ o["default"] = v;
21299+ });
21300+ var __importStar = (this && this.__importStar) || (function () {
21301+ var ownKeys = function(o) {
21302+ ownKeys = Object.getOwnPropertyNames || function (o) {
21303+ var ar = [];
21304+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
21305+ return ar;
21306+ };
21307+ return ownKeys(o);
21308+ };
21309+ return function (mod) {
21310+ if (mod && mod.__esModule) return mod;
21311+ var result = {};
21312+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
21313+ __setModuleDefault(result, mod);
21314+ return result;
21315+ };
21316+ })();
2126221317var __importDefault = (this && this.__importDefault) || function (mod) {
2126321318 return (mod && mod.__esModule) ? mod : { "default": mod };
2126421319};
@@ -21267,10 +21322,13 @@ exports.loadTemplate = loadTemplate;
2126721322exports.loadTemplateFromUrl = loadTemplateFromUrl;
2126821323exports.isCustomFieldDeclaration = isCustomFieldDeclaration;
2126921324exports.isExistingStreamRef = isExistingStreamRef;
21270- const ajv_1 = __importDefault (__webpack_require__(/*! ajv */ "./node_modules/ajv/dist/ajv.js"));
21325+ const AjvNs = __importStar (__webpack_require__(/*! ajv */ "./node_modules/ajv/dist/ajv.js"));
2127121326const errors_ts_1 = __webpack_require__(/*! ../errors.js */ "./ts/errors.ts");
2127221327const appTemplate_schema_json_1 = __importDefault(__webpack_require__(/*! ./schemas/appTemplate.schema.json */ "./ts/appTemplates/schemas/appTemplate.schema.json"));
21273- const ajv = new ajv_1.default({ allErrors: true, strict: false });
21328+ // Ajv ships an ESM default + CJS interop. `default` may be the class itself
21329+ // or the namespace depending on bundler. Resolve once at load.
21330+ const Ajv = AjvNs.default ?? AjvNs;
21331+ const ajv = new Ajv({ allErrors: true, strict: false });
2127421332const validate = ajv.compile(appTemplate_schema_json_1.default);
2127521333/** Validate the JSON shape (Ajv) and run cross-field rules. Returns the validated AppTemplate or throws HDSLibError. */
2127621334function loadTemplate(json) {
0 commit comments