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,156 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { BestTimeToCall, PreferredContactMethod } from "../../type-definitions";
|
|
3
|
+
/**
|
|
4
|
+
* Customer schema.
|
|
5
|
+
* Individual customer record with contact info and preferences.
|
|
6
|
+
*
|
|
7
|
+
* @typedef {Object} Customer
|
|
8
|
+
* @property {string} [customerId] - External system customer ID
|
|
9
|
+
* @property {string} [phone_number] - Primary phone number (E.164 format)
|
|
10
|
+
* @property {string} [firstname] - Customer's first name
|
|
11
|
+
* @property {string} [lastname] - Customer's last name
|
|
12
|
+
* @property {string} [company] - Company name for business customers
|
|
13
|
+
* @property {string} [timezone] - Customer's timezone (IANA format)
|
|
14
|
+
* @property {string} [email] - Primary email address
|
|
15
|
+
* @property {string} preferred_language - Preferred language (ISO 639-1)
|
|
16
|
+
* @property {string} preferred_contact_method - Preferred contact method
|
|
17
|
+
* @property {string} [best_time_to_call] - Best time for phone contact
|
|
18
|
+
* @property {string} [notes] - Internal staff notes
|
|
19
|
+
* @property {string[]} [tags] - Categorization labels
|
|
20
|
+
* @property {Object} [custom_fields] - Business-specific custom fields
|
|
21
|
+
* @property {string} [channelId] - Channel where customer was created
|
|
22
|
+
* @property {Object} [address] - Primary physical address
|
|
23
|
+
* @property {boolean} isValidatedNames - Whether names are verified
|
|
24
|
+
* @property {string} [customerGroupId] - Customer group for pricing/terms
|
|
25
|
+
*/
|
|
26
|
+
export declare const CustomerSchema: z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
phone_number: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
32
|
+
firstname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
lastname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
company: z.ZodOptional<z.ZodString>;
|
|
35
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
36
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
37
|
+
preferred_language: z.ZodDefault<z.ZodString>;
|
|
38
|
+
preferred_contact_method: z.ZodDefault<z.ZodEnum<typeof PreferredContactMethod>>;
|
|
39
|
+
best_time_to_call: z.ZodOptional<z.ZodEnum<typeof BestTimeToCall>>;
|
|
40
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
41
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
+
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
43
|
+
channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
45
|
+
street: z.ZodString;
|
|
46
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
47
|
+
city: z.ZodString;
|
|
48
|
+
state: z.ZodString;
|
|
49
|
+
postalCode: z.ZodString;
|
|
50
|
+
country: z.ZodString;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
isValidatedNames: z.ZodDefault<z.ZodBoolean>;
|
|
53
|
+
customerGroupId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
/**
|
|
56
|
+
* Schema for creating a new customer.
|
|
57
|
+
* Omits auto-generated fields and channelId (set by system).
|
|
58
|
+
*/
|
|
59
|
+
export declare const CreateCustomerSchema: z.ZodObject<{
|
|
60
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
61
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
62
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
street: z.ZodString;
|
|
64
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
65
|
+
city: z.ZodString;
|
|
66
|
+
state: z.ZodString;
|
|
67
|
+
postalCode: z.ZodString;
|
|
68
|
+
country: z.ZodString;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
71
|
+
phone_number: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
72
|
+
firstname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
lastname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
company: z.ZodOptional<z.ZodString>;
|
|
75
|
+
preferred_language: z.ZodDefault<z.ZodString>;
|
|
76
|
+
preferred_contact_method: z.ZodDefault<z.ZodEnum<typeof PreferredContactMethod>>;
|
|
77
|
+
best_time_to_call: z.ZodOptional<z.ZodEnum<typeof BestTimeToCall>>;
|
|
78
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
79
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
80
|
+
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
81
|
+
isValidatedNames: z.ZodDefault<z.ZodBoolean>;
|
|
82
|
+
customerGroupId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
/**
|
|
85
|
+
* Schema for updating an existing customer.
|
|
86
|
+
* All fields optional except id (required).
|
|
87
|
+
*/
|
|
88
|
+
export declare const UpdateCustomerSchema: z.ZodObject<{
|
|
89
|
+
email: z.ZodOptional<z.ZodOptional<z.ZodEmail>>;
|
|
90
|
+
timezone: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
91
|
+
address: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
92
|
+
street: z.ZodString;
|
|
93
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
94
|
+
city: z.ZodString;
|
|
95
|
+
state: z.ZodString;
|
|
96
|
+
postalCode: z.ZodString;
|
|
97
|
+
country: z.ZodString;
|
|
98
|
+
}, z.core.$strip>>>;
|
|
99
|
+
customerId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
100
|
+
phone_number: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>>;
|
|
101
|
+
firstname: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
102
|
+
lastname: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
103
|
+
company: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
104
|
+
preferred_language: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
105
|
+
preferred_contact_method: z.ZodOptional<z.ZodDefault<z.ZodEnum<typeof PreferredContactMethod>>>;
|
|
106
|
+
best_time_to_call: z.ZodOptional<z.ZodOptional<z.ZodEnum<typeof BestTimeToCall>>>;
|
|
107
|
+
notes: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
108
|
+
tags: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
109
|
+
custom_fields: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
110
|
+
isValidatedNames: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
111
|
+
customerGroupId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
112
|
+
id: z.ZodString;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
export type Customer = z.infer<typeof CustomerSchema>;
|
|
115
|
+
export type CreateCustomer = z.infer<typeof CreateCustomerSchema>;
|
|
116
|
+
export type UpdateCustomer = z.infer<typeof UpdateCustomerSchema>;
|
|
117
|
+
/**
|
|
118
|
+
* Customer filter options.
|
|
119
|
+
* @interface CustomerFilters
|
|
120
|
+
*/
|
|
121
|
+
export interface CustomerFilters {
|
|
122
|
+
/** Text search across name/email/phone */
|
|
123
|
+
search?: string;
|
|
124
|
+
/** Filter by preferred contact method(s) */
|
|
125
|
+
preferredContactMethod?: (typeof PreferredContactMethod)[keyof typeof PreferredContactMethod][];
|
|
126
|
+
/** Filter by tags */
|
|
127
|
+
tags?: string[];
|
|
128
|
+
/** Filter by channel ID */
|
|
129
|
+
channelId?: string;
|
|
130
|
+
/** Filter by customer group ID */
|
|
131
|
+
customerGroupId?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Customer sorting options.
|
|
135
|
+
* @interface CustomerSorting
|
|
136
|
+
*/
|
|
137
|
+
export interface CustomerSorting {
|
|
138
|
+
/** Field to sort by */
|
|
139
|
+
field: "firstname" | "lastname" | "createdAt";
|
|
140
|
+
/** Sort direction */
|
|
141
|
+
direction: "asc" | "desc";
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Customer query options.
|
|
145
|
+
* @interface CustomerQueryOptions
|
|
146
|
+
*/
|
|
147
|
+
export interface CustomerQueryOptions {
|
|
148
|
+
/** Page number (1-indexed) */
|
|
149
|
+
page: number;
|
|
150
|
+
/** Items per page */
|
|
151
|
+
pageSize: number;
|
|
152
|
+
/** Optional filters */
|
|
153
|
+
filters?: CustomerFilters;
|
|
154
|
+
/** Optional sorting */
|
|
155
|
+
sorting?: CustomerSorting;
|
|
156
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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.UpdateCustomerSchema = exports.CreateCustomerSchema = exports.CustomerSchema = 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 Customer schema definitions for business management.
|
|
12
|
+
* @module business-mgt/customer
|
|
13
|
+
*
|
|
14
|
+
* Customers represent individual customer records with contact information,
|
|
15
|
+
* preferences, and custom fields for business-specific data.
|
|
16
|
+
*/
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// HELPER SCHEMAS
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Phone number validation (basic E.164 format).
|
|
22
|
+
* Automatically normalizes to E.164 format with leading +.
|
|
23
|
+
*/
|
|
24
|
+
const phoneNumberSchema = zod_1.default.string()
|
|
25
|
+
.regex(/^\+?[1-9]\d{1,14}$/, "Invalid phone number format")
|
|
26
|
+
.transform((phone) => {
|
|
27
|
+
return phone.startsWith("+") ? phone : `+${phone}`;
|
|
28
|
+
});
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// CUSTOMER SCHEMA
|
|
31
|
+
// ============================================================================
|
|
32
|
+
/**
|
|
33
|
+
* Customer schema.
|
|
34
|
+
* Individual customer record with contact info and preferences.
|
|
35
|
+
*
|
|
36
|
+
* @typedef {Object} Customer
|
|
37
|
+
* @property {string} [customerId] - External system customer ID
|
|
38
|
+
* @property {string} [phone_number] - Primary phone number (E.164 format)
|
|
39
|
+
* @property {string} [firstname] - Customer's first name
|
|
40
|
+
* @property {string} [lastname] - Customer's last name
|
|
41
|
+
* @property {string} [company] - Company name for business customers
|
|
42
|
+
* @property {string} [timezone] - Customer's timezone (IANA format)
|
|
43
|
+
* @property {string} [email] - Primary email address
|
|
44
|
+
* @property {string} preferred_language - Preferred language (ISO 639-1)
|
|
45
|
+
* @property {string} preferred_contact_method - Preferred contact method
|
|
46
|
+
* @property {string} [best_time_to_call] - Best time for phone contact
|
|
47
|
+
* @property {string} [notes] - Internal staff notes
|
|
48
|
+
* @property {string[]} [tags] - Categorization labels
|
|
49
|
+
* @property {Object} [custom_fields] - Business-specific custom fields
|
|
50
|
+
* @property {string} [channelId] - Channel where customer was created
|
|
51
|
+
* @property {Object} [address] - Primary physical address
|
|
52
|
+
* @property {boolean} isValidatedNames - Whether names are verified
|
|
53
|
+
* @property {string} [customerGroupId] - Customer group for pricing/terms
|
|
54
|
+
*/
|
|
55
|
+
exports.CustomerSchema = base_schema_1.BaseModelSchema.safeExtend({
|
|
56
|
+
customerId: zod_1.default.string().nullable().optional().describe("External system customer ID for integration with third-party CRM or legacy systems."),
|
|
57
|
+
phone_number: phoneNumberSchema.nullable().optional().describe("Primary phone number in E.164 format (e.g., +14155552671), automatically normalized."),
|
|
58
|
+
firstname: zod_1.default.string().nullable().optional().describe("Customer's first name for personalized communications."),
|
|
59
|
+
lastname: zod_1.default.string().nullable().optional().describe("Customer's last name for full identification."),
|
|
60
|
+
company: zod_1.default.string().optional().describe("Company name when customer represents a business entity."),
|
|
61
|
+
timezone: zod_1.default.string().optional().describe("IANA timezone identifier (e.g., 'America/New_York') for scheduling."),
|
|
62
|
+
email: zod_1.default.email().optional().describe("Primary email for confirmations and notifications."),
|
|
63
|
+
preferred_language: zod_1.default.string().default("en").describe("ISO 639-1 language code (e.g., 'en', 'es', 'fr')."),
|
|
64
|
+
preferred_contact_method: zod_1.default.enum(type_definitions_1.PreferredContactMethod).default(type_definitions_1.PreferredContactMethod.EMAIL).describe("Preferred channel for notifications: EMAIL, PHONE, SMS."),
|
|
65
|
+
best_time_to_call: zod_1.default.enum(type_definitions_1.BestTimeToCall).optional().describe("Optimal time window (MORNING, AFTERNOON, EVENING) for phone contact."),
|
|
66
|
+
notes: zod_1.default.string().optional().describe("Internal staff notes about customer preferences and history."),
|
|
67
|
+
tags: zod_1.default.array(zod_1.default.string()).optional().describe("Categorization labels for segmentation (e.g., ['vip', 'gluten-free'])."),
|
|
68
|
+
custom_fields: zod_1.default.record(zod_1.default.string(), zod_1.default.any()).optional().describe("Extensible key-value storage for business-specific attributes."),
|
|
69
|
+
channelId: zod_1.default.string().nullable().optional().describe("ID of the communication channel where customer was created."),
|
|
70
|
+
address: base_schema_1.AddressSchema.optional().describe("Primary physical address for delivery and billing."),
|
|
71
|
+
isValidatedNames: zod_1.default.boolean().default(false).describe("Whether first/last names have been verified."),
|
|
72
|
+
customerGroupId: zod_1.default.string().nullable().optional().describe("Customer group ID for pricing and terms."),
|
|
73
|
+
});
|
|
74
|
+
// ============================================================================
|
|
75
|
+
// CREATE/UPDATE SCHEMAS
|
|
76
|
+
// ============================================================================
|
|
77
|
+
/**
|
|
78
|
+
* Schema for creating a new customer.
|
|
79
|
+
* Omits auto-generated fields and channelId (set by system).
|
|
80
|
+
*/
|
|
81
|
+
exports.CreateCustomerSchema = exports.CustomerSchema.omit({
|
|
82
|
+
id: true,
|
|
83
|
+
createdAt: true,
|
|
84
|
+
updatedAt: true,
|
|
85
|
+
channelId: true,
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* Schema for updating an existing customer.
|
|
89
|
+
* All fields optional except id (required).
|
|
90
|
+
*/
|
|
91
|
+
exports.UpdateCustomerSchema = exports.CreateCustomerSchema.partial().safeExtend({
|
|
92
|
+
id: zod_1.default.string().describe("Unique identifier of the Customer to update"),
|
|
93
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Central export point for customer management schemas.
|
|
4
|
+
* @module business-mgt/customer-management
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
__exportStar(require("./customer.schema"), exports);
|
|
22
|
+
__exportStar(require("./customer-group.schema"), exports);
|
|
23
|
+
__exportStar(require("./shipping-address.schema"), exports);
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Shipping Address schema.
|
|
4
|
+
* Customer shipping address record with delivery details.
|
|
5
|
+
*
|
|
6
|
+
* @typedef {Object} ShippingAddress
|
|
7
|
+
* @property {string} customerId - Customer this address belongs to
|
|
8
|
+
* @property {string} street - Primary street address
|
|
9
|
+
* @property {string} [street2] - Secondary address line (apt, suite, unit)
|
|
10
|
+
* @property {string} city - City or municipality
|
|
11
|
+
* @property {string} state - State, province, or region
|
|
12
|
+
* @property {string} postalCode - ZIP or postal code
|
|
13
|
+
* @property {string} country - Country code or name
|
|
14
|
+
* @property {string} [recipientName] - Name of recipient
|
|
15
|
+
* @property {string} [phoneNumber] - Contact phone for delivery
|
|
16
|
+
* @property {string} [instructions] - Special delivery instructions
|
|
17
|
+
* @property {boolean} isPrimary - Whether this is the primary address
|
|
18
|
+
*/
|
|
19
|
+
export declare const ShippingAddressSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
customerId: z.ZodString;
|
|
24
|
+
street: z.ZodString;
|
|
25
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
26
|
+
city: z.ZodString;
|
|
27
|
+
state: z.ZodString;
|
|
28
|
+
postalCode: z.ZodString;
|
|
29
|
+
country: z.ZodString;
|
|
30
|
+
recipientName: z.ZodOptional<z.ZodString>;
|
|
31
|
+
phoneNumber: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
32
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
33
|
+
isPrimary: z.ZodDefault<z.ZodBoolean>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
/**
|
|
36
|
+
* Schema for creating a new shipping address.
|
|
37
|
+
* Omits auto-generated fields.
|
|
38
|
+
*/
|
|
39
|
+
export declare const CreateShippingAddressSchema: z.ZodObject<{
|
|
40
|
+
street: z.ZodString;
|
|
41
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
42
|
+
city: z.ZodString;
|
|
43
|
+
state: z.ZodString;
|
|
44
|
+
postalCode: z.ZodString;
|
|
45
|
+
country: z.ZodString;
|
|
46
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
47
|
+
isPrimary: z.ZodDefault<z.ZodBoolean>;
|
|
48
|
+
phoneNumber: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
49
|
+
customerId: z.ZodString;
|
|
50
|
+
recipientName: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
/**
|
|
53
|
+
* Schema for updating an existing shipping address.
|
|
54
|
+
* All fields optional except id (required).
|
|
55
|
+
*/
|
|
56
|
+
export declare const UpdateShippingAddressSchema: z.ZodObject<{
|
|
57
|
+
street: z.ZodOptional<z.ZodString>;
|
|
58
|
+
street2: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
59
|
+
city: z.ZodOptional<z.ZodString>;
|
|
60
|
+
state: z.ZodOptional<z.ZodString>;
|
|
61
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
62
|
+
country: z.ZodOptional<z.ZodString>;
|
|
63
|
+
instructions: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
64
|
+
isPrimary: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
65
|
+
phoneNumber: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>>;
|
|
66
|
+
customerId: z.ZodOptional<z.ZodString>;
|
|
67
|
+
recipientName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
68
|
+
id: z.ZodString;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type ShippingAddress = z.infer<typeof ShippingAddressSchema>;
|
|
71
|
+
export type CreateShippingAddress = z.infer<typeof CreateShippingAddressSchema>;
|
|
72
|
+
export type UpdateShippingAddress = z.infer<typeof UpdateShippingAddressSchema>;
|
|
73
|
+
/**
|
|
74
|
+
* Shipping address filter options.
|
|
75
|
+
* @interface ShippingAddressFilters
|
|
76
|
+
*/
|
|
77
|
+
export interface ShippingAddressFilters {
|
|
78
|
+
/** Filter by customer ID */
|
|
79
|
+
customerId?: string;
|
|
80
|
+
/** Filter by primary status */
|
|
81
|
+
isPrimary?: boolean;
|
|
82
|
+
/** Filter by country */
|
|
83
|
+
country?: string;
|
|
84
|
+
/** Filter by city */
|
|
85
|
+
city?: string;
|
|
86
|
+
/** Filter by state */
|
|
87
|
+
state?: string;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Shipping address sorting options.
|
|
91
|
+
* @interface ShippingAddressSorting
|
|
92
|
+
*/
|
|
93
|
+
export interface ShippingAddressSorting {
|
|
94
|
+
/** Field to sort by */
|
|
95
|
+
field: "createdAt" | "isPrimary" | "country" | "city";
|
|
96
|
+
/** Sort direction */
|
|
97
|
+
direction: "asc" | "desc";
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Shipping address query options.
|
|
101
|
+
* @interface ShippingAddressQueryOptions
|
|
102
|
+
*/
|
|
103
|
+
export interface ShippingAddressQueryOptions {
|
|
104
|
+
/** Page number (1-indexed) */
|
|
105
|
+
page: number;
|
|
106
|
+
/** Items per page */
|
|
107
|
+
pageSize: number;
|
|
108
|
+
/** Optional filters */
|
|
109
|
+
filters?: ShippingAddressFilters;
|
|
110
|
+
/** Optional sorting */
|
|
111
|
+
sorting?: ShippingAddressSorting;
|
|
112
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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.UpdateShippingAddressSchema = exports.CreateShippingAddressSchema = exports.ShippingAddressSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
const base_schema_1 = require("../../base.schema");
|
|
9
|
+
/**
|
|
10
|
+
* @fileoverview Shipping Address schema definitions for customer management.
|
|
11
|
+
* @module business-mgt/shipping-address
|
|
12
|
+
*
|
|
13
|
+
* Shipping addresses store customer delivery addresses with recipient details
|
|
14
|
+
* and special delivery instructions.
|
|
15
|
+
*/
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// HELPER SCHEMAS
|
|
18
|
+
// ============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Phone number validation (basic E.164 format).
|
|
21
|
+
* Automatically normalizes to E.164 format with leading +.
|
|
22
|
+
*/
|
|
23
|
+
const phoneNumberSchema = zod_1.default.string()
|
|
24
|
+
.regex(/^\+?[1-9]\d{1,14}$/, "Invalid phone number format")
|
|
25
|
+
.transform((phone) => {
|
|
26
|
+
return phone.startsWith("+") ? phone : `+${phone}`;
|
|
27
|
+
});
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// SHIPPING ADDRESS SCHEMA
|
|
30
|
+
// ============================================================================
|
|
31
|
+
/**
|
|
32
|
+
* Shipping Address schema.
|
|
33
|
+
* Customer shipping address record with delivery details.
|
|
34
|
+
*
|
|
35
|
+
* @typedef {Object} ShippingAddress
|
|
36
|
+
* @property {string} customerId - Customer this address belongs to
|
|
37
|
+
* @property {string} street - Primary street address
|
|
38
|
+
* @property {string} [street2] - Secondary address line (apt, suite, unit)
|
|
39
|
+
* @property {string} city - City or municipality
|
|
40
|
+
* @property {string} state - State, province, or region
|
|
41
|
+
* @property {string} postalCode - ZIP or postal code
|
|
42
|
+
* @property {string} country - Country code or name
|
|
43
|
+
* @property {string} [recipientName] - Name of recipient
|
|
44
|
+
* @property {string} [phoneNumber] - Contact phone for delivery
|
|
45
|
+
* @property {string} [instructions] - Special delivery instructions
|
|
46
|
+
* @property {boolean} isPrimary - Whether this is the primary address
|
|
47
|
+
*/
|
|
48
|
+
exports.ShippingAddressSchema = base_schema_1.BaseModelSchema.safeExtend({
|
|
49
|
+
customerId: zod_1.default.string().describe("ID of the customer this shipping address belongs to"),
|
|
50
|
+
street: zod_1.default.string().min(2, { message: "Street must be 2 or more characters long" }).describe("Primary street address including house/building number"),
|
|
51
|
+
street2: zod_1.default.string().optional().describe("Secondary address line for apartment, suite, or unit numbers"),
|
|
52
|
+
city: zod_1.default.string().min(2, { message: "City must be 2 or more characters long" }).describe("City or municipality name"),
|
|
53
|
+
state: zod_1.default.string().min(2, { message: "State must be 2 or more characters long" }).describe("State, province, or region code"),
|
|
54
|
+
postalCode: zod_1.default.string().min(2, { message: "Postal code must be 2 or more characters long" }).describe("ZIP code, postal code, or equivalent"),
|
|
55
|
+
country: zod_1.default.string().min(2, { message: "Country must be 2 or more characters long" }).describe("ISO country code or country name"),
|
|
56
|
+
recipientName: zod_1.default.string().optional().describe("Name of the recipient for shipping"),
|
|
57
|
+
phoneNumber: phoneNumberSchema.nullable().optional().describe("Phone number for shipping contact"),
|
|
58
|
+
instructions: zod_1.default.string().optional().describe("Special instructions for delivery"),
|
|
59
|
+
isPrimary: zod_1.default.boolean().default(false).describe("Whether this is the primary shipping address"),
|
|
60
|
+
});
|
|
61
|
+
// ============================================================================
|
|
62
|
+
// CREATE/UPDATE SCHEMAS
|
|
63
|
+
// ============================================================================
|
|
64
|
+
/**
|
|
65
|
+
* Schema for creating a new shipping address.
|
|
66
|
+
* Omits auto-generated fields.
|
|
67
|
+
*/
|
|
68
|
+
exports.CreateShippingAddressSchema = exports.ShippingAddressSchema.omit({
|
|
69
|
+
id: true,
|
|
70
|
+
createdAt: true,
|
|
71
|
+
updatedAt: true,
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Schema for updating an existing shipping address.
|
|
75
|
+
* All fields optional except id (required).
|
|
76
|
+
*/
|
|
77
|
+
exports.UpdateShippingAddressSchema = exports.CreateShippingAddressSchema.partial().safeExtend({
|
|
78
|
+
id: zod_1.default.string().describe("Unique identifier of the ShippingAddress to update"),
|
|
79
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BestTimeToCall, PreferredContactMethod } from '../type-definitions';
|
|
3
|
+
/**
|
|
4
|
+
* Customer schema - Individual customer record.
|
|
5
|
+
*
|
|
6
|
+
* @typedef {Object} Customer
|
|
7
|
+
* @property {string} [customerId] - External system customer ID for integration purposes
|
|
8
|
+
* @property {string} [phone_number] - Customer's primary phone number in E.164 format
|
|
9
|
+
* @property {string} [firstname] - Customer's first name
|
|
10
|
+
* @property {string} [lastname] - Customer's last name
|
|
11
|
+
* @property {string} [company] - Company name if customer represents a business
|
|
12
|
+
* @property {string} [timezone] - Customer's timezone for scheduling purposes
|
|
13
|
+
* @property {string} [email] - Customer's primary email address
|
|
14
|
+
* @property {string} preferred_language - Customer's preferred language for communication
|
|
15
|
+
* @property {string} preferred_contact_method - Customer's preferred method of contact
|
|
16
|
+
* @property {string} [best_time_to_call] - Best time of day to contact customer by phone
|
|
17
|
+
* @property {string} [notes] - Internal notes about the customer
|
|
18
|
+
* @property {string[]} [tags] - Labels or categories assigned to the customer
|
|
19
|
+
* @property {Object} [custom_fields] - Additional custom fields for business-specific customer data
|
|
20
|
+
* @property {string} [channelId] - Communication channel ID associated with the customer creation
|
|
21
|
+
* @property {Object} [address] - Customer's primary address information
|
|
22
|
+
* @property {boolean} isValidatedNames - Whether the customer's name has been validated for accuracy
|
|
23
|
+
*/
|
|
24
|
+
export declare const CustomerSchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
29
|
+
phone_number: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
30
|
+
firstname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
lastname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
company: z.ZodOptional<z.ZodString>;
|
|
33
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
34
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
35
|
+
preferred_language: z.ZodDefault<z.ZodString>;
|
|
36
|
+
preferred_contact_method: z.ZodDefault<z.ZodEnum<typeof PreferredContactMethod>>;
|
|
37
|
+
best_time_to_call: z.ZodOptional<z.ZodEnum<typeof BestTimeToCall>>;
|
|
38
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
39
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
40
|
+
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
41
|
+
channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
42
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
43
|
+
street: z.ZodString;
|
|
44
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
45
|
+
city: z.ZodString;
|
|
46
|
+
state: z.ZodString;
|
|
47
|
+
postalCode: z.ZodString;
|
|
48
|
+
country: z.ZodString;
|
|
49
|
+
}, z.core.$strip>>;
|
|
50
|
+
isValidatedNames: z.ZodDefault<z.ZodBoolean>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
/**
|
|
53
|
+
* Schema for creating a new customer.
|
|
54
|
+
* Omits auto-generated fields.
|
|
55
|
+
*/
|
|
56
|
+
export declare const CreateCustomerSchema: z.ZodObject<{
|
|
57
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
58
|
+
customerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
phone_number: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>;
|
|
60
|
+
firstname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
lastname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
62
|
+
company: z.ZodOptional<z.ZodString>;
|
|
63
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
64
|
+
preferred_language: z.ZodDefault<z.ZodString>;
|
|
65
|
+
preferred_contact_method: z.ZodDefault<z.ZodEnum<typeof PreferredContactMethod>>;
|
|
66
|
+
best_time_to_call: z.ZodOptional<z.ZodEnum<typeof BestTimeToCall>>;
|
|
67
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
68
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
+
custom_fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
70
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
street: z.ZodString;
|
|
72
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
73
|
+
city: z.ZodString;
|
|
74
|
+
state: z.ZodString;
|
|
75
|
+
postalCode: z.ZodString;
|
|
76
|
+
country: z.ZodString;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
isValidatedNames: z.ZodDefault<z.ZodBoolean>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
/**
|
|
81
|
+
* Schema for updating an existing customer.
|
|
82
|
+
* All fields are optional except id.
|
|
83
|
+
*/
|
|
84
|
+
export declare const UpdateCustomerSchema: z.ZodObject<{
|
|
85
|
+
email: z.ZodOptional<z.ZodOptional<z.ZodEmail>>;
|
|
86
|
+
customerId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
87
|
+
phone_number: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>>>;
|
|
88
|
+
firstname: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
89
|
+
lastname: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
90
|
+
company: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
91
|
+
timezone: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
92
|
+
preferred_language: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
93
|
+
preferred_contact_method: z.ZodOptional<z.ZodDefault<z.ZodEnum<typeof PreferredContactMethod>>>;
|
|
94
|
+
best_time_to_call: z.ZodOptional<z.ZodOptional<z.ZodEnum<typeof BestTimeToCall>>>;
|
|
95
|
+
notes: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
96
|
+
tags: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
97
|
+
custom_fields: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
98
|
+
address: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
99
|
+
street: z.ZodString;
|
|
100
|
+
street2: z.ZodOptional<z.ZodString>;
|
|
101
|
+
city: z.ZodString;
|
|
102
|
+
state: z.ZodString;
|
|
103
|
+
postalCode: z.ZodString;
|
|
104
|
+
country: z.ZodString;
|
|
105
|
+
}, z.core.$strip>>>;
|
|
106
|
+
isValidatedNames: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
export type CreateCustomer = z.infer<typeof CreateCustomerSchema>;
|
|
110
|
+
export type UpdateCustomer = z.infer<typeof UpdateCustomerSchema>;
|
|
111
|
+
export type Customer = z.infer<typeof CustomerSchema>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateCustomerSchema = exports.CreateCustomerSchema = exports.CustomerSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const base_schema_1 = require("../base.schema");
|
|
6
|
+
const type_definitions_1 = require("../type-definitions");
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Customer schema definitions for business management.
|
|
9
|
+
* @module business-mgt/customer
|
|
10
|
+
*/
|
|
11
|
+
// Phone number validation (basic E.164 format)
|
|
12
|
+
const phoneNumberSchema = zod_1.z.string()
|
|
13
|
+
.regex(/^\+?[1-9]\d{1,14}$/, 'Invalid phone number format')
|
|
14
|
+
.transform((phone) => {
|
|
15
|
+
// Normalize to E.164 format
|
|
16
|
+
return phone.startsWith('+') ? phone : `+${phone}`;
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Customer schema - Individual customer record.
|
|
20
|
+
*
|
|
21
|
+
* @typedef {Object} Customer
|
|
22
|
+
* @property {string} [customerId] - External system customer ID for integration purposes
|
|
23
|
+
* @property {string} [phone_number] - Customer's primary phone number in E.164 format
|
|
24
|
+
* @property {string} [firstname] - Customer's first name
|
|
25
|
+
* @property {string} [lastname] - Customer's last name
|
|
26
|
+
* @property {string} [company] - Company name if customer represents a business
|
|
27
|
+
* @property {string} [timezone] - Customer's timezone for scheduling purposes
|
|
28
|
+
* @property {string} [email] - Customer's primary email address
|
|
29
|
+
* @property {string} preferred_language - Customer's preferred language for communication
|
|
30
|
+
* @property {string} preferred_contact_method - Customer's preferred method of contact
|
|
31
|
+
* @property {string} [best_time_to_call] - Best time of day to contact customer by phone
|
|
32
|
+
* @property {string} [notes] - Internal notes about the customer
|
|
33
|
+
* @property {string[]} [tags] - Labels or categories assigned to the customer
|
|
34
|
+
* @property {Object} [custom_fields] - Additional custom fields for business-specific customer data
|
|
35
|
+
* @property {string} [channelId] - Communication channel ID associated with the customer creation
|
|
36
|
+
* @property {Object} [address] - Customer's primary address information
|
|
37
|
+
* @property {boolean} isValidatedNames - Whether the customer's name has been validated for accuracy
|
|
38
|
+
*/
|
|
39
|
+
exports.CustomerSchema = base_schema_1.BaseModelSchema.safeExtend({
|
|
40
|
+
customerId: zod_1.z.string().nullable().optional().describe("External system customer ID for integration with third-party CRM or legacy systems. Links WIIL Platform customer records with existing databases while maintaining internal id as primary identifier."),
|
|
41
|
+
phone_number: phoneNumberSchema.nullable().optional().describe("Primary phone number in E.164 format (e.g., +14155552671), automatically normalized. Used by AI Powered Services for voice interactions, SMS, appointment reminders, and order notifications."),
|
|
42
|
+
firstname: zod_1.z.string().nullable().optional().describe("Customer's first name for personalized communications and AI conversations. May be null for walk-in customers or minimal-info transactions."),
|
|
43
|
+
lastname: zod_1.z.string().nullable().optional().describe("Customer's last name combined with firstname for full identification in appointments and orders. May be null for casual transactions."),
|
|
44
|
+
company: zod_1.z.string().optional().describe("Company name when customer represents a business entity. Used for B2B transactions, corporate accounts, and distinguishing business vs individual customers."),
|
|
45
|
+
timezone: zod_1.z.string().optional().describe("IANA timezone identifier (e.g., 'America/New_York') for accurate appointment scheduling, reservation timing, and ensuring communications arrive at appropriate local times."),
|
|
46
|
+
email: zod_1.z.email().optional().describe("Primary email for confirmations, receipts, and AI-generated summaries. Also serves as unique identifier for account recovery and duplicate detection."),
|
|
47
|
+
preferred_language: zod_1.z.string().default('en').describe("ISO 639-1 language code (e.g., 'en', 'es', 'fr') for AI conversations and notifications. Defaults to English. Essential for multilingual operations."),
|
|
48
|
+
preferred_contact_method: zod_1.z.enum(type_definitions_1.PreferredContactMethod).default(type_definitions_1.PreferredContactMethod.EMAIL).describe("Preferred channel for notifications: EMAIL, PHONE, SMS. AI Powered Services respects this when sending reminders and updates. Defaults to EMAIL."),
|
|
49
|
+
best_time_to_call: zod_1.z.enum(type_definitions_1.BestTimeToCall).optional().describe("Optimal time window (MORNING, AFTERNOON, EVENING) for phone contact. Used by support teams and automated systems to improve contact success rates."),
|
|
50
|
+
notes: zod_1.z.string().optional().describe("Internal staff notes about customer preferences, requirements, history, or behavioral patterns. Not visible to customers; used for personalized service delivery."),
|
|
51
|
+
tags: zod_1.z.array(zod_1.z.string()).optional().describe("Categorization labels for segmentation (e.g., ['vip', 'gluten-free']). Used for marketing campaigns, analytics, and dynamic customer grouping."),
|
|
52
|
+
custom_fields: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("Extensible key-value storage for business-specific attributes (e.g., medical history, dietary restrictions, membership tier). Provides schema flexibility."),
|
|
53
|
+
channelId: zod_1.z.string().nullable().optional().describe("ID of the communication channel (phone, web, app) where customer record was created. Links to deployment configuration for attribution tracking and analytics."),
|
|
54
|
+
address: base_schema_1.AddressSchema.optional().describe("Primary physical address for delivery orders, on-site service appointments, billing, and geographic analysis."),
|
|
55
|
+
isValidatedNames: zod_1.z.boolean().default(false).describe("Whether first/last names have been verified through ID verification, payment matching, or manual confirmation. Maintains data quality and reduces fraud. Defaults to false."),
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Schema for creating a new customer.
|
|
59
|
+
* Omits auto-generated fields.
|
|
60
|
+
*/
|
|
61
|
+
exports.CreateCustomerSchema = exports.CustomerSchema.omit({
|
|
62
|
+
id: true,
|
|
63
|
+
createdAt: true,
|
|
64
|
+
updatedAt: true,
|
|
65
|
+
channelId: true,
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* Schema for updating an existing customer.
|
|
69
|
+
* All fields are optional except id.
|
|
70
|
+
*/
|
|
71
|
+
exports.UpdateCustomerSchema = exports.CreateCustomerSchema.partial().safeExtend({
|
|
72
|
+
id: zod_1.z.string(),
|
|
73
|
+
});
|