wiil-core-js 0.0.82
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/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/core/account/index.d.ts +7 -0
- package/dist/core/account/index.js +23 -0
- package/dist/core/account/organization.schema.d.ts +118 -0
- package/dist/core/account/organization.schema.js +91 -0
- package/dist/core/account/project.schema.d.ts +121 -0
- package/dist/core/account/project.schema.js +102 -0
- package/dist/core/account/supported-business-verticals.d.ts +8 -0
- package/dist/core/account/supported-business-verticals.js +23 -0
- package/dist/core/assistant-setups/assistant-setup-result.schema.d.ts +115 -0
- package/dist/core/assistant-setups/assistant-setup-result.schema.js +17 -0
- package/dist/core/assistant-setups/base-assistant-setup.schema.d.ts +61 -0
- package/dist/core/assistant-setups/base-assistant-setup.schema.js +29 -0
- package/dist/core/assistant-setups/index.d.ts +4 -0
- package/dist/core/assistant-setups/index.js +21 -0
- package/dist/core/assistant-setups/phone-assistant-setup.schema.d.ts +63 -0
- package/dist/core/assistant-setups/phone-assistant-setup.schema.js +14 -0
- package/dist/core/assistant-setups/web-assitant-setup.schema.d.ts +56 -0
- package/dist/core/assistant-setups/web-assitant-setup.schema.js +17 -0
- package/dist/core/base.schema.d.ts +34 -0
- package/dist/core/base.schema.js +36 -0
- package/dist/core/business-mgt/appointment-additional-info.schema.d.ts +63 -0
- package/dist/core/business-mgt/appointment-additional-info.schema.js +53 -0
- package/dist/core/business-mgt/appointment-field-config.schema.d.ts +251 -0
- package/dist/core/business-mgt/appointment-field-config.schema.js +49 -0
- package/dist/core/business-mgt/bookings.shared.schema.d.ts +47 -0
- package/dist/core/business-mgt/bookings.shared.schema.js +60 -0
- package/dist/core/business-mgt/business-location.schema.d.ts +327 -0
- package/dist/core/business-mgt/business-location.schema.js +176 -0
- package/dist/core/business-mgt/customer-management/customer-group.schema.d.ts +87 -0
- package/dist/core/business-mgt/customer-management/customer-group.schema.js +53 -0
- package/dist/core/business-mgt/customer-management/customer.schema.d.ts +156 -0
- package/dist/core/business-mgt/customer-management/customer.schema.js +93 -0
- package/dist/core/business-mgt/customer-management/index.d.ts +7 -0
- package/dist/core/business-mgt/customer-management/index.js +23 -0
- package/dist/core/business-mgt/customer-management/shipping-address.schema.d.ts +112 -0
- package/dist/core/business-mgt/customer-management/shipping-address.schema.js +79 -0
- package/dist/core/business-mgt/customer.schema.d.ts +111 -0
- package/dist/core/business-mgt/customer.schema.js +73 -0
- package/dist/core/business-mgt/discount-rule.schema.d.ts +183 -0
- package/dist/core/business-mgt/discount-rule.schema.js +108 -0
- package/dist/core/business-mgt/index.d.ts +16 -0
- package/dist/core/business-mgt/index.js +38 -0
- package/dist/core/business-mgt/menu-config.schema.d.ts +165 -0
- package/dist/core/business-mgt/menu-config.schema.js +86 -0
- package/dist/core/business-mgt/menu-management/index.d.ts +11 -0
- package/dist/core/business-mgt/menu-management/index.js +27 -0
- package/dist/core/business-mgt/menu-management/menu-catalog.schema.d.ts +386 -0
- package/dist/core/business-mgt/menu-management/menu-catalog.schema.js +58 -0
- package/dist/core/business-mgt/menu-management/menu-config.schema.d.ts +301 -0
- package/dist/core/business-mgt/menu-management/menu-config.schema.js +169 -0
- package/dist/core/business-mgt/menu-management/menu-item-variant.schema.d.ts +143 -0
- package/dist/core/business-mgt/menu-management/menu-item-variant.schema.js +86 -0
- package/dist/core/business-mgt/menu-management/menu-pricing-rule.schema.d.ts +239 -0
- package/dist/core/business-mgt/menu-management/menu-pricing-rule.schema.js +117 -0
- package/dist/core/business-mgt/menu-management/menu-set.schema.d.ts +420 -0
- package/dist/core/business-mgt/menu-management/menu-set.schema.js +283 -0
- package/dist/core/business-mgt/menu-management/menu.order.schema.d.ts +654 -0
- package/dist/core/business-mgt/menu-management/menu.order.schema.js +204 -0
- package/dist/core/business-mgt/menu-management/modifier.schema.d.ts +585 -0
- package/dist/core/business-mgt/menu-management/modifier.schema.js +341 -0
- package/dist/core/business-mgt/menu.order.schema.d.ts +335 -0
- package/dist/core/business-mgt/menu.order.schema.js +149 -0
- package/dist/core/business-mgt/order.schema.d.ts +222 -0
- package/dist/core/business-mgt/order.schema.js +205 -0
- package/dist/core/business-mgt/pricing-rule.shared.schema.d.ts +56 -0
- package/dist/core/business-mgt/pricing-rule.shared.schema.js +68 -0
- package/dist/core/business-mgt/product-config.schema.d.ts +177 -0
- package/dist/core/business-mgt/product-config.schema.js +106 -0
- package/dist/core/business-mgt/product-management/index.d.ts +12 -0
- package/dist/core/business-mgt/product-management/index.js +28 -0
- package/dist/core/business-mgt/product-management/product-axis-binding.schema.d.ts +54 -0
- package/dist/core/business-mgt/product-management/product-axis-binding.schema.js +54 -0
- package/dist/core/business-mgt/product-management/product-config.schema.d.ts +1042 -0
- package/dist/core/business-mgt/product-management/product-config.schema.js +392 -0
- package/dist/core/business-mgt/product-management/product-display.schema.d.ts +548 -0
- package/dist/core/business-mgt/product-management/product-display.schema.js +80 -0
- package/dist/core/business-mgt/product-management/product-order.schema.d.ts +493 -0
- package/dist/core/business-mgt/product-management/product-order.schema.js +158 -0
- package/dist/core/business-mgt/product-management/product-pricing-rule.schema.d.ts +167 -0
- package/dist/core/business-mgt/product-management/product-pricing-rule.schema.js +68 -0
- package/dist/core/business-mgt/product-management/product-set.schema.d.ts +488 -0
- package/dist/core/business-mgt/product-management/product-set.schema.js +273 -0
- package/dist/core/business-mgt/product-management/product-variant-axis.schema.d.ts +156 -0
- package/dist/core/business-mgt/product-management/product-variant-axis.schema.js +98 -0
- package/dist/core/business-mgt/product-management/product-variant.schema.d.ts +219 -0
- package/dist/core/business-mgt/product-management/product-variant.schema.js +130 -0
- package/dist/core/business-mgt/product-order.schema.d.ts +326 -0
- package/dist/core/business-mgt/product-order.schema.js +153 -0
- package/dist/core/business-mgt/property-config.schema.d.ts +621 -0
- package/dist/core/business-mgt/property-config.schema.js +224 -0
- package/dist/core/business-mgt/property-inquiry.schema.d.ts +222 -0
- package/dist/core/business-mgt/property-inquiry.schema.js +112 -0
- package/dist/core/business-mgt/property-management/index.d.ts +6 -0
- package/dist/core/business-mgt/property-management/index.js +22 -0
- package/dist/core/business-mgt/property-management/property-config.schema.d.ts +1306 -0
- package/dist/core/business-mgt/property-management/property-config.schema.js +367 -0
- package/dist/core/business-mgt/property-management/property-inquiry.schema.d.ts +254 -0
- package/dist/core/business-mgt/property-management/property-inquiry.schema.js +131 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/index.d.ts +3 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/index.js +19 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-rental-assignment.schema.d.ts +139 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-rental-assignment.schema.js +90 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-room-assignment.schema.d.ts +104 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-room-assignment.schema.js +70 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-table-assignment.schema.d.ts +104 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-table-assignment.schema.js +72 -0
- package/dist/core/business-mgt/reservation-mgt/index.d.ts +14 -0
- package/dist/core/business-mgt/reservation-mgt/index.js +31 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-floor-plan-definition.schema.d.ts +180 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-floor-plan-definition.schema.js +75 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-maintenance-block.schema.d.ts +91 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-maintenance-block.schema.js +57 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-rental.schema.d.ts +334 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-rental.schema.js +179 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-room.schema.d.ts +195 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-room.schema.js +106 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-section.schema.d.ts +402 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-section.schema.js +198 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-settings.schema.d.ts +229 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-settings.schema.js +127 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-slot-query.schema.d.ts +382 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-slot-query.schema.js +322 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table-layout.schema.d.ts +123 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table-layout.schema.js +83 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table.schema.d.ts +167 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table.schema.js +84 -0
- package/dist/core/business-mgt/reservation-mgt/reservation.schema.d.ts +0 -0
- package/dist/core/business-mgt/reservation-mgt/reservation.schema.js +153 -0
- package/dist/core/business-mgt/reservation-mgt/resource/index.d.ts +4 -0
- package/dist/core/business-mgt/reservation-mgt/resource/index.js +20 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-category.schema.d.ts +157 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-category.schema.js +76 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-instance.schema.d.ts +137 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-instance.schema.js +94 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource.schema.d.ts +713 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource.schema.js +363 -0
- package/dist/core/business-mgt/reservation-mgt/resource/resource-versioning.schema.d.ts +151 -0
- package/dist/core/business-mgt/reservation-mgt/resource/resource-versioning.schema.js +147 -0
- package/dist/core/business-mgt/reservation-resource.schema.d.ts +154 -0
- package/dist/core/business-mgt/reservation-resource.schema.js +100 -0
- package/dist/core/business-mgt/reservation.schema.d.ts +119 -0
- package/dist/core/business-mgt/reservation.schema.js +89 -0
- package/dist/core/business-mgt/service-appointment.schema.d.ts +105 -0
- package/dist/core/business-mgt/service-appointment.schema.js +69 -0
- package/dist/core/business-mgt/service-config.schema.d.ts +453 -0
- package/dist/core/business-mgt/service-config.schema.js +102 -0
- package/dist/core/business-mgt/service-management/appointment-additional-info.schema.d.ts +110 -0
- package/dist/core/business-mgt/service-management/appointment-additional-info.schema.js +78 -0
- package/dist/core/business-mgt/service-management/appointment-field-config.schema.d.ts +304 -0
- package/dist/core/business-mgt/service-management/appointment-field-config.schema.js +75 -0
- package/dist/core/business-mgt/service-management/business-service-config.schema.d.ts +1226 -0
- package/dist/core/business-mgt/service-management/business-service-config.schema.js +317 -0
- package/dist/core/business-mgt/service-management/index.d.ts +13 -0
- package/dist/core/business-mgt/service-management/index.js +29 -0
- package/dist/core/business-mgt/service-management/service-appointment.schema.d.ts +531 -0
- package/dist/core/business-mgt/service-management/service-appointment.schema.js +116 -0
- package/dist/core/business-mgt/service-management/service-person.schema.d.ts +122 -0
- package/dist/core/business-mgt/service-management/service-person.schema.js +66 -0
- package/dist/core/business-mgt/service-management/service-pricing-rule.schema.d.ts +221 -0
- package/dist/core/business-mgt/service-management/service-pricing-rule.schema.js +118 -0
- package/dist/core/business-mgt/service-management/service-provider.schema.d.ts +90 -0
- package/dist/core/business-mgt/service-management/service-provider.schema.js +54 -0
- package/dist/core/business-mgt/service-management/service-slot-query.schema.d.ts +90 -0
- package/dist/core/business-mgt/service-management/service-slot-query.schema.js +113 -0
- package/dist/core/business-mgt/service-management/service-time-off.schema.d.ts +121 -0
- package/dist/core/business-mgt/service-management/service-time-off.schema.js +95 -0
- package/dist/core/business-mgt/service-person.schema.d.ts +43 -0
- package/dist/core/business-mgt/service-person.schema.js +38 -0
- package/dist/core/business-mgt/tax-rule.schema.d.ts +161 -0
- package/dist/core/business-mgt/tax-rule.schema.js +90 -0
- package/dist/core/conversation/conversation-config.schema.d.ts +644 -0
- package/dist/core/conversation/conversation-config.schema.js +351 -0
- package/dist/core/conversation/conversation-message.schema.d.ts +307 -0
- package/dist/core/conversation/conversation-message.schema.js +275 -0
- package/dist/core/conversation/index.d.ts +12 -0
- package/dist/core/conversation/index.js +28 -0
- package/dist/core/conversation/outbound-call.schema.d.ts +209 -0
- package/dist/core/conversation/outbound-call.schema.js +116 -0
- package/dist/core/conversation/outbound-email.schema.d.ts +338 -0
- package/dist/core/conversation/outbound-email.schema.js +150 -0
- package/dist/core/conversation/outbound-sms.schema.d.ts +163 -0
- package/dist/core/conversation/outbound-sms.schema.js +85 -0
- package/dist/core/conversation/outbound-template.schema.d.ts +375 -0
- package/dist/core/conversation/outbound-template.schema.js +160 -0
- package/dist/core/conversation/translation-config.schema.d.ts +92 -0
- package/dist/core/conversation/translation-config.schema.js +88 -0
- package/dist/core/conversation/translation-conversation.schema.d.ts +469 -0
- package/dist/core/conversation/translation-conversation.schema.js +175 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +30 -0
- package/dist/core/service-configuration/agent-config.schema.d.ts +236 -0
- package/dist/core/service-configuration/agent-config.schema.js +152 -0
- package/dist/core/service-configuration/base-agent-setup.d.ts +147 -0
- package/dist/core/service-configuration/base-agent-setup.js +123 -0
- package/dist/core/service-configuration/call-transfer-config.schema.d.ts +60 -0
- package/dist/core/service-configuration/call-transfer-config.schema.js +53 -0
- package/dist/core/service-configuration/deployment-config.schema.d.ts +522 -0
- package/dist/core/service-configuration/deployment-config.schema.js +271 -0
- package/dist/core/service-configuration/dynamic_setup/base-agent-setup.d.ts +130 -0
- package/dist/core/service-configuration/dynamic_setup/base-agent-setup.js +110 -0
- package/dist/core/service-configuration/dynamic_setup/index.d.ts +10 -0
- package/dist/core/service-configuration/dynamic_setup/index.js +26 -0
- package/dist/core/service-configuration/dynamic_setup/phone-agent-setup.d.ts +111 -0
- package/dist/core/service-configuration/dynamic_setup/phone-agent-setup.js +56 -0
- package/dist/core/service-configuration/dynamic_setup/web-agent-setup.d.ts +113 -0
- package/dist/core/service-configuration/dynamic_setup/web-agent-setup.js +55 -0
- package/dist/core/service-configuration/index.d.ts +17 -0
- package/dist/core/service-configuration/index.js +33 -0
- package/dist/core/service-configuration/instruction-config.schema.d.ts +183 -0
- package/dist/core/service-configuration/instruction-config.schema.js +139 -0
- package/dist/core/service-configuration/interaction-channels.schema.d.ts +469 -0
- package/dist/core/service-configuration/interaction-channels.schema.js +390 -0
- package/dist/core/service-configuration/knowledge.schema.d.ts +107 -0
- package/dist/core/service-configuration/knowledge.schema.js +106 -0
- package/dist/core/service-configuration/phone-config.schema.d.ts +206 -0
- package/dist/core/service-configuration/phone-config.schema.js +121 -0
- package/dist/core/service-configuration/phone-number.schema.d.ts +236 -0
- package/dist/core/service-configuration/phone-number.schema.js +211 -0
- package/dist/core/service-configuration/provisioning-config.d.ts +429 -0
- package/dist/core/service-configuration/provisioning-config.js +307 -0
- package/dist/core/service-configuration/support-llm.d.ts +95 -0
- package/dist/core/service-configuration/support-llm.js +76 -0
- package/dist/core/service-configuration/voice-language.schema.d.ts +200 -0
- package/dist/core/service-configuration/voice-language.schema.js +166 -0
- package/dist/core/type-definitions/account-definitions.d.ts +82 -0
- package/dist/core/type-definitions/account-definitions.js +88 -0
- package/dist/core/type-definitions/business-definitions.d.ts +394 -0
- package/dist/core/type-definitions/business-definitions.js +447 -0
- package/dist/core/type-definitions/conversation.type.definition.d.ts +223 -0
- package/dist/core/type-definitions/conversation.type.definition.js +236 -0
- package/dist/core/type-definitions/display-order.d.ts +154 -0
- package/dist/core/type-definitions/display-order.js +154 -0
- package/dist/core/type-definitions/dynamic-fields/field-definition.schema.d.ts +165 -0
- package/dist/core/type-definitions/dynamic-fields/field-definition.schema.js +97 -0
- package/dist/core/type-definitions/dynamic-fields/field-types.d.ts +49 -0
- package/dist/core/type-definitions/dynamic-fields/field-types.js +104 -0
- package/dist/core/type-definitions/dynamic-fields/index.d.ts +9 -0
- package/dist/core/type-definitions/dynamic-fields/index.js +25 -0
- package/dist/core/type-definitions/index.d.ts +10 -0
- package/dist/core/type-definitions/index.js +26 -0
- package/dist/core/type-definitions/knowledge-definitions.d.ts +30 -0
- package/dist/core/type-definitions/knowledge-definitions.js +37 -0
- package/dist/core/type-definitions/service-config.definitions.d.ts +112 -0
- package/dist/core/type-definitions/service-config.definitions.js +135 -0
- package/dist/core/validators/channel-validation.d.ts +19 -0
- package/dist/core/validators/channel-validation.js +40 -0
- package/dist/core/validators/index.d.ts +5 -0
- package/dist/core/validators/index.js +21 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +24 -0
- package/dist/request/index.d.ts +5 -0
- package/dist/request/index.js +21 -0
- package/dist/request/models/index.d.ts +6 -0
- package/dist/request/models/index.js +22 -0
- package/dist/request/models/paginated-quest.schema.d.ts +33 -0
- package/dist/request/models/paginated-quest.schema.js +35 -0
- package/dist/request/models/paginated-result.schema.d.ts +124 -0
- package/dist/request/models/paginated-result.schema.js +94 -0
- package/package.json +43 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ProductSetDisplaySchema = exports.ProductSetItemDisplaySchema = exports.UpdateProductSetSchema = exports.CreateProductSetSchema = exports.ProductSetSchema = exports.ProductSetSelectorSchema = exports.ProductSetItemSchema = exports.ProductSetChannelMappingSchema = exports.ProductSetTargetingMode = exports.ProductSetPricingMode = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const base_schema_1 = require("../../base.schema");
|
|
9
|
+
const product_config_schema_1 = require("./product-config.schema");
|
|
10
|
+
/**
|
|
11
|
+
* @fileoverview Product set schema definitions for bundled products.
|
|
12
|
+
* @module business-mgt/product-set
|
|
13
|
+
*
|
|
14
|
+
* Product sets enable bundling products into packages with flexible pricing
|
|
15
|
+
* and targeting strategies. Sets can use fixed pricing or sum of component prices.
|
|
16
|
+
*/
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// ENUMS
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Product set pricing mode.
|
|
22
|
+
* Determines how the set price is calculated.
|
|
23
|
+
*
|
|
24
|
+
* @enum {string}
|
|
25
|
+
* @property {string} FIXED - Set has a fixed price regardless of component prices
|
|
26
|
+
* @property {string} SUM_OF_ITEMS - Set price is sum of included product prices
|
|
27
|
+
*/
|
|
28
|
+
var ProductSetPricingMode;
|
|
29
|
+
(function (ProductSetPricingMode) {
|
|
30
|
+
/** Set has a fixed price regardless of component prices */
|
|
31
|
+
ProductSetPricingMode["FIXED"] = "FIXED";
|
|
32
|
+
/** Set price is sum of included product prices */
|
|
33
|
+
ProductSetPricingMode["SUM_OF_ITEMS"] = "SUM_OF_ITEMS";
|
|
34
|
+
})(ProductSetPricingMode || (exports.ProductSetPricingMode = ProductSetPricingMode = {}));
|
|
35
|
+
/**
|
|
36
|
+
* Product set targeting mode.
|
|
37
|
+
* Determines how products are selected for the set.
|
|
38
|
+
*
|
|
39
|
+
* @enum {string}
|
|
40
|
+
* @property {string} EXPLICIT - Set includes explicitly listed products
|
|
41
|
+
* @property {string} SELECTOR - Set includes products matching selector criteria
|
|
42
|
+
*/
|
|
43
|
+
var ProductSetTargetingMode;
|
|
44
|
+
(function (ProductSetTargetingMode) {
|
|
45
|
+
/** Set includes explicitly listed products */
|
|
46
|
+
ProductSetTargetingMode["EXPLICIT"] = "EXPLICIT";
|
|
47
|
+
/** Set includes products matching selector criteria */
|
|
48
|
+
ProductSetTargetingMode["SELECTOR"] = "SELECTOR";
|
|
49
|
+
})(ProductSetTargetingMode || (exports.ProductSetTargetingMode = ProductSetTargetingMode = {}));
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// CHANNEL MAPPING SCHEMA
|
|
52
|
+
// ============================================================================
|
|
53
|
+
/**
|
|
54
|
+
* Product set channel mapping schema.
|
|
55
|
+
* Maps product sets to external platform identifiers.
|
|
56
|
+
*
|
|
57
|
+
* @typedef {Object} ProductSetChannelMapping
|
|
58
|
+
* @property {string} channelId - Platform identifier (e.g., "shopify", "amazon")
|
|
59
|
+
* @property {string} externalProductSetId - Set ID in external platform
|
|
60
|
+
*/
|
|
61
|
+
exports.ProductSetChannelMappingSchema = zod_1.default.object({
|
|
62
|
+
channelId: zod_1.default.string().describe("Platform identifier (e.g., 'shopify', 'amazon'). Used for external system synchronization."),
|
|
63
|
+
externalProductSetId: zod_1.default.string().describe("Product set ID in the external platform. Enables cross-platform order reconciliation."),
|
|
64
|
+
}).describe("Per-channel external product set ID mapping for platform synchronization");
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// PRODUCT SET ITEM SCHEMA
|
|
67
|
+
// ============================================================================
|
|
68
|
+
/**
|
|
69
|
+
* Product set item schema.
|
|
70
|
+
* Represents a product included in a set with quantity and requirement specifications.
|
|
71
|
+
*
|
|
72
|
+
* @typedef {Object} ProductSetItem
|
|
73
|
+
* @property {string} productId - Product ID included in set
|
|
74
|
+
* @property {string} [productVariantId] - Specific variant ID if applicable
|
|
75
|
+
* @property {number} quantity - Quantity of this product in set
|
|
76
|
+
* @property {boolean} isRequired - Whether item is required in set
|
|
77
|
+
* @property {number} [displayOrder] - Display order inside set
|
|
78
|
+
*/
|
|
79
|
+
exports.ProductSetItemSchema = zod_1.default.object({
|
|
80
|
+
productId: zod_1.default.string().describe("References BusinessProduct included in this set. Links to product catalog for pricing and availability."),
|
|
81
|
+
productVariantId: zod_1.default.string().nullable().optional().describe("Specific ProductVariant ID when set requires particular variant. Null allows any variant."),
|
|
82
|
+
quantity: zod_1.default.number().int().positive().describe("Quantity of this product required in the set. Must be positive integer."),
|
|
83
|
+
isRequired: zod_1.default.boolean().default(true).describe("Whether this item is required for set validity. Optional items can be excluded by customer."),
|
|
84
|
+
displayOrder: zod_1.default.number().int().optional().describe("Display order within the set. Lower numbers appear first."),
|
|
85
|
+
}).describe("Product included in a product set with quantity and requirement specifications");
|
|
86
|
+
// ============================================================================
|
|
87
|
+
// PRODUCT SET SELECTOR SCHEMA
|
|
88
|
+
// ============================================================================
|
|
89
|
+
/**
|
|
90
|
+
* Product set selector schema.
|
|
91
|
+
* Defines criteria for dynamically selecting products to include in a set.
|
|
92
|
+
*
|
|
93
|
+
* @typedef {Object} ProductSetSelector
|
|
94
|
+
* @property {Array} productIdsAny - Products where any match satisfies
|
|
95
|
+
* @property {Array} productIdsAll - Products where all must match
|
|
96
|
+
* @property {boolean} allProducts - Include all catalog products
|
|
97
|
+
* @property {number} [quantityExact] - Exact quantity required
|
|
98
|
+
* @property {number} [quantityMin] - Minimum quantity required
|
|
99
|
+
* @property {number} [quantityMax] - Maximum quantity allowed
|
|
100
|
+
*/
|
|
101
|
+
exports.ProductSetSelectorSchema = zod_1.default.object({
|
|
102
|
+
productIdsAny: zod_1.default.array(zod_1.default.string()).max(5000).default([]).describe("Any matching catalog product IDs"),
|
|
103
|
+
productIdsAll: zod_1.default.array(zod_1.default.string()).max(5000).default([]).describe("All required catalog product IDs"),
|
|
104
|
+
allProducts: zod_1.default.boolean().default(false).describe("Includes all catalog products"),
|
|
105
|
+
quantityExact: zod_1.default.number().int().positive().optional().describe("Requires exact matched quantity"),
|
|
106
|
+
quantityMin: zod_1.default.number().int().nonnegative().optional().describe("Requires minimum matched quantity"),
|
|
107
|
+
quantityMax: zod_1.default.number().int().positive().optional().describe("Caps maximum matched quantity"),
|
|
108
|
+
}).superRefine((data, ctx) => {
|
|
109
|
+
const selectorModes = [
|
|
110
|
+
data.productIdsAny.length > 0,
|
|
111
|
+
data.productIdsAll.length > 0,
|
|
112
|
+
data.allProducts,
|
|
113
|
+
].filter(Boolean).length;
|
|
114
|
+
if (selectorModes !== 1) {
|
|
115
|
+
ctx.addIssue({
|
|
116
|
+
code: "custom",
|
|
117
|
+
path: ["productIdsAny"],
|
|
118
|
+
message: "Exactly one of productIdsAny, productIdsAll, or allProducts must be set",
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
if (data.quantityExact !== undefined && (data.quantityMin !== undefined || data.quantityMax !== undefined)) {
|
|
122
|
+
ctx.addIssue({
|
|
123
|
+
code: "custom",
|
|
124
|
+
path: ["quantityExact"],
|
|
125
|
+
message: "quantityExact cannot be combined with quantityMin or quantityMax",
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
if (data.quantityMin !== undefined &&
|
|
129
|
+
data.quantityMax !== undefined &&
|
|
130
|
+
data.quantityMax < data.quantityMin) {
|
|
131
|
+
ctx.addIssue({
|
|
132
|
+
code: "custom",
|
|
133
|
+
path: ["quantityMax"],
|
|
134
|
+
message: "quantityMax must be greater than or equal to quantityMin",
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
// ============================================================================
|
|
139
|
+
// PRODUCT SET SCHEMA
|
|
140
|
+
// ============================================================================
|
|
141
|
+
/**
|
|
142
|
+
* Product set schema.
|
|
143
|
+
* Represents a bundle or set of products with configurable pricing and targeting.
|
|
144
|
+
*
|
|
145
|
+
* @typedef {Object} ProductSet
|
|
146
|
+
* @property {string} [productRevisionId] - Version control for product changes
|
|
147
|
+
* @property {string} [code] - Stable internal code for integration matching
|
|
148
|
+
* @property {string} name - Product set name
|
|
149
|
+
* @property {string} [description] - Product set description
|
|
150
|
+
* @property {Array} [channelMappings] - Per-channel external set ID mappings
|
|
151
|
+
* @property {ProductSetTargetingMode} targetingMode - How set selects members
|
|
152
|
+
* @property {ProductSetPricingMode} pricingMode - How pricing is calculated
|
|
153
|
+
* @property {number} [fixedPrice] - Set price when pricingMode is FIXED
|
|
154
|
+
* @property {Array} [items] - Explicit product members
|
|
155
|
+
* @property {Object} [selector] - Selector definition for dynamic targeting
|
|
156
|
+
* @property {boolean} isActive - Whether product set is active
|
|
157
|
+
* @property {string} [imageUrl] - Public image URL for the set
|
|
158
|
+
* @property {Array} [imageUrls] - Multiple image URLs
|
|
159
|
+
* @property {number} [displayOrder] - Display order in catalog
|
|
160
|
+
*/
|
|
161
|
+
exports.ProductSetSchema = base_schema_1.BaseModelSchema.safeExtend({
|
|
162
|
+
productRevisionId: zod_1.default.string().nullable().optional().describe("Optional product revision ID for version-scoped catalog targeting. Ensures set applies to specific catalog version."),
|
|
163
|
+
code: zod_1.default.string().min(1).nullable().optional().describe("Stable internal code for idempotent integration matching"),
|
|
164
|
+
name: zod_1.default.string().min(1, "Product set name is required").describe("Product set name"),
|
|
165
|
+
description: zod_1.default.string().nullable().optional().describe("Product set description"),
|
|
166
|
+
channelMappings: zod_1.default.array(exports.ProductSetChannelMappingSchema).nullable().optional().describe("Per-channel product set ID mappings"),
|
|
167
|
+
targetingMode: zod_1.default.enum(ProductSetTargetingMode).default(ProductSetTargetingMode.EXPLICIT).describe("How this set selects its members"),
|
|
168
|
+
pricingMode: zod_1.default.enum(ProductSetPricingMode).default(ProductSetPricingMode.SUM_OF_ITEMS).describe("How set pricing is resolved"),
|
|
169
|
+
fixedPrice: zod_1.default.number().nonnegative().nullable().optional().describe("Set price when pricing mode is FIXED"),
|
|
170
|
+
items: zod_1.default.array(exports.ProductSetItemSchema).nullable().optional().describe("Explicit product members for EXPLICIT targeting"),
|
|
171
|
+
selector: exports.ProductSetSelectorSchema.nullable().optional().describe("Selector definition for SELECTOR targeting"),
|
|
172
|
+
isActive: zod_1.default.boolean().default(true).describe("Whether this product set is active"),
|
|
173
|
+
imageUrl: zod_1.default.string().nullable().optional().describe("Public image URL for the product set"),
|
|
174
|
+
imageUrls: zod_1.default.array(zod_1.default.string()).nullable().optional().describe("Public image URLs for the product set"),
|
|
175
|
+
displayOrder: zod_1.default.number().int().nullable().optional().describe("Display order in catalog"),
|
|
176
|
+
}).superRefine((data, ctx) => {
|
|
177
|
+
if (data.pricingMode === ProductSetPricingMode.FIXED && (data.fixedPrice === undefined || data.fixedPrice === null)) {
|
|
178
|
+
ctx.addIssue({
|
|
179
|
+
code: "custom",
|
|
180
|
+
path: ["fixedPrice"],
|
|
181
|
+
message: "fixedPrice is required when pricingMode is FIXED",
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
if (data.pricingMode === ProductSetPricingMode.SUM_OF_ITEMS && data.fixedPrice != null) {
|
|
185
|
+
ctx.addIssue({
|
|
186
|
+
code: "custom",
|
|
187
|
+
path: ["fixedPrice"],
|
|
188
|
+
message: "fixedPrice must be null or omitted when pricingMode is SUM_OF_ITEMS",
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
if (data.targetingMode === ProductSetTargetingMode.EXPLICIT) {
|
|
192
|
+
if (!data.items || data.items.length === 0) {
|
|
193
|
+
ctx.addIssue({
|
|
194
|
+
code: "custom",
|
|
195
|
+
path: ["items"],
|
|
196
|
+
message: "items is required when targetingMode is EXPLICIT",
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (data.selector != null) {
|
|
200
|
+
ctx.addIssue({
|
|
201
|
+
code: "custom",
|
|
202
|
+
path: ["selector"],
|
|
203
|
+
message: "selector must be null or omitted when targetingMode is EXPLICIT",
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (data.targetingMode === ProductSetTargetingMode.SELECTOR) {
|
|
208
|
+
if (data.selector == null) {
|
|
209
|
+
ctx.addIssue({
|
|
210
|
+
code: "custom",
|
|
211
|
+
path: ["selector"],
|
|
212
|
+
message: "selector is required when targetingMode is SELECTOR",
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
if (data.items && data.items.length > 0) {
|
|
216
|
+
ctx.addIssue({
|
|
217
|
+
code: "custom",
|
|
218
|
+
path: ["items"],
|
|
219
|
+
message: "items must be empty when targetingMode is SELECTOR",
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (!data.items || data.items.length === 0) {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const seenItemKeys = new Set();
|
|
227
|
+
for (const [index, item] of data.items.entries()) {
|
|
228
|
+
const itemKey = `${item.productId}::${item.productVariantId ?? "*"}`;
|
|
229
|
+
if (seenItemKeys.has(itemKey)) {
|
|
230
|
+
ctx.addIssue({
|
|
231
|
+
code: "custom",
|
|
232
|
+
path: ["items", index],
|
|
233
|
+
message: "Duplicate productId + productVariantId combination is not allowed in a product set",
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
seenItemKeys.add(itemKey);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
exports.CreateProductSetSchema = exports.ProductSetSchema.omit({
|
|
240
|
+
id: true,
|
|
241
|
+
createdAt: true,
|
|
242
|
+
updatedAt: true,
|
|
243
|
+
});
|
|
244
|
+
exports.UpdateProductSetSchema = exports.CreateProductSetSchema.partial().safeExtend({
|
|
245
|
+
id: zod_1.default.string(),
|
|
246
|
+
});
|
|
247
|
+
// ============================================================================
|
|
248
|
+
// DISPLAY SCHEMAS (read-optimized for catalog rendering)
|
|
249
|
+
// ============================================================================
|
|
250
|
+
/**
|
|
251
|
+
* Product set item display schema.
|
|
252
|
+
* Extended item schema with resolved product data for UI rendering.
|
|
253
|
+
*
|
|
254
|
+
* @typedef {Object} ProductSetItemDisplay
|
|
255
|
+
* @property {Object} [product] - Resolved BusinessProduct snapshot
|
|
256
|
+
*/
|
|
257
|
+
exports.ProductSetItemDisplaySchema = exports.ProductSetItemSchema.safeExtend({
|
|
258
|
+
product: product_config_schema_1.BusinessProductSchema.optional().describe("Resolved BusinessProduct snapshot for display. Populated server-side for UI rendering."),
|
|
259
|
+
}).describe("Product set item with resolved product data for catalog display");
|
|
260
|
+
/**
|
|
261
|
+
* Product set display schema.
|
|
262
|
+
* Extended set schema with resolved items and computed pricing for UI rendering.
|
|
263
|
+
*
|
|
264
|
+
* @typedef {Object} ProductSetDisplay
|
|
265
|
+
* @property {Array} items - ProductSetItemDisplay array with resolved data
|
|
266
|
+
* @property {number} [resolvedPrice] - Computed display price for the set
|
|
267
|
+
*/
|
|
268
|
+
exports.ProductSetDisplaySchema = exports.ProductSetSchema.omit({
|
|
269
|
+
items: true,
|
|
270
|
+
}).safeExtend({
|
|
271
|
+
items: zod_1.default.array(exports.ProductSetItemDisplaySchema).nullable().optional().describe("Set items with resolved product snapshots for display"),
|
|
272
|
+
resolvedPrice: zod_1.default.number().nonnegative().nullable().optional().describe("Computed display price for the set. For SUM_OF_ITEMS: sum of item prices × quantities. For FIXED: the fixedPrice value."),
|
|
273
|
+
}).describe("Product set with resolved items and computed pricing for catalog display");
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { VariantAxisType } from "../../type-definitions";
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Variant axis schema definitions for product variant configuration.
|
|
5
|
+
* @module business-mgt/product-variant-axis
|
|
6
|
+
*
|
|
7
|
+
* Variant axes define the dimensions along which products can vary (e.g., Size, Color).
|
|
8
|
+
* Each axis contains a set of values that can be selected when creating product variants.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Variant axis value schema.
|
|
12
|
+
* Represents a single selectable value within a variant axis.
|
|
13
|
+
*
|
|
14
|
+
* @typedef {Object} VariantAxisValue
|
|
15
|
+
* @property {string} id - Unique axis value ID
|
|
16
|
+
* @property {string} label - Display label for the value
|
|
17
|
+
* @property {string} [swatchColor] - Hex color code for swatch type
|
|
18
|
+
* @property {string} [imageId] - Image ID for image type
|
|
19
|
+
* @property {number} [numericValue] - Numeric value for numeric type
|
|
20
|
+
* @property {number} sortOrder - Display order within axis
|
|
21
|
+
*/
|
|
22
|
+
export declare const VariantAxisValueSchema: z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
label: z.ZodString;
|
|
25
|
+
swatchColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
imageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
27
|
+
numericValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
28
|
+
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
/**
|
|
31
|
+
* Variant axis schema.
|
|
32
|
+
* Defines a dimension along which products can vary (e.g., Size, Color, Material).
|
|
33
|
+
*
|
|
34
|
+
* @typedef {Object} VariantAxis
|
|
35
|
+
* @property {string} name - Axis name (e.g., 'Size', 'Color')
|
|
36
|
+
* @property {VariantAxisType} type - Axis rendering type
|
|
37
|
+
* @property {Array} values - Available values for this axis
|
|
38
|
+
* @property {boolean} isActive - Whether axis is active
|
|
39
|
+
*/
|
|
40
|
+
export declare const VariantAxisSchema: z.ZodObject<{
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
type: z.ZodEnum<typeof VariantAxisType>;
|
|
46
|
+
values: z.ZodArray<z.ZodObject<{
|
|
47
|
+
id: z.ZodString;
|
|
48
|
+
label: z.ZodString;
|
|
49
|
+
swatchColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
imageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
51
|
+
numericValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
52
|
+
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
54
|
+
isActive: z.ZodDefault<z.ZodBoolean>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
/**
|
|
57
|
+
* Schema for creating a new variant axis.
|
|
58
|
+
* Omits auto-generated fields.
|
|
59
|
+
*/
|
|
60
|
+
export declare const CreateVariantAxisSchema: z.ZodObject<{
|
|
61
|
+
type: z.ZodEnum<typeof VariantAxisType>;
|
|
62
|
+
values: z.ZodArray<z.ZodObject<{
|
|
63
|
+
id: z.ZodString;
|
|
64
|
+
label: z.ZodString;
|
|
65
|
+
swatchColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
|
+
imageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
67
|
+
numericValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
68
|
+
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
name: z.ZodString;
|
|
71
|
+
isActive: z.ZodDefault<z.ZodBoolean>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
/**
|
|
74
|
+
* Schema for updating an existing variant axis.
|
|
75
|
+
* All fields optional except id (required).
|
|
76
|
+
*/
|
|
77
|
+
export declare const UpdateVariantAxisSchema: z.ZodObject<{
|
|
78
|
+
type: z.ZodOptional<z.ZodEnum<typeof VariantAxisType>>;
|
|
79
|
+
values: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
label: z.ZodString;
|
|
82
|
+
swatchColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
|
+
imageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
84
|
+
numericValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
85
|
+
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
86
|
+
}, z.core.$strip>>>;
|
|
87
|
+
name: z.ZodOptional<z.ZodString>;
|
|
88
|
+
isActive: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
89
|
+
id: z.ZodString;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
/**
|
|
92
|
+
* Variant axis display schema.
|
|
93
|
+
* Optimized schema for UI rendering with display order.
|
|
94
|
+
*
|
|
95
|
+
* @typedef {Object} VariantAxisDisplay
|
|
96
|
+
* @property {string} id - Axis ID
|
|
97
|
+
* @property {string} name - Axis name
|
|
98
|
+
* @property {VariantAxisType} type - Axis rendering type
|
|
99
|
+
* @property {Array} values - Axis values
|
|
100
|
+
* @property {number} displayOrder - Display order for this axis
|
|
101
|
+
*/
|
|
102
|
+
export declare const VariantAxisDisplaySchema: z.ZodObject<{
|
|
103
|
+
id: z.ZodString;
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
type: z.ZodEnum<typeof VariantAxisType>;
|
|
106
|
+
values: z.ZodArray<z.ZodObject<{
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
label: z.ZodString;
|
|
109
|
+
swatchColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
110
|
+
imageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
111
|
+
numericValue: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
112
|
+
sortOrder: z.ZodDefault<z.ZodNumber>;
|
|
113
|
+
}, z.core.$strip>>;
|
|
114
|
+
displayOrder: z.ZodDefault<z.ZodNumber>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export type VariantAxisValue = z.infer<typeof VariantAxisValueSchema>;
|
|
117
|
+
export type VariantAxis = z.infer<typeof VariantAxisSchema>;
|
|
118
|
+
export type CreateVariantAxis = z.infer<typeof CreateVariantAxisSchema>;
|
|
119
|
+
export type UpdateVariantAxis = z.infer<typeof UpdateVariantAxisSchema>;
|
|
120
|
+
export type VariantAxisDisplay = z.infer<typeof VariantAxisDisplaySchema>;
|
|
121
|
+
/**
|
|
122
|
+
* Variant axis filter options.
|
|
123
|
+
* @interface VariantAxisFilters
|
|
124
|
+
*/
|
|
125
|
+
export interface VariantAxisFilters {
|
|
126
|
+
/** Text search across axis name */
|
|
127
|
+
search?: string;
|
|
128
|
+
/** Filter by axis type */
|
|
129
|
+
type?: VariantAxisType;
|
|
130
|
+
/** Filter by active status */
|
|
131
|
+
isActive?: boolean;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Variant axis sorting options.
|
|
135
|
+
* @interface VariantAxisSorting
|
|
136
|
+
*/
|
|
137
|
+
export interface VariantAxisSorting {
|
|
138
|
+
/** Field to sort by */
|
|
139
|
+
field: "name" | "createdAt";
|
|
140
|
+
/** Sort direction */
|
|
141
|
+
direction: "asc" | "desc";
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Variant axis query options.
|
|
145
|
+
* @interface VariantAxisQueryOptions
|
|
146
|
+
*/
|
|
147
|
+
export interface VariantAxisQueryOptions {
|
|
148
|
+
/** Page number (1-indexed) */
|
|
149
|
+
page: number;
|
|
150
|
+
/** Items per page */
|
|
151
|
+
pageSize: number;
|
|
152
|
+
/** Optional filters */
|
|
153
|
+
filters?: VariantAxisFilters;
|
|
154
|
+
/** Optional sorting */
|
|
155
|
+
sorting?: VariantAxisSorting;
|
|
156
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VariantAxisDisplaySchema = exports.UpdateVariantAxisSchema = exports.CreateVariantAxisSchema = exports.VariantAxisSchema = exports.VariantAxisValueSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const base_schema_1 = require("../../base.schema");
|
|
9
|
+
const type_definitions_1 = require("../../type-definitions");
|
|
10
|
+
/**
|
|
11
|
+
* @fileoverview Variant axis schema definitions for product variant configuration.
|
|
12
|
+
* @module business-mgt/product-variant-axis
|
|
13
|
+
*
|
|
14
|
+
* Variant axes define the dimensions along which products can vary (e.g., Size, Color).
|
|
15
|
+
* Each axis contains a set of values that can be selected when creating product variants.
|
|
16
|
+
*/
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// VARIANT AXIS VALUE SCHEMA
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Variant axis value schema.
|
|
22
|
+
* Represents a single selectable value within a variant axis.
|
|
23
|
+
*
|
|
24
|
+
* @typedef {Object} VariantAxisValue
|
|
25
|
+
* @property {string} id - Unique axis value ID
|
|
26
|
+
* @property {string} label - Display label for the value
|
|
27
|
+
* @property {string} [swatchColor] - Hex color code for swatch type
|
|
28
|
+
* @property {string} [imageId] - Image ID for image type
|
|
29
|
+
* @property {number} [numericValue] - Numeric value for numeric type
|
|
30
|
+
* @property {number} sortOrder - Display order within axis
|
|
31
|
+
*/
|
|
32
|
+
exports.VariantAxisValueSchema = zod_1.default.object({
|
|
33
|
+
id: zod_1.default.string().describe("Unique identifier for this axis value. Used in ProductVariant.axisValues mapping."),
|
|
34
|
+
label: zod_1.default.string().min(1).describe("Display label shown to customers (e.g., 'Small', 'Red', '32'). Must be unique within the axis."),
|
|
35
|
+
swatchColor: zod_1.default.string().nullable().optional().describe("Hex color code for swatch rendering (e.g., '#FF0000'). Only used when axis type is SWATCH."),
|
|
36
|
+
imageId: zod_1.default.string().nullable().optional().describe("Image ID for visual representation. Only used when axis type is IMAGE."),
|
|
37
|
+
numericValue: zod_1.default.number().nullable().optional().describe("Numeric value for size/quantity axes. Only used when axis type is NUMERIC."),
|
|
38
|
+
sortOrder: zod_1.default.number().int().default(0).describe("Display order within the axis. Lower numbers appear first."),
|
|
39
|
+
}).describe("Single selectable value within a variant axis");
|
|
40
|
+
// ============================================================================
|
|
41
|
+
// VARIANT AXIS SCHEMA
|
|
42
|
+
// ============================================================================
|
|
43
|
+
/**
|
|
44
|
+
* Variant axis schema.
|
|
45
|
+
* Defines a dimension along which products can vary (e.g., Size, Color, Material).
|
|
46
|
+
*
|
|
47
|
+
* @typedef {Object} VariantAxis
|
|
48
|
+
* @property {string} name - Axis name (e.g., 'Size', 'Color')
|
|
49
|
+
* @property {VariantAxisType} type - Axis rendering type
|
|
50
|
+
* @property {Array} values - Available values for this axis
|
|
51
|
+
* @property {boolean} isActive - Whether axis is active
|
|
52
|
+
*/
|
|
53
|
+
exports.VariantAxisSchema = base_schema_1.BaseModelSchema.safeExtend({
|
|
54
|
+
name: zod_1.default.string().min(1).describe("Axis name displayed to customers (e.g., 'Size', 'Color', 'Material'). Used in variant selection UI."),
|
|
55
|
+
type: zod_1.default.enum(type_definitions_1.VariantAxisType).describe("Rendering type determining how values are displayed (SWATCH for colors, TEXT for labels, IMAGE for visuals, NUMERIC for sizes)."),
|
|
56
|
+
values: zod_1.default.array(exports.VariantAxisValueSchema).min(1).describe("Available values for this axis. Minimum one value required."),
|
|
57
|
+
isActive: zod_1.default.boolean().default(true).describe("Whether this axis is active and available for product binding. Defaults to true."),
|
|
58
|
+
}).describe("Variant axis defining a product variation dimension");
|
|
59
|
+
// ============================================================================
|
|
60
|
+
// CREATE/UPDATE SCHEMAS
|
|
61
|
+
// ============================================================================
|
|
62
|
+
/**
|
|
63
|
+
* Schema for creating a new variant axis.
|
|
64
|
+
* Omits auto-generated fields.
|
|
65
|
+
*/
|
|
66
|
+
exports.CreateVariantAxisSchema = exports.VariantAxisSchema.omit({
|
|
67
|
+
id: true,
|
|
68
|
+
createdAt: true,
|
|
69
|
+
updatedAt: true,
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Schema for updating an existing variant axis.
|
|
73
|
+
* All fields optional except id (required).
|
|
74
|
+
*/
|
|
75
|
+
exports.UpdateVariantAxisSchema = exports.CreateVariantAxisSchema.partial().safeExtend({
|
|
76
|
+
id: zod_1.default.string().describe("Unique identifier of the VariantAxis to update"),
|
|
77
|
+
});
|
|
78
|
+
// ============================================================================
|
|
79
|
+
// DISPLAY SCHEMAS
|
|
80
|
+
// ============================================================================
|
|
81
|
+
/**
|
|
82
|
+
* Variant axis display schema.
|
|
83
|
+
* Optimized schema for UI rendering with display order.
|
|
84
|
+
*
|
|
85
|
+
* @typedef {Object} VariantAxisDisplay
|
|
86
|
+
* @property {string} id - Axis ID
|
|
87
|
+
* @property {string} name - Axis name
|
|
88
|
+
* @property {VariantAxisType} type - Axis rendering type
|
|
89
|
+
* @property {Array} values - Axis values
|
|
90
|
+
* @property {number} displayOrder - Display order for this axis
|
|
91
|
+
*/
|
|
92
|
+
exports.VariantAxisDisplaySchema = zod_1.default.object({
|
|
93
|
+
id: zod_1.default.string().describe("Unique identifier for the variant axis"),
|
|
94
|
+
name: zod_1.default.string().describe("Axis name for display"),
|
|
95
|
+
type: zod_1.default.enum(type_definitions_1.VariantAxisType).describe("Axis rendering type"),
|
|
96
|
+
values: zod_1.default.array(exports.VariantAxisValueSchema).describe("Available values for selection"),
|
|
97
|
+
displayOrder: zod_1.default.number().int().default(0).describe("Display order when showing multiple axes. Lower numbers appear first."),
|
|
98
|
+
}).describe("Variant axis optimized for UI display");
|